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


PHP HookManager::executeHooks方法代码示例

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


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

示例1: array

            else $board=$boardloaded[$classe];

            $var=!$var;
            if ($langfile[$key]) $langs->load($langfile[$key]);
            $title=$langs->trans($titres[$key]);
            print '<tr '.$bc[$var].'><td width="16"><a href="'.dol_buildpath($links[$key],1).'">'.img_object($title,$icons[$key]).'</a></td>';
            print '<td>'.$title.'</td>';
            print '<td align="right"><a href="'.dol_buildpath($links[$key],1).'">'.$board->nb[$val].'</a></td>';
            print '</tr>';
        }
    }

    $object=(object) array();
    $parameters=array();
    $action='';
    $reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action);    // Note that $action and $object may have been modified by some hooks

    print '</table>';
    print end_box();   
}

if ($conf->agenda->enabled && $user->rights->agenda->myactions->read && $conf->highcharts->enabled && $user->rights->highcharts->read)
{
    print start_box($langs->trans("Action"),"eight","16-Cog-4.png");
    dol_include_once("/highCharts/class/highCharts.class.php");

    $langs->load("highcharts@highCharts");

    $graph=new HighCharts($db);
    $graph->width="100%";
    $graph->height="250px";
开发者ID:nrjacker4,项目名称:crm-php,代码行数:31,代码来源:index.php

示例2: HookManager


//.........这里部分代码省略.........
                 $filename = $newfiletmp . '.' . dol_print_date(dol_now(), '%Y%m%d%H%M%S') . '.' . $newfileformat;
             } else {
                 $filename = $newfiletmp . '.' . $newfileformat;
             }
             $file = $dir . '/' . $filename;
             //print "newdir=".$dir;
             //print "newfile=".$newfile;
             //print "file=".$file;
             //print "conf->propal->dir_temp=".$conf->propal->dir_temp;
             dol_mkdir($conf->supplier_proposal->dir_temp);
             // If BILLING contact defined on invoice, we use it
             $usecontact = false;
             $arrayidcontact = $object->getIdContact('external', 'BILLING');
             if (count($arrayidcontact) > 0) {
                 $usecontact = true;
                 $result = $object->fetch_contact($arrayidcontact[0]);
             }
             // Recipient name
             if (!empty($usecontact)) {
                 // On peut utiliser le nom de la societe du contact
                 if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
                     $socobject = $object->contact;
                 } else {
                     $socobject = $object->client;
                 }
             } else {
                 $socobject = $object->client;
             }
             // Make substitution
             $substitutionarray = array('__FROM_NAME__' => $this->emetteur->name, '__FROM_EMAIL__' => $this->emetteur->email, '__TOTAL_TTC__' => $object->total_ttc, '__TOTAL_HT__' => $object->total_ht, '__TOTAL_VAT__' => $object->total_vat);
             complete_substitutions_array($substitutionarray, $langs, $object);
             // Call the ODTSubstitution hook
             $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$substitutionarray);
             $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action);
             // Note that $action and $object may have been modified by some hooks
             // Line of free text
             $newfreetext = '';
             $paramfreetext = 'SUPPLIER_PROPOSAL_FREE_TEXT';
             if (!empty($conf->global->{$paramfreetext})) {
                 $newfreetext = make_substitutions($conf->global->{$paramfreetext}, $substitutionarray);
             }
             // Open and load template
             require_once ODTPHP_PATH . 'odf.php';
             try {
                 $odfHandler = new odf($srctemplatepath, array('PATH_TO_TMP' => $conf->supplier_proposal->dir_temp, 'ZIP_PROXY' => 'PclZipProxy', 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}'));
             } catch (Exception $e) {
                 $this->error = $e->getMessage();
                 return -1;
             }
             // After construction $odfHandler->contentXml contains content and
             // [!-- BEGIN row.lines --]*[!-- END row.lines --] has been replaced by
             // [!-- BEGIN lines --]*[!-- END lines --]
             //print html_entity_decode($odfHandler->__toString());
             //print exit;
             // Make substitutions into odt of freetext
             try {
                 $odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8');
             } catch (OdfException $e) {
             }
             // Make substitutions into odt
             $array_user = $this->get_substitutionarray_user($user, $outputlangs);
             $array_soc = $this->get_substitutionarray_mysoc($mysoc, $outputlangs);
             $array_thirdparty = $this->get_substitutionarray_thirdparty($socobject, $outputlangs);
             $array_objet = $this->get_substitutionarray_object($object, $outputlangs);
             $array_other = $this->get_substitutionarray_other($outputlangs);
             $tmparray = array_merge($array_user, $array_soc, $array_thirdparty, $array_objet, $array_other);
开发者ID:NoisyBoy86,项目名称:Dolibarr_test,代码行数:67,代码来源:doc_generic_supplier_proposal_odt.modules.php

示例3: restrictedArea

// Security check
$result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', $objcanvas);

// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('thirdpartycard'));


/*
 * Actions
 */

$parameters=array('id'=>$socid, 'objcanvas'=>$objcanvas);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action);    // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors);

if (empty($reshook))
{
    if (GETPOST('getcustomercode'))
    {
        // We defined value code_client
        $_POST["code_client"]="Acompleter";
    }

    if (GETPOST('getsuppliercode'))
    {
        // We defined value code_fournisseur
        $_POST["code_fournisseur"]="Acompleter";
    }
开发者ID:nrjacker4,项目名称:crm-php,代码行数:30,代码来源:soc.php

示例4: Societe


//.........这里部分代码省略.........
                             $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 mysoc info
             $tmparray = $this->get_substitutionarray_mysoc($mysoc, $outputlangs);
             //var_dump($tmparray); exit;
             foreach ($tmparray 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 {
                         $odfHandler->setVars($key, $value, true, 'UTF-8');
                     }
                 } catch (OdfException $e) {
                 }
             }
             // Make substitutions into odt of thirdparty + external modules
             $tmparray = $this->get_substitutionarray_thirdparty($soc, $outputlangs);
             //complete_substitutions_array($tmparray, $langs, $object);
             //var_dump($object->id); exit;
             foreach ($tmparray as $key => $value) {
                 try {
                     if (preg_match('/logo$/', $key)) {
                         if (file_exists($value)) {
                             $odfHandler->setImage($key, $value);
                         } else {
                             $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
                         }
                     } else {
                         $odfHandler->setVars($key, $value, true, 'UTF-8');
                     }
                 } catch (OdfException $e) {
                 }
             }
             // Get extra fields for contractid
             include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
             $hookmanager = new HookManager($this->db);
             $hookmanager->callHooks(array('contrat_extrafields'));
             $parameters = array('id' => $object->id);
             $values = $hookmanager->executeHooks('getFields', $parameters, $object, GETPOST('action'));
             // Note that $action and $object may have been modified by hook
             if (is_array($values)) {
                 foreach ($values as $key => $value) {
                     try {
                         if (preg_match("/^options_/", $key)) {
                             $var = substr($key, 8, strlen($key));
                             // retire options_
                             $odfHandler->setVars($var, $values[$key], true, 'UTF-8');
                         }
                     } catch (OdfException $e) {
                     }
                 }
             }
             // Get extra fields for socid
             include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
             $hookmanager = new HookManager($this->db);
             $hookmanager->callHooks(array('thirdparty_extrafields'));
             $parameters = array('id' => $soc->id);
             $values = $hookmanager->executeHooks('getFields', $parameters, $soc, GETPOST('action'));
             // Note that $action and $object may have been modified by hook
             if (is_array($values)) {
                 foreach ($values as $key => $value) {
                     try {
                         if (preg_match("/^options_/", $key)) {
                             $var = substr($key, 8, strlen($key));
                             // retire options_
                             $odfHandler->setVars($var, $values[$key], true, 'UTF-8');
                         }
                     } catch (OdfException $e) {
                     }
                 }
             }
             // Write new file
             //$result=$odfHandler->exportAsAttachedFile('toto');
             $odfHandler->saveToDisk($file);
             if (!empty($conf->global->MAIN_UMASK)) {
                 @chmod($file, octdec($conf->global->MAIN_UMASK));
             }
             $odfHandler = null;
             // Destroy object
             return 1;
             // Success
         } else {
             $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
             return -1;
         }
     }
     return -1;
 }
开发者ID:nrjacker4,项目名称:crm-php,代码行数:101,代码来源:doc_generic_contract_odt.modules.php

示例5: delete

	/**
	 *    Delete a third party from database and all its dependencies (contacts, rib...)
	 *
	 *    @param	int		$id     Id of third party to delete
	 *    @return	int				<0 if KO, 0 if nothing done, >0 if OK
	 */
	function delete($id) {
		global $user, $langs, $conf;
		require_once(DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php");

		dol_syslog(get_class($this) . "::delete", LOG_DEBUG);
		$error = 0;

		// Test if child exists
		//$objectisused = $this->isObjectUsed($this->rowid); // TODO A reactivier
		if (empty($objectisused)) {


			require_once(DOL_DOCUMENT_ROOT . "/categories/class/categorie.class.php");
			$static_cat = new Categorie($this->db);
			$toute_categs = array();

			// Fill $toute_categs array with an array of (type => array of ("Categorie" instance))
			if ($this->client || $this->prospect) {
				$toute_categs ['societe'] = $static_cat->containing($this->id, 2);
			}
			if ($this->fournisseur) {
				$toute_categs ['fournisseur'] = $static_cat->containing($this->id, 1);
			}

			// Remove each "Categorie"
			foreach ($toute_categs as $type => $categs_type) {
				foreach ($categs_type as $cat) {
					$cat->del_type($this, $type);
				}
			}

			return parent::delete();

			// TODO Supprimer les contacts
			// Remove contacts
			if (!$error) {
				$sql = "DELETE FROM " . MAIN_DB_PREFIX . "socpeople";
				$sql.= " WHERE fk_soc = " . $id;
				dol_syslog(get_class($this) . "::delete sql=" . $sql, LOG_DEBUG);
				if (!$this->db->query($sql)) {
					$error++;
					$this->error .= $this->db->lasterror();
					dol_syslog(get_class($this) . "::delete erreur -1 " . $this->error, LOG_ERR);
				}
			}

			// Update link in member table
			if (!$error) {
				$sql = "UPDATE " . MAIN_DB_PREFIX . "adherent";
				$sql.= " SET fk_soc = NULL WHERE fk_soc = " . $id;
				dol_syslog(get_class($this) . "::delete sql=" . $sql, LOG_DEBUG);
				if (!$this->db->query($sql)) {
					$error++;
					$this->error .= $this->db->lasterror();
					dol_syslog(get_class($this) . "::delete erreur -1 " . $this->error, LOG_ERR);
				}
			}

			// Remove ban
			if (!$error) {
				$sql = "DELETE FROM " . MAIN_DB_PREFIX . "societe_rib";
				$sql.= " WHERE fk_soc = " . $id;
				dol_syslog(get_class($this) . "::Delete sql=" . $sql, LOG_DEBUG);
				if (!$this->db->query($sql)) {
					$error++;
					$this->error = $this->db->lasterror();
					dol_syslog(get_class($this) . "::Delete erreur -2 " . $this->error, LOG_ERR);
				}
			}

			// Removed extrafields
			//$result=$this->deleteExtraFields($this);
			//if ($result < 0) $error++;

			if (!$error) {
				// Additionnal action by hooks
				include_once(DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php');
				$hookmanager = new HookManager($this->db);
				$hookmanager->initHooks(array('thirdparty_extrafields'));
				$parameters = array();
				$action = 'delete';
				$reshook = $hookmanager->executeHooks('deleteThirdparty', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
				if (!empty($hookmanager->error)) {
					$error++;
					$this->error = $hookmanager->error;
				}
			}

			// Remove third party
			if (!$error) {
				$sql = "DELETE FROM " . MAIN_DB_PREFIX . "societe";
				$sql.= " WHERE rowid = " . $id;
				dol_syslog(get_class($this) . "::delete sql=" . $sql, LOG_DEBUG);
				if (!$this->db->query($sql)) {
//.........这里部分代码省略.........
开发者ID:nrjacker4,项目名称:crm-php,代码行数:101,代码来源:societe.class.php

示例6: Contact

 /**
  *	Function to build pdf onto disk
  *
  *	@param		Object		$object			Object expedition to generate (or id if old method)
  *	@param		Translate	$outputlangs		Lang output object
  *  @param		string		$srctemplatepath	Full path of source filename for generator using a template file
  *  @param		int			$hidedetails		Do not show line details
  *  @param		int			$hidedesc			Do not show desc
  *  @param		int			$hideref			Do not show ref
  *  @return     int         	    			1=OK, 0=KO
  */
 function write_file(&$object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
 {
     global $user, $conf, $langs, $mysoc, $hookmanager;
     $object->fetch_thirdparty();
     if (!is_object($outputlangs)) {
         $outputlangs = $langs;
     }
     // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
     if (!empty($conf->global->MAIN_USE_FPDF)) {
         $outputlangs->charset_output = 'ISO-8859-1';
     }
     $outputlangs->load("main");
     $outputlangs->load("dict");
     $outputlangs->load("companies");
     $outputlangs->load("bills");
     $outputlangs->load("products");
     $outputlangs->load("propal");
     $outputlangs->load("deliveries");
     $outputlangs->load("sendings");
     if ($conf->expedition->dir_output) {
         $object->fetch_thirdparty();
         $origin = $object->origin;
         //Creation de l expediteur
         $this->expediteur = $mysoc;
         //Creation du destinataire
         $idcontact = $object->{$origin}->getIdContact('external', 'SHIPPING');
         $this->destinataire = new Contact($this->db);
         if (!empty($idcontact[0])) {
             $this->destinataire->fetch($idcontact[0]);
         }
         //Creation du livreur
         $idcontact = $object->{$origin}->getIdContact('internal', 'LIVREUR');
         $this->livreur = new User($this->db);
         if (!empty($idcontact[0])) {
             $this->livreur->fetch($idcontact[0]);
         }
         // Definition de $dir et $file
         if ($object->specimen) {
             $dir = $conf->expedition->dir_output . "/sending";
             $file = $dir . "/SPECIMEN.pdf";
         } else {
             $expref = dol_sanitizeFileName($object->ref);
             $dir = $conf->expedition->dir_output . "/sending/" . $expref;
             $file = $dir . "/" . $expref . ".pdf";
         }
         if (!file_exists($dir)) {
             if (dol_mkdir($dir) < 0) {
                 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
                 return 0;
             }
         }
         if (file_exists($dir)) {
             // Add pdfgeneration hook
             if (!is_object($hookmanager)) {
                 include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
                 $hookmanager = new HookManager($this->db);
             }
             $hookmanager->initHooks(array('pdfgeneration'));
             $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
             global $action;
             $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action);
             // Note that $action and $object may have been modified by some hooks
             $nblignes = count($object->lines);
             $pdf = pdf_getInstance($this->format, 'mm', 'l');
             $default_font_size = pdf_getPDFFontSize($outputlangs);
             $heightforinfotot = 0;
             // Height reserved to output the info and total part
             $heightforfreetext = isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5;
             // Height reserved to output the free text on last page
             $heightforfooter = $this->marge_basse + 8;
             // Height reserved to output the footer (value include bottom margin)
             $pdf->SetAutoPageBreak(1, 0);
             if (class_exists('TCPDF')) {
                 $pdf->setPrintHeader(false);
                 $pdf->setPrintFooter(false);
             }
             $pdf->SetFont(pdf_getPDFFont($outputlangs));
             // Set path to the background PDF File
             if (empty($conf->global->MAIN_DISABLE_FPDI) && !empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
                 $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output . '/' . $conf->global->MAIN_ADD_PDF_BACKGROUND);
                 $tplidx = $pdf->importPage(1);
             }
             $pdf->Open();
             $pagenb = 0;
             $pdf->SetDrawColor(128, 128, 128);
             if (method_exists($pdf, 'AliasNbPages')) {
                 $pdf->AliasNbPages();
             }
             $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
//.........这里部分代码省略.........
开发者ID:Samara94,项目名称:dolibarr,代码行数:101,代码来源:pdf_merou.modules.php

示例7: HookManager

 /**
  *	Function to build pdf onto disk
  *
  *	@param		Object		$object			Object expedition to generate (or id if old method)
  *	@param		Translate	$outputlangs		Lang output object
  *  @param		string		$srctemplatepath	Full path of source filename for generator using a template file
  *  @param		int			$hidedetails		Do not show line details
  *  @param		int			$hidedesc			Do not show desc
  *  @param		int			$hideref			Do not show ref
  *  @return     int         	    			1=OK, 0=KO
  */
 function write_file(&$object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
 {
     global $user, $conf, $langs, $hookmanager;
     $object->fetch_thirdparty();
     if (!is_object($outputlangs)) {
         $outputlangs = $langs;
     }
     // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
     if (!empty($conf->global->MAIN_USE_FPDF)) {
         $outputlangs->charset_output = 'ISO-8859-1';
     }
     $outputlangs->load("main");
     $outputlangs->load("dict");
     $outputlangs->load("companies");
     $outputlangs->load("bills");
     $outputlangs->load("products");
     $outputlangs->load("propal");
     $outputlangs->load("deliveries");
     $outputlangs->load("sendings");
     if ($conf->expedition->dir_output) {
         // Definition de $dir et $file
         if ($object->specimen) {
             $dir = $conf->expedition->dir_output . "/sending";
             $file = $dir . "/SPECIMEN.pdf";
         } else {
             $expref = dol_sanitizeFileName($object->ref);
             $dir = $conf->expedition->dir_output . "/sending/" . $expref;
             $file = $dir . "/" . $expref . ".pdf";
         }
         if (!file_exists($dir)) {
             if (dol_mkdir($dir) < 0) {
                 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
                 return 0;
             }
         }
         if (file_exists($dir)) {
             // Add pdfgeneration hook
             if (!is_object($hookmanager)) {
                 include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
                 $hookmanager = new HookManager($this->db);
             }
             $hookmanager->initHooks(array('pdfgeneration'));
             $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
             global $action;
             $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action);
             // Note that $action and $object may have been modified by some hooks
             $nblignes = count($object->lines);
             $pdf = pdf_getInstance($this->format);
             $default_font_size = pdf_getPDFFontSize($outputlangs);
             $heightforinfotot = 0;
             // Height reserved to output the info and total part
             $heightforfreetext = isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5;
             // Height reserved to output the free text on last page
             $heightforfooter = $this->marge_basse + 8;
             // Height reserved to output the footer (value include bottom margin)
             $pdf->SetAutoPageBreak(1, 0);
             if (class_exists('TCPDF')) {
                 $pdf->setPrintHeader(false);
                 $pdf->setPrintFooter(false);
             }
             $pdf->SetFont(pdf_getPDFFont($outputlangs));
             // Set path to the background PDF File
             if (empty($conf->global->MAIN_DISABLE_FPDI) && !empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
                 $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output . '/' . $conf->global->MAIN_ADD_PDF_BACKGROUND);
                 $tplidx = $pdf->importPage(1);
             }
             $pdf->Open();
             $pagenb = 0;
             $pdf->SetDrawColor(128, 128, 128);
             if (method_exists($pdf, 'AliasNbPages')) {
                 $pdf->AliasNbPages();
             }
             $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
             $pdf->SetSubject($outputlangs->transnoentities("Shipment"));
             $pdf->SetCreator("Dolibarr " . DOL_VERSION);
             $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
             $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref) . " " . $outputlangs->transnoentities("Shipment"));
             if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) {
                 $pdf->SetCompression(false);
             }
             $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
             // Left, Top, Right
             // New page
             $pdf->AddPage();
             if (!empty($tplidx)) {
                 $pdf->useTemplate($tplidx);
             }
             $pagenb++;
             $this->_pagehead($pdf, $object, 1, $outputlangs);
//.........这里部分代码省略.........
开发者ID:TAASA,项目名称:Dolibarr-ERP-3.8.1,代码行数:101,代码来源:pdf_rouget.modules.php

示例8: left_menu

/**
 *  Show left menu bar
 *
 *  @param  array	$menu_array_before 	       	Table of menu entries to show before entries of menu handler
 *  @param  string	$helppagename    	       	Name of wiki page for help ('' by default).
 * 				     		                   	Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage
 * 									         		       For other external page: http://server/url
 *  @param  string	$moresearchform             Search Form Permanent Supplemental
 *  @param  array	$menu_array_after           Table of menu entries to show after entries of menu handler
 *  @param  int		$leftmenuwithoutmainarea    Must be set to 1. 0 by default for backward compatibility with old modules.
 *  @param  string	$title                      Title of web page
 *  @return	void
 */
function left_menu($menu_array_before, $helppagename = '', $moresearchform = '', $menu_array_after = '', $leftmenuwithoutmainarea = 0, $title = '') {
    global $user, $conf, $langs, $db;
    global $hookmanager;

    $searchform = '';
    $bookmarks = '';

    // Instantiate hooks of thirdparty module
    if (!is_object($hookmanager)) {
        include_once(DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php');
        $hookmanager = new HookManager($db);
    }
    $hookmanager->initHooks(array('searchform', 'leftblock'));

    print "\n";

    // Define $searchform
    if ($conf->societe->enabled && $conf->global->MAIN_SEARCHFORM_SOCIETE && $user->rights->societe->lire) {
        $langs->load("companies");
        $searchform.=printSearchForm(DOL_URL_ROOT . '/societe/societe.php', DOL_URL_ROOT . '/societe/societe.php', img_object('', 'company') . ' ' . $langs->trans("ThirdParties"), 'soc', 'socname');
    }

    if ($conf->societe->enabled && $conf->global->MAIN_SEARCHFORM_CONTACT && $user->rights->societe->lire) {
        $langs->load("companies");
        $searchform.=printSearchForm(DOL_URL_ROOT . '/contact/list.php', DOL_URL_ROOT . '/contact/list.php', img_object('', 'contact') . ' ' . $langs->trans("Contacts"), 'contact', 'contactname');
    }

    if ((($conf->product->enabled && $user->rights->produit->lire) || ($conf->service->enabled && $user->rights->service->lire))
            && $conf->global->MAIN_SEARCHFORM_PRODUITSERVICE) {
        $langs->load("products");
        $searchform.=printSearchForm(DOL_URL_ROOT . '/product/liste.php', DOL_URL_ROOT . '/product/liste.php', img_object('', 'product') . ' ' . $langs->trans("Products") . "/" . $langs->trans("Services"), 'products', 'sall');
    }

    if ($conf->adherent->enabled && $conf->global->MAIN_SEARCHFORM_ADHERENT && $user->rights->adherent->lire) {
        $langs->load("members");
        $searchform.=printSearchForm(DOL_URL_ROOT . '/adherents/liste.php', DOL_URL_ROOT . '/adherents/liste.php', img_object('', 'user') . ' ' . $langs->trans("Members"), 'member', 'sall');
    }

    // Execute hook printSearchForm
    $parameters = array();
    $searchform.=$hookmanager->executeHooks('printSearchForm', $parameters); // Note that $action and $object may have been modified by some hooks
    // Define $bookmarks
    if ($conf->bookmark->enabled && $user->rights->bookmark->lire) {
        include_once (DOL_DOCUMENT_ROOT . '/bookmarks/bookmarks.lib.php');
        $langs->load("bookmarks");

        $bookmarks = printBookmarksList($db, $langs);
    }

// Load the top menu manager (only if not already done)
    if (!class_exists('MenuLeft')) {
        $menufound = 0;
        $dirmenus = array_merge(array("/core/menus/"), $conf->menus_modules);
        foreach ($dirmenus as $dirmenu) {
            $menufound = dol_include_once($dirmenu . "standard/" . $left_menu);
            if ($menufound)
                break;
        }
        if (!$menufound) { // If failed to include, we try with standard
            $top_menu = 'eldy_backoffice.php';
            include_once(DOL_DOCUMENT_ROOT . "/core/menus/standard/" . $top_menu);
        }
    }

    /*
      // Left column
      print '<!--Begin left area - menu '.$left_menu.'-->'."\n";

      print '<div class = "row">'."\n";
      print '<div class = "three columns hide-on-phones">'."\n";

      //$menuleft=new MenuLeft($db,$menu_array_before,$menu_array_after);
      //$menuleft->showmenu(); // output menu_array and menu found in database


      // Show other forms
      if ($searchform)
      {
      print "\n";
      print "<!-- Begin SearchForm -->\n";
      print '<div id = "blockvmenusearch" class = "blockvmenusearch">'."\n";
      print $searchform;
      print '</div>'."\n";
      print "<!-- End SearchForm -->\n";
      }

      // More search form
//.........这里部分代码省略.........
开发者ID:nrjacker4,项目名称:crm-php,代码行数:101,代码来源:main.inc.php

示例9: HookManager


//.........这里部分代码省略.........
                 while ($i < $num) {
                     $obj = $this->db->fetch_object($result);
                     $contact_arrray[$i] = $obj->rowid;
                     $i++;
                 }
             }
             if (is_array($contact_arrray) && count($contact_arrray) > 0) {
                 try {
                     $listlines = $odfHandler->setSegment('companycontacts');
                     foreach ($contact_arrray as $array_key => $contact_id) {
                         $res_contact = $contactstatic->fetch($contact_id);
                         $tmparray = $this->get_substitutionarray_contact($contactstatic, $outputlangs, 'contact');
                         foreach ($tmparray as $key => $val) {
                             try {
                                 $listlines->setVars($key, $val, true, 'UTF-8');
                             } catch (OdfException $e) {
                             } catch (SegmentException $e) {
                             }
                         }
                         $listlines->merge();
                     }
                     $odfHandler->mergeSegment($listlines);
                 } catch (OdfException $e) {
                     $this->error = $e->getMessage();
                     dol_syslog($this->error, LOG_WARNING);
                     //return -1;
                 }
             }
             // Make substitutions into odt of thirdparty + external modules
             $tmparray = $this->get_substitutionarray_thirdparty($object, $outputlangs);
             complete_substitutions_array($tmparray, $outputlangs, $object);
             // Call the ODTSubstitution hook
             $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
             $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action);
             // Note that $action and $object may have been modified by some hooks
             // Replace variables into document
             foreach ($tmparray as $key => $value) {
                 try {
                     if (preg_match('/logo$/', $key)) {
                         if (file_exists($value)) {
                             $odfHandler->setImage($key, $value);
                         } else {
                             $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
                         }
                     } else {
                         $odfHandler->setVars($key, $value, true, 'UTF-8');
                     }
                 } catch (OdfException $e) {
                     // setVars failed, probably because key not found
                 }
             }
             // Replace labels translated
             $tmparray = $outputlangs->get_translations_for_substitutions();
             foreach ($tmparray as $key => $value) {
                 try {
                     $odfHandler->setVars($key, $value, true, 'UTF-8');
                 } catch (OdfException $e) {
                 }
             }
             // Call the beforeODTSave hook
             $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
             $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action);
             // Note that $action and $object may have been modified by some hooks
             // Write new file
             if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
                 try {
开发者ID:Samara94,项目名称:dolibarr,代码行数:67,代码来源:doc_generic_odt.modules.php

示例10:

	array('default'=>'-1','key'=>'profdemoshopwithdesk','label'=>'DemoCompanyShopWithCashDesk',
	'disablemodules'=>'adherent,boutique,categorie,don,externalsite,ficheinter,mailmanspip,prelevement,product,stock',
	'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png'),
	array('default'=>'0', 'key'=>'profdemoprodstock','label'=>'DemoCompanyProductAndStocks',
	'disablemodules'=>'adherent,boutique,contrat,categorie,don,externalsite,ficheinter,mailmanspip,prelevement,service',
	'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png'),
	array('default'=>'0', 'key'=>'profdemoall','label'=>'DemoCompanyAll',
	'disablemodules'=>'adherent,boutique,don,externalsite,mailmanspip',
	'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot9.png')
	);


$tmpaction = 'view';
$parameters=array();
$object=(object) 'nothing';
$reshook=$hookmanager->executeHooks('addDemoProfile', $parameters, $object, $tmpaction);    // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors;
/*
$demoprofiles[]=array('default'=>'0', 'key'=>'profdemomed', 'lang'=>'cabinetmed@cabinetmed', 'label'=>'DemoCabinetMed', 'url'=>'http://demodolimed.dolibarr.org',
	'disablemodules'=>'adherent,boutique,don,externalsite',
	'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png');
*/

$alwayscheckedmodules=array('barcode','bookmark','externalrss','fckeditor','geoipmaxmind','gravatar','memcached','syslog','user','webservices');  // Technical module we always want
$alwaysuncheckedmodules=array('paybox','paypal','google','scanner','workflow');  // Module we never want
$alwayshiddencheckedmodules=array('accounting','barcode','bookmark','clicktodial','comptabilite','document','domain','externalrss','externalsite','fckeditor','geoipmaxmind','gravatar','label','ldap',
								'mailmanspip','notification','syslog','user','webservices',
                                // Extended modules
                                'memcached','numberwords','zipautofillfr');
$alwayshiddenuncheckedmodules=array('boutique','ftp',
                                // Extended modules
开发者ID:nrjacker4,项目名称:crm-php,代码行数:31,代码来源:index.php

示例11: date

 function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0, &$TtoGenerate)
 {
     global $user, $langs, $conf, $mysoc, $db, $hookmanager;
     if (!is_object($outputlangs)) {
         $outputlangs = $langs;
     }
     // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
     if (!empty($conf->global->MAIN_USE_FPDF)) {
         $outputlangs->charset_output = 'ISO-8859-1';
     }
     $outputlangs->load("main");
     $outputlangs->load("dict");
     $outputlangs->load("companies");
     $outputlangs->load("bills");
     $outputlangs->load("products");
     if ($conf->facture->dir_output) {
         $dir = $conf->lcr->dir_output . "/";
         $file = $dir . "" . 'lcr_' . date('YmdHis') . ".pdf";
         if (!file_exists($dir)) {
             if (dol_mkdir($dir) < 0) {
                 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
                 return 0;
             }
         }
         if (file_exists($dir)) {
             $pdf = pdf_getInstance($this->format);
             $pdf->SetAutoPageBreak(1, 0);
             $this->_showLCR($pdf, $object, $outputlangs, $TtoGenerate);
             $pdf->Close();
             $pdf->Output($file, 'F');
             // Add pdfgeneration hook
             if (!is_object($hookmanager)) {
                 include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
                 $hookmanager = new HookManager($this->db);
             }
             $hookmanager->initHooks(array('pdfgeneration'));
             $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
             global $action;
             $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action);
             // Note that $action and $object may have been modified by some hooks
             if (!empty($conf->global->MAIN_UMASK)) {
                 @chmod($file, octdec($conf->global->MAIN_UMASK));
             }
             return 1;
             // Pas d'erreur
         } else {
             $this->error = $langs->trans("ErrorCanNotCreateDir", $dir);
             return 0;
         }
     } else {
         $this->error = $langs->trans("ErrorConstantNotDefined", "FAC_OUTPUTDIR");
         return 0;
     }
     $this->error = $langs->trans("ErrorUnknown");
     return 0;
     // Erreur par defaut
 }
开发者ID:ATM-Consulting,项目名称:dolibarr_module_lcr,代码行数:57,代码来源:pdf_generic_lcr.modules.php

示例12: sprintf

 /**
  *	Fonction generant la rapport sur le disque
  *
  *	@param	string	$_dir			repertoire
  *	@param	int		$month			mois du rapport
  *	@param	int		$year			annee du rapport
  *	@param	string	$outputlangs	Lang output object
  *	@return	int						<0 if KO, >0 if OK
  */
 function write_file($_dir, $month, $year, $outputlangs)
 {
     include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
     global $user, $langs, $conf;
     $socid = 0;
     if ($user->societe_id) {
         $socid = $user->societe_id;
     }
     if (!is_object($outputlangs)) {
         $outputlangs = $langs;
     }
     // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
     if (!empty($conf->global->MAIN_USE_FPDF)) {
         $outputlangs->charset_output = 'ISO-8859-1';
     }
     $this->month = $month;
     $this->year = $year;
     $dir = $_dir . '/' . $year;
     if (!is_dir($dir)) {
         $result = dol_mkdir($dir);
         if ($result < 0) {
             $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
             return -1;
         }
     }
     $month = sprintf("%02d", $month);
     $year = sprintf("%04d", $year);
     $file = $dir . "/payments-" . $year . "-" . $month . ".pdf";
     // Add pdfgeneration hook
     if (!is_object($hookmanager)) {
         include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
         $hookmanager = new HookManager($this->db);
     }
     $hookmanager->initHooks(array('pdfgeneration'));
     $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
     global $action;
     $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action);
     // Note that $action and $object may have been modified by some hooks
     $pdf = pdf_getInstance($this->format);
     $default_font_size = pdf_getPDFFontSize($outputlangs);
     // Must be after pdf_getInstance
     if (class_exists('TCPDF')) {
         $pdf->setPrintHeader(false);
         $pdf->setPrintFooter(false);
     }
     $pdf->SetFont(pdf_getPDFFont($outputlangs));
     $num = 0;
     $lines = array();
     $sql = "SELECT p.datep as dp, f.facnumber";
     //$sql .= ", c.libelle as paiement_type, p.num_paiement";
     $sql .= ", c.code as paiement_code, p.num_paiement";
     $sql .= ", p.amount as paiement_amount, f.total_ttc as facture_amount ";
     $sql .= ", pf.amount as pf_amount ";
     $sql .= ", p.rowid as prowid";
     $sql .= " FROM " . MAIN_DB_PREFIX . "paiement as p, " . MAIN_DB_PREFIX . "facture as f,";
     $sql .= " " . MAIN_DB_PREFIX . "c_paiement as c, " . MAIN_DB_PREFIX . "paiement_facture as pf,";
     $sql .= " " . MAIN_DB_PREFIX . "societe as s";
     if (!$user->rights->societe->client->voir && !$socid) {
         $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
     }
     $sql .= " WHERE f.fk_soc = s.rowid AND pf.fk_facture = f.rowid AND pf.fk_paiement = p.rowid";
     $sql .= " AND f.entity = " . $conf->entity;
     $sql .= " AND p.fk_paiement = c.id ";
     $sql .= " AND p.datep BETWEEN '" . $this->db->idate(dol_get_first_day($year, $month)) . "' AND '" . $this->db->idate(dol_get_last_day($year, $month)) . "'";
     if (!$user->rights->societe->client->voir && !$socid) {
         $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
     }
     if (!empty($socid)) {
         $sql .= " AND s.rowid = " . $socid;
     }
     $sql .= " ORDER BY p.datep ASC, pf.fk_paiement ASC";
     dol_syslog(get_class($this) . "::write_file", LOG_DEBUG);
     $result = $this->db->query($sql);
     if ($result) {
         $num = $this->db->num_rows($result);
         $i = 0;
         $var = True;
         while ($i < $num) {
             $objp = $this->db->fetch_object($result);
             $var = !$var;
             $lines[$i][0] = $objp->facnumber;
             $lines[$i][1] = dol_print_date($this->db->jdate($objp->dp), "day", false, $outputlangs, true);
             $lines[$i][2] = $langs->transnoentities("PaymentTypeShort" . $objp->paiement_code);
             $lines[$i][3] = $objp->num_paiement;
             $lines[$i][4] = price($objp->paiement_amount);
             $lines[$i][5] = price($objp->facture_amount);
             $lines[$i][6] = price($objp->pf_amount);
             $lines[$i][7] = $objp->prowid;
             $i++;
         }
     } else {
//.........这里部分代码省略.........
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:101,代码来源:pdf_paiement.class.php

示例13: dol_loginfunction

/**
 * Show Dolibarr default login page.
 * Part of this code is also duplicated into main.inc.php::top_htmlhead
 *
 * @param		Translate	$langs		Lang object (must be initialized by a new).
 * @param		Conf		$conf		Conf object
 * @param		Societe		$mysoc		Company object
 * @return		void
 */
function dol_loginfunction($langs, $conf, $mysoc)
{
    global $dolibarr_main_demo, $db;
    global $smartphone, $hookmanager;
    // Instantiate hooks of thirdparty module only if not already define
    if (!is_object($hookmanager)) {
        include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
        $hookmanager = new HookManager($db);
    }
    $hookmanager->initHooks(array('mainloginpage'));
    $langcode = GETPOST('lang') ? is_object($langs) && $langs->defaultlang ? $langs->defaultlang : 'auto' : GETPOST('lang');
    $langs->setDefaultLang($langcode);
    $langs->load("main");
    $langs->load("other");
    $langs->load("help");
    $langs->load("admin");
    $main_authentication = $conf->file->main_authentication;
    $session_name = session_name();
    $dol_url_root = DOL_URL_ROOT;
    $php_self = $_SERVER['PHP_SELF'];
    $php_self .= $_SERVER["QUERY_STRING"] ? '?' . $_SERVER["QUERY_STRING"] : '';
    // Title
    $title = 'Speedealing ' . DOL_VERSION;
    if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
        $title = $conf->global->MAIN_APPLICATION_TITLE;
    }
    // Select templates
    if (file_exists(DOL_DOCUMENT_ROOT . "/theme/" . $conf->theme . "/tpl/login.tpl.php")) {
        $template_dir = DOL_DOCUMENT_ROOT . "/theme/" . $conf->theme . "/tpl/";
    } else {
        $template_dir = DOL_DOCUMENT_ROOT . "/core/tpl/";
    }
    $conf->css = "/theme/" . (GETPOST('theme') ? GETPOST('theme', 'alpha') : $conf->theme) . "/style.css.php?lang=" . $langs->defaultlang;
    $conf_css = DOL_URL_ROOT . $conf->css;
    // Set cookie for timeout management
    $prefix = dol_getprefix();
    $sessiontimeout = 'DOLSESSTIMEOUT_' . $prefix;
    if (!empty($conf->global->MAIN_SESSION_TIMEOUT)) {
        setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", '', 0);
    }
    if (GETPOST('urlfrom', 'alpha')) {
        $_SESSION["urlfrom"] = GETPOST('urlfrom', 'alpha');
    } else {
        unset($_SESSION["urlfrom"]);
    }
    if (!GETPOST("username")) {
        $focus_element = 'username';
    } else {
        $focus_element = 'password';
    }
    $login_background = DOL_URL_ROOT . '/theme/login_background.png';
    if (file_exists(DOL_DOCUMENT_ROOT . '/theme/' . $conf->theme . '/img/login_background.png')) {
        $login_background = DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/login_background.png';
    }
    $demologin = '';
    $demopassword = '';
    if (!empty($dolibarr_main_demo)) {
        $tab = explode(',', $dolibarr_main_demo);
        $demologin = $tab[0];
        $demopassword = $tab[1];
    }
    // Execute hook getLoginPageOptions
    // Should be an array with differents options in $hookmanager->resArray
    $parameters = array('entity' => $_POST['entity']);
    $hookmanager->executeHooks('getLoginPageOptions', $parameters);
    // Note that $action and $object may have been modified by some hooks
    // Login
    $login = !empty($hookmanager->resArray['username']) ? $hookmanager->resArray['username'] : (GETPOST("username", "alpha", 2) ? GETPOST("username", "alpha", 2) : $demologin);
    $password = $demopassword;
    // Show logo (search in order: small company logo, large company logo, theme logo, common logo)
    $width = 0;
    $urllogo = DOL_URL_ROOT . '/theme/login_logo.png';
    if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_small)) {
        $urllogo = DOL_URL_ROOT . '/viewimage.php?cache=1&amp;modulepart=companylogo&amp;file=' . urlencode('thumbs/' . $mysoc->logo_small);
    } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output . '/logos/' . $mysoc->logo)) {
        $urllogo = DOL_URL_ROOT . '/viewimage.php?cache=1&amp;modulepart=companylogo&amp;file=' . urlencode($mysoc->logo);
        $width = 128;
    } elseif (is_readable(DOL_DOCUMENT_ROOT . '/theme/' . $conf->theme . '/img/dolibarr_logo.png')) {
        $urllogo = DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/dolibarr_logo.png';
    } elseif (is_readable(DOL_DOCUMENT_ROOT . '/theme/dolibarr_logo.png')) {
        $urllogo = DOL_URL_ROOT . '/theme/dolibarr_logo.png';
    }
    // Security graphical code
    $captcha = 0;
    $captcha_refresh = '';
    if (function_exists("imagecreatefrompng") && !empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) {
        $captcha = 1;
        $captcha_refresh = img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"');
    }
    // Extra link
    $forgetpasslink = 0;
//.........这里部分代码省略.........
开发者ID:nrjacker4,项目名称:crm-php,代码行数:101,代码来源:security2.lib.php

示例14: count


//.........这里部分代码省略.........
             $nblignes = count($object->lines);
             for ($i = 0; $i < $nblignes; $i++) {
                 $curY = $nexY;
                 $pdf->SetFont('', '', $default_font_size - 1);
                 // Dans boucle pour gerer multi-page
                 // Description of product line
                 pdf_writelinedesc($pdf, $object, $i, $outputlangs, 100, 3, 30, $curY, 1, $hidedesc, 0, $hookmanager);
                 $pdf->SetFont('', '', $default_font_size - 1);
                 // On repositionne la police par defaut
                 $nexY = $pdf->GetY();
                 $ref = pdf_getlineref($object, $i, $outputlangs, $hidedetails, $hookmanager);
                 $pdf->SetXY(10, $curY);
                 $pdf->MultiCell(20, 3, $ref, 0, 'C');
                 $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails, $hookmanager);
                 $pdf->SetXY(133, $curY);
                 $pdf->MultiCell(12, 3, $vat_rate, 0, 'C');
                 $qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails, $hookmanager);
                 $pdf->SetXY(145, $curY);
                 $pdf->MultiCell(10, 3, $qty, 0, 'C');
                 $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails, $hookmanager);
                 $pdf->SetXY(156, $curY);
                 $pdf->MultiCell(18, 3, $up_excl_tax, 0, 'R', 0);
                 $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails, $hookmanager);
                 $pdf->SetXY(174, $curY);
                 $pdf->MultiCell(26, 3, $total_excl_tax, 0, 'R', 0);
                 $nexY += 2;
                 // Passe espace entre les lignes
                 // cherche nombre de lignes a venir pour savoir si place suffisante
                 if ($i < $nblignes - 1 && empty($hidedesc)) {
                     //on recupere la description du produit suivant
                     $follow_descproduitservice = $object->lines[$i + 1]->desc;
                     //on compte le nombre de ligne afin de verifier la place disponible (largeur de ligne 52 caracteres)
                     $nblineFollowDesc = dol_nboflines_bis($follow_descproduitservice, 52, $outputlangs->charset_output) * 4;
                 } else {
                     $nblineFollowDesc = 0;
                 }
                 if ($nexY + $nblineFollowDesc > $tab_top + $tab_height && $i < $nblignes - 1 || isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
                     $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
                     // New page
                     $pdf->AddPage();
                     if (!empty($tplidx)) {
                         $pdf->useTemplate($tplidx);
                     }
                     $pagenb++;
                     $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager);
                     $pdf->SetFont('', '', $default_font_size - 1);
                     $pdf->MultiCell(0, 3, '');
                     // Set interline to 3
                     $pdf->SetTextColor(0, 0, 0);
                     $nexY = $tab_top + 8;
                 }
             }
             $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
             $bottomlasttab = $tab_top + $tab_height + 1;
             // Affiche zone infos
             $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
             // Affiche zone totaux
             $tab2_top = 241;
             $tab2_lh = 4;
             $pdf->SetFont('', '', $default_font_size);
             $pdf->SetXY(132, $tab2_top + 0);
             $pdf->MultiCell(42, $tab2_lh, $langs->transnoentities("TotalHT"), 0, 'R', 0);
             $pdf->SetXY(132, $tab2_top + $tab2_lh);
             $pdf->MultiCell(42, $tab2_lh, $langs->transnoentities("TotalVAT"), 0, 'R', 0);
             $pdf->SetXY(132, $tab2_top + $tab2_lh * 2);
             $pdf->MultiCell(42, $tab2_lh, $langs->transnoentities("TotalTTC"), 1, 'R', 1);
             $pdf->SetXY(174, $tab2_top + 0);
             $pdf->MultiCell(26, $tab2_lh, price($object->total_ht), 0, 'R', 0);
             $pdf->SetXY(174, $tab2_top + $tab2_lh);
             $pdf->MultiCell(26, $tab2_lh, price($object->total_tva), 0, 'R', 0);
             $pdf->SetXY(174, $tab2_top + $tab2_lh * 2);
             $pdf->MultiCell(26, $tab2_lh, price($object->total_ttc), 1, 'R', 1);
             // Pied de page
             $this->_pagefoot($pdf, $object, $outputlangs);
             $pdf->AliasNbPages();
             $pdf->Close();
             $pdf->Output($file, 'F');
             // Actions on extra fields (by external module or standard code)
             if (!is_object($hookmanager)) {
                 include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
                 $hookmanager = new HookManager($this->db);
             }
             $hookmanager->initHooks(array('pdfgeneration'));
             $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
             global $action;
             $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action);
             // Note that $action and $object may have been modified by some hooks
             if (!empty($conf->global->MAIN_UMASK)) {
                 @chmod($file, octdec($conf->global->MAIN_UMASK));
             }
             return 1;
         }
     } else {
         $this->error = $langs->transnoentities("ErrorConstantNotDefined", "COMMANDE_OUTPUTDIR");
         return 0;
     }
     $this->error = $langs->transnoentities("ErrorUnknown");
     return 0;
     // Erreur par defaut
 }
开发者ID:nrjacker4,项目名称:crm-php,代码行数:101,代码来源:pdf_edison.modules.php

示例15: sendfile

 /**
  * Send mail that was prepared by constructor
  *
  * @return    boolean     True if mail sent, false otherwise
  */
 function sendfile()
 {
     global $conf, $db;
     $errorlevel = error_reporting();
     error_reporting($errorlevel ^ E_WARNING);
     // Desactive warnings
     $res = false;
     if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) {
         require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
         $hookmanager = new HookManager($db);
         $hookmanager->initHooks(array('maildao'));
         $reshook = $hookmanager->executeHooks('doactions', $parameters, $this, $action);
         // Note that $action and $object may have been modified by some hooks
         if (!empty($reshook)) {
             $this->error = "Error in hook maildao doactions " . $reshook;
             dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_ERR);
             return $reshook;
         }
         // Action according to choosed sending method
         if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') {
             // Use mail php function (default PHP method)
             // ------------------------------------------
             dol_syslog("CMailFile::sendfile addr_to=" . $this->addr_to . ", subject=" . $this->subject, LOG_DEBUG);
             dol_syslog("CMailFile::sendfile header=\n" . $this->headers, LOG_DEBUG);
             //dol_syslog("CMailFile::sendfile message=\n".$message);
             // If Windows, sendmail_from must be defined
             if (isset($_SERVER["WINDIR"])) {
                 if (empty($this->addr_from)) {
                     $this->addr_from = 'robot@example.com';
                 }
                 @ini_set('sendmail_from', $this->getValidAddress($this->addr_from, 2));
             }
             // Forcage parametres
             if (!empty($conf->global->MAIN_MAIL_SMTP_SERVER)) {
                 ini_set('SMTP', $conf->global->MAIN_MAIL_SMTP_SERVER);
             }
             if (!empty($conf->global->MAIN_MAIL_SMTP_PORT)) {
                 ini_set('smtp_port', $conf->global->MAIN_MAIL_SMTP_PORT);
             }
             $dest = $this->getValidAddress($this->addr_to, 2);
             if (!$dest) {
                 $this->error = "Failed to send mail with php mail to HOST=" . ini_get('SMTP') . ", PORT=" . ini_get('smtp_port') . "<br>Recipient address '{$dest}' invalid";
                 dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_ERR);
             } else {
                 dol_syslog("CMailFile::sendfile: mail start HOST=" . ini_get('SMTP') . ", PORT=" . ini_get('smtp_port'), LOG_DEBUG);
                 $bounce = '';
                 // By default
                 if (!empty($conf->global->MAIN_MAIL_ALLOW_SENDMAIL_F)) {
                     // le "Return-Path" (retour des messages bounced) dans les header ne fonctionne pas avec tous les MTA
                     // Le forcage de la valeure grace à l'option -f de sendmail est donc possible si la constante MAIN_MAIL_ALLOW_SENDMAIL_F est definie.
                     // La variable definie pose des pb avec certains sendmail securisee (option -f refusee car dangereuse)
                     $bounce .= ($bounce ? ' ' : '') . (!empty($conf->global->MAIN_MAIL_ERRORS_TO) ? '-f' . $this->getValidAddress($conf->global->MAIN_MAIL_ERRORS_TO, 2) : ($this->addr_from != '' ? '-f' . $this->getValidAddress($this->addr_from, 2) : ''));
                 }
                 if (!empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_BA)) {
                     $bounce .= ($bounce ? ' ' : '') . '-ba';
                 }
                 $this->message = stripslashes($this->message);
                 if (!empty($conf->global->MAIN_MAIL_DEBUG)) {
                     $this->dump_mail();
                 }
                 if (!empty($bounce)) {
                     $res = mail($dest, $this->encodetorfc2822($this->subject), $this->message, $this->headers, $bounce);
                 } else {
                     $res = mail($dest, $this->encodetorfc2822($this->subject), $this->message, $this->headers);
                 }
                 if (!$res) {
                     $this->error = "Failed to send mail with php mail";
                     $linuxlike = 1;
                     if (preg_match('/^win/i', PHP_OS)) {
                         $linuxlike = 0;
                     }
                     if (preg_match('/^mac/i', PHP_OS)) {
                         $linuxlike = 0;
                     }
                     if (!$linuxlike) {
                         $this->error .= " to HOST=" . ini_get('SMTP') . ", PORT=" . ini_get('smtp_port');
                         // This values are value used only for non linuxlike systems
                     }
                     $this->error .= ".<br>Check your server logs and your firewalls setup";
                     dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_ERR);
                 } else {
                     dol_syslog("CMailFile::sendfile: mail end success", LOG_DEBUG);
                 }
             }
             if (isset($_SERVER["WINDIR"])) {
                 @ini_restore('sendmail_from');
             }
             // Forcage parametres
             if (!empty($conf->global->MAIN_MAIL_SMTP_SERVER)) {
                 ini_restore('SMTP');
             }
             if (!empty($conf->global->MAIN_MAIL_SMTP_PORT)) {
                 ini_restore('smtp_port');
             }
         } else {
//.........这里部分代码省略.........
开发者ID:Albertopf,项目名称:prueba,代码行数:101,代码来源:CMailFile.class.php


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