当前位置: 首页>>代码示例>>PHP>>正文


PHP Societe::getIdContact方法代码示例

本文整理汇总了PHP中Societe::getIdContact方法的典型用法代码示例。如果您正苦于以下问题:PHP Societe::getIdContact方法的具体用法?PHP Societe::getIdContact怎么用?PHP Societe::getIdContact使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Societe的用法示例。


在下文中一共展示了Societe::getIdContact方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Societe

 /**
  *	Function to build a document on disk using the generic odt module.
  *
  *	@param	Societe		$object				Object source to build document
  *	@param	Translate	$outputlangs		Lang output object
  * 	@param	string		$srctemplatepath	Full path of source filename for generator using a template file
  *	@return	int         					1 if OK, <=0 if KO
  */
 function write_file($object, $outputlangs, $srctemplatepath)
 {
     global $user, $langs, $conf, $mysoc;
     if (empty($srctemplatepath)) {
         dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING);
         return -1;
     }
     if (!is_object($outputlangs)) {
         $outputlangs = $langs;
     }
     $sav_charset_output = $outputlangs->charset_output;
     $outputlangs->charset_output = 'UTF-8';
     $outputlangs->load("main");
     $outputlangs->load("dict");
     $outputlangs->load("companies");
     $outputlangs->load("projects");
     if ($conf->contrat->dir_output) {
         $soc = new Societe($this->db);
         $soc->fetch($object->socid);
         $dir = $conf->contrat->dir_output;
         $objectref = dol_sanitizeFileName($object->ref);
         if (!preg_match('/specimen/i', $objectref)) {
             $dir .= "/" . $objectref;
         }
         if (!file_exists($dir)) {
             if (create_exdir($dir) < 0) {
                 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
                 return -1;
             }
         }
         if (file_exists($dir)) {
             //print "srctemplatepath=".$srctemplatepath;	// Src filename
             $newfile = basename($srctemplatepath);
             $newfiletmp = preg_replace('/\\.odt/i', '', $newfile);
             $newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
             $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
             $file = $dir . '/' . $newfiletmp . '.' . dol_print_date(dol_now(), '%Y%m%d%H%M%S') . '.odt';
             //print "newdir=".$dir;
             //print "newfile=".$newfile;
             //print "file=".$file;
             //print "conf->societe->dir_temp=".$conf->societe->dir_temp;
             create_exdir($conf->contrat->dir_temp);
             // If BILLING contact defined on invoice, we use it
             $usecontact = false;
             $arrayidcontact = $object->getIdContact('external', 'SALESREPSIGN');
             if (count($arrayidcontact) > 0) {
                 $usecontact = true;
                 $result = $soc->fetch_contact($arrayidcontact[0]);
             }
             // Recipient name
             if (!empty($usecontact)) {
                 // On peut utiliser le nom de la societe du contact
                 if ($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) {
                     $socobject = $object->contact;
                 } else {
                     $socobject = $soc->client;
                 }
             } else {
                 $socobject = $soc->client;
             }
             // Make substitution
             $substitutionarray = array('__FROM_NAME__' => $this->emetteur->nom, '__FROM_EMAIL__' => $this->emetteur->email, '__TOTAL_TTC__' => $object->total_ttc, '__TOTAL_HT__' => $object->total_ht, '__TOTAL_VAT__' => $object->total_vat, 'date' => dol_print_date($object->date_contrat, "%d %b %Y"));
             complete_substitutions_array($substitutionarray, $langs, $object);
             // Open and load template
             require_once ODTPHP_PATH . 'odf.php';
             $odfHandler = new odf($srctemplatepath, array('PATH_TO_TMP' => $conf->contrat->dir_temp, 'ZIP_PROXY' => 'PclZipProxy', 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}'));
             //print $odfHandler->__toString()."\n";
             //
             foreach ($substitutionarray as $key => $value) {
                 try {
                     if (preg_match('/logo$/', $key)) {
                         //var_dump($value);exit;
                         if (file_exists($value)) {
                             $odfHandler->setImage($key, $value);
                         } else {
                             $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
                         }
                     } else {
                         //print $key.' '.$value;exit;
                         $odfHandler->setVars($key, $value, true, 'UTF-8');
                     }
                 } catch (OdfException $e) {
                 }
             }
             // Make substitutions into odt of user info
             $tmparray = $this->get_substitutionarray_user($user, $outputlangs);
             //var_dump($tmparray); exit;
             foreach ($tmparray as $key => $value) {
                 try {
                     if (preg_match('/logo$/', $key)) {
                         //var_dump($value);exit;
                         if (file_exists($value)) {
//.........这里部分代码省略.........
开发者ID:nrjacker4,项目名称:crm-php,代码行数:101,代码来源:doc_generic_contract_odt.modules.php


注:本文中的Societe::getIdContact方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。