本文整理汇总了PHP中Translate::transnoentitiesnoconv方法的典型用法代码示例。如果您正苦于以下问题:PHP Translate::transnoentitiesnoconv方法的具体用法?PHP Translate::transnoentitiesnoconv怎么用?PHP Translate::transnoentitiesnoconv使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Translate
的用法示例。
在下文中一共展示了Translate::transnoentitiesnoconv方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getState
/**
* Define array with couple subtitution key => subtitution value
*
* @param Object $object Object
* @param Translate $outputlangs Language object for output
* @return array Array of substitution key->code
*/
function get_substitutionarray_thirdparty($object, $outputlangs)
{
global $conf;
if (empty($object->country) && !empty($object->country_code)) {
$object->country = $outputlangs->transnoentitiesnoconv("Country" . $object->country_code);
}
if (empty($mysoc->state) && !empty($mysoc->state_code)) {
$object->state = getState($object->state_code, 0);
}
return array('company_name' => $object->name, 'company_email' => $object->email, 'company_phone' => $object->phone, 'company_fax' => $object->fax, 'company_address' => $object->address, 'company_zip' => $object->zip, 'company_town' => $object->town, 'company_country' => $object->country, 'company_country_code' => $object->country_code, 'company_state' => $object->state, 'company_state_code' => $object->state_code, 'company_web' => $object->url, 'company_barcode' => $object->barcode, 'company_vatnumber' => $object->tva_intra, 'company_customercode' => $object->code_client, 'company_suppliercode' => $object->code_fournisseur, 'company_customeraccountancycode' => $object->code_compta, 'company_supplieraccountancycode' => $object->code_compta_fournisseur, 'company_juridicalstatus' => $object->forme_juridique, 'company_capital' => $object->capital, 'company_idprof1' => $object->idprof1, 'company_idprof2' => $object->idprof2, 'company_idprof3' => $object->idprof3, 'company_idprof4' => $object->idprof4, 'company_idprof5' => $object->idprof5, 'company_idprof6' => $object->idprof6, 'company_note' => $object->note);
}
示例2: getFullName
/**
* Return full name (civility+' '+name+' '+lastname)
*
* @param Translate $langs Language object for translation of civility
* @param int $option 0=No option, 1=Add civility
* @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname
* @param int $maxlen Maximum length
* @return string String with full name
*/
function getFullName($langs, $option = 0, $nameorder = -1, $maxlen = 0)
{
global $conf;
$lastname = $this->Lastname;
$firstname = $this->Firstname;
if (empty($lastname)) {
$lastname = $this->name ? $this->name : $this->nom;
}
if (empty($firstname)) {
$firstname = $this->prenom;
}
$ret = '';
if ($option && $this->civilite_id) {
if ($langs->transnoentitiesnoconv("Civility" . $this->civilite_id) != "Civility" . $this->civilite_id) {
$ret .= $langs->transnoentitiesnoconv("Civility" . $this->civilite_id) . ' ';
} else {
$ret .= $this->civilite_id . ' ';
}
}
// If order not defined, we use the setup
if ($nameorder < 0) {
$nameorder = empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION);
}
if ($nameorder) {
$ret .= $firstname;
if ($firstname && $lastname) {
$ret .= ' ';
}
$ret .= $lastname;
} else {
$ret .= $lastname;
if ($firstname && $lastname) {
$ret .= ' ';
}
$ret .= $firstname;
}
return dol_trunc($ret, $maxlen);
}
示例3: info
/**
* Return description of a module
*
* @param Translate $langs Lang object to use for output
* @return string Description
*/
function info($langs)
{
global $conf, $langs;
$langs->load("companies");
$langs->load("errors");
$form = new Form($this->db);
$texte = $this->description . ".<br>\n";
$texte .= '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
$texte .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
$texte .= '<input type="hidden" name="param1" value="SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH">';
if ($conf->global->MAIN_SUPPLIER_PROPOSAL_CHOOSE_ODT_DOCUMENT > 0) {
$texte .= '<input type="hidden" name="param2" value="SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT">';
$texte .= '<input type="hidden" name="param3" value="SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL">';
$texte .= '<input type="hidden" name="param4" value="SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED">';
}
$texte .= '<table class="nobordernopadding" width="100%">';
// List of directories area
$texte .= '<tr><td>';
$texttitle = $langs->trans("ListOfDirectories");
$listofdir = explode(',', preg_replace('/[\\r\\n]+/', ',', trim($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH)));
$listoffiles = array();
foreach ($listofdir as $key => $tmpdir) {
$tmpdir = trim($tmpdir);
$tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
if (!$tmpdir) {
unset($listofdir[$key]);
continue;
}
if (!is_dir($tmpdir)) {
$texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
} else {
$tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\\.(ods|odt)');
if (count($tmpfiles)) {
$listoffiles = array_merge($listoffiles, $tmpfiles);
}
}
}
$texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
// Add list of substitution keys
$texthelp .= '<br>' . $langs->trans("FollowingSubstitutionKeysCanBeUsed") . '<br>';
$texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation");
// This contains an url, we don't modify it
$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte .= '<textarea class="flat" cols="60" name="value1">';
$texte .= $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button" value="' . $langs->trans("Modify") . '" name="Button">';
$texte .= '<br></div></div>';
// Scan directories
if (count($listofdir)) {
$texte .= $langs->trans("NumberOfModelFilesFound") . ': <b>' . count($listoffiles) . '</b>';
if ($conf->global->MAIN_SUPPLIER_PROPOSAL_CHOOSE_ODT_DOCUMENT > 0) {
// Model for creation
$liste = ModelePDFSupplierProposal::liste_modeles($this->db);
$texte .= '<table width="50%;">';
$texte .= '<tr>';
$texte .= '<td width="60%;">' . $langs->trans("DefaultModelSupplierProposalCreate") . '</td>';
$texte .= '<td colspan="">';
$texte .= $form->selectarray('value2', $liste, $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT);
$texte .= "</td></tr>";
$texte .= '<tr>';
$texte .= '<td width="60%;">' . $langs->trans("DefaultModelSupplierProposalToBill") . '</td>';
$texte .= '<td colspan="">';
$texte .= $form->selectarray('value3', $liste, $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL);
$texte .= "</td></tr>";
$texte .= '<tr>';
$texte .= '<td width="60%;">' . $langs->trans("DefaultModelSupplierProposalClosed") . '</td>';
$texte .= '<td colspan="">';
$texte .= $form->selectarray('value4', $liste, $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED);
$texte .= "</td></tr>";
$texte .= '</table>';
}
}
$texte .= '</td>';
$texte .= '<td valign="top" rowspan="2" class="hideonsmartphone">';
$texte .= $langs->trans("ExampleOfDirectoriesForModelGen");
$texte .= '</td>';
$texte .= '</tr>';
$texte .= '</table>';
$texte .= '</form>';
return $texte;
}
示例4: exit
print "Export for bank account " . $acct->ref . " (" . $acct->label . ").\n";
}
// Creation de la classe d'export du model ExportXXX
$dir = DOL_DOCUMENT_ROOT . "/core/modules/export/";
$file = "export_" . $model . ".modules.php";
$classname = "Export" . $model;
if (!dol_is_file($dir . $file)) {
print "No driver to export with format " . $model . "\n";
exit(-1);
}
require_once $dir . $file;
$objmodel = new $classname($db);
// Define target path
$dirname = $conf->banque->dir_temp;
$filename = 'export-bank-receipts-' . $bankref . '-' . $num . '.' . $objmodel->extension;
$array_fields = array('bankreceipt' => $outputlangs->transnoentitiesnoconv("AccountStatementShort"), 'bankaccount' => $outputlangs->transnoentitiesnoconv("BankAccount"), 'dateop' => $outputlangs->transnoentitiesnoconv("DateOperationShort"), 'dateval' => $outputlangs->transnoentitiesnoconv("DateValueShort"), 'type' => $outputlangs->transnoentitiesnoconv("Type"), 'description' => $outputlangs->transnoentitiesnoconv("Description"), 'thirdparty' => $outputlangs->transnoentitiesnoconv("Tiers"), 'accountelem' => $outputlangs->transnoentitiesnoconv("Piece"), 'debit' => $outputlangs->transnoentitiesnoconv("Debit"), 'credit' => $outputlangs->transnoentitiesnoconv("Credit"), 'soldbefore' => $outputlangs->transnoentitiesnoconv("BankBalanceBefore"), 'soldafter' => $outputlangs->transnoentitiesnoconv("BankBalanceAfter"), 'comment' => $outputlangs->transnoentitiesnoconv("Comment"));
$array_selected = array('bankreceipt' => 'bankreceipt', 'bankaccount' => 'bankaccount', 'dateop' => 'dateop', 'dateval' => 'dateval', 'type' => 'type', 'description' => 'description', 'thirdparty' => 'thirdparty', 'accountelem' => 'accountelem', 'debit' => 'debit', 'credit' => 'credit', 'soldbefore' => 'soldbefore', 'soldafter' => 'soldafter', 'comment' => 'comment');
$array_export_TypeFields = array('bankreceipt' => 'Text', 'bankaccount' => 'Text', 'dateop' => 'Date', 'dateval' => 'Date', 'type' => 'Text', 'description' => 'Text', 'thirdparty' => 'Text', 'accountelem' => 'Text', 'debit' => 'Number', 'credit' => 'Number', 'soldbefore' => 'Number', 'soldafter' => 'Number', 'comment' => 'Text');
// Build request to find records for a bank account/receipt
$listofnum = "";
if (!empty($num) && $num != "all") {
$listofnum .= "'";
$arraynum = explode(',', $num);
foreach ($arraynum as $val) {
if ($listofnum != "'") {
$listofnum .= "','";
}
$listofnum .= $val;
}
$listofnum .= "'";
}
示例5: info
/**
* Return description of a module
*
* @param Translate $langs Object language
* @return string Description
*/
function info($langs)
{
global $conf, $langs;
$langs->load("companies");
$langs->load("errors");
$form = new Form($db);
$texte = $this->description . ".<br>\n";
$texte .= '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
$texte .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
$texte .= '<input type="hidden" name="param1" value="COMPANY_ADDON_PDF_ODT_PATH">';
$texte .= '<table class="nobordernopadding" width="100%">';
// List of directories area
$texte .= '<tr><td>';
$texttitle = $langs->trans("ListOfDirectories");
$listofdir = explode(',', preg_replace('/[\\r\\n]+/', ',', trim($conf->global->COMPANY_ADDON_PDF_ODT_PATH)));
$listoffiles = array();
foreach ($listofdir as $key => $tmpdir) {
$tmpdir = trim($tmpdir);
$tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
if (!$tmpdir) {
unset($listofdir[$key]);
continue;
}
if (!is_dir($tmpdir)) {
$texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
} else {
$tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\\.odt');
if (count($tmpfiles)) {
$listoffiles = array_merge($listoffiles, $tmpfiles);
}
}
}
$texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
// Add list of substitution keys
$texthelp .= '<br>' . $langs->trans("FollowingSubstitutionKeysCanBeUsed") . '<br>';
$texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation");
// This contains an url, we don't modify it
$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
$texte .= '<table><tr><td>';
$texte .= '<textarea class="flat" cols="60" name="value1">';
$texte .= $conf->global->COMPANY_ADDON_PDF_ODT_PATH;
$texte .= '</textarea>';
$texte .= '</td>';
$texte .= '<td align="center"> ';
$texte .= '<input type="submit" class="button" value="' . $langs->trans("Modify") . '" name="Button">';
$texte .= '</td>';
$texte .= '</tr>';
$texte .= '</table>';
// Scan directories
if (count($listofdir)) {
$texte .= $langs->trans("NumberOfModelFilesFound") . ': <b>' . count($listoffiles) . '</b>';
}
$texte .= '</td>';
$texte .= '<td valign="top" rowspan="2">';
$texte .= $langs->trans("ExampleOfDirectoriesForModelGen");
$texte .= '</td>';
$texte .= '</tr>';
/*$texte.= '<tr><td align="center">';
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
$texte.= '</td>';
$texte.= '</tr>';*/
$texte .= '</table>';
$texte .= '</form>';
return $texte;
}
示例6: pdf_getlinedesc
/**
* Return line description translated in outputlangs and encoded into htmlentities and with <br>
*
* @param Object $object Object
* @param int $i Current line number (0 = first line, 1 = second line, ...)
* @param Translate $outputlangs Object langs for output
* @param int $hideref Hide reference
* @param int $hidedesc Hide description
* @param int $issupplierline Is it a line for a supplier object ?
* @return string String with line
*/
function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0)
{
global $db, $conf, $langs;
$idprod = !empty($object->lines[$i]->fk_product) ? $object->lines[$i]->fk_product : false;
$label = !empty($object->lines[$i]->label) ? $object->lines[$i]->label : (!empty($object->lines[$i]->product_label) ? $object->lines[$i]->product_label : '');
$desc = !empty($object->lines[$i]->desc) ? $object->lines[$i]->desc : (!empty($object->lines[$i]->description) ? $object->lines[$i]->description : '');
$ref_supplier = !empty($object->lines[$i]->ref_supplier) ? $object->lines[$i]->ref_supplier : (!empty($object->lines[$i]->ref_fourn) ? $object->lines[$i]->ref_fourn : '');
// TODO Not yet saved for supplier invoices, only supplier orders
$note = !empty($object->lines[$i]->note) ? $object->lines[$i]->note : '';
$dbatch = !empty($object->lines[$i]->detail_batch) ? $object->lines[$i]->detail_batch : false;
if ($issupplierline) {
$prodser = new ProductFournisseur($db);
} else {
$prodser = new Product($db);
}
if ($idprod) {
$prodser->fetch($idprod);
// If a predefined product and multilang and on other lang, we renamed label with label translated
if (!empty($conf->global->MAIN_MULTILANGS) && $outputlangs->defaultlang != $langs->defaultlang) {
$translatealsoifmodified = !empty($conf->global->MAIN_MULTILANG_TRANSLATE_EVEN_IF_MODIFIED);
// By default if value was modified manually, we keep it (no translation because we don't have it)
// TODO Instead of making a compare to see if param was modified, check that content contains reference translation. If yes, add the added part to the new translation
// ($textwasmodified is replaced with $textwasmodifiedorcompleted and we add completion).
// Set label
// If we want another language, and if label is same than default language (we did force it to a specific value), we can use translation.
//var_dump($outputlangs->defaultlang.' - '.$langs->defaultlang.' - '.$label.' - '.$prodser->label);exit;
$textwasmodified = $label == $prodser->label;
if (!empty($prodser->multilangs[$outputlangs->defaultlang]["label"]) && ($textwasmodified || $translatealsoifmodified)) {
$label = $prodser->multilangs[$outputlangs->defaultlang]["label"];
}
// Set desc
// Manage HTML entities description test because $prodser->description is store with htmlentities but $desc no
$textwasmodified = false;
if (!empty($desc) && dol_textishtml($desc) && !empty($prodser->description) && dol_textishtml($prodser->description)) {
$textwasmodified = strpos(dol_html_entity_decode($desc, ENT_QUOTES | ENT_HTML401), dol_html_entity_decode($prodser->description, ENT_QUOTES | ENT_HTML401)) !== false;
} else {
$textwasmodified = $desc == $prodser->description;
}
if (!empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && ($textwasmodified || $translatealsoifmodified)) {
$desc = $prodser->multilangs[$outputlangs->defaultlang]["description"];
}
// Set note
$textwasmodified = $note == $prodser->note;
if (!empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && ($textwasmodified || $translatealsoifmodified)) {
$note = $prodser->multilangs[$outputlangs->defaultlang]["note"];
}
}
}
// Description short of product line
$libelleproduitservice = $label;
// Description long of product line
if (!empty($desc) && $desc != $label) {
if ($libelleproduitservice && empty($hidedesc)) {
$libelleproduitservice .= '__N__';
}
if ($desc == '(CREDIT_NOTE)' && $object->lines[$i]->fk_remise_except) {
$discount = new DiscountAbsolute($db);
$discount->fetch($object->lines[$i]->fk_remise_except);
$libelleproduitservice = $outputlangs->transnoentitiesnoconv("DiscountFromCreditNote", $discount->ref_facture_source);
} elseif ($desc == '(DEPOSIT)' && $object->lines[$i]->fk_remise_except) {
$discount = new DiscountAbsolute($db);
$discount->fetch($object->lines[$i]->fk_remise_except);
$libelleproduitservice = $outputlangs->transnoentitiesnoconv("DiscountFromDeposit", $discount->ref_facture_source);
// Add date of deposit
if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) {
echo ' (' . dol_print_date($discount->datec, 'day', '', $outputlangs) . ')';
}
} else {
if ($idprod) {
if (empty($hidedesc)) {
$libelleproduitservice .= $desc;
}
} else {
$libelleproduitservice .= $desc;
}
}
}
// If line linked to a product
if ($idprod) {
// We add ref
if ($prodser->ref) {
$prefix_prodserv = "";
$ref_prodserv = "";
if (!empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) {
if ($prodser->isService()) {
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service") . " ";
} else {
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Product") . " ";
}
//.........这里部分代码省略.........
示例7: doc_getlinedesc
/**
* Return line description translated in outputlangs and encoded into UTF8
*
* @param Line $line Current line number (0 = first line, 1 = second line, ...)
* @param Translate $outputlangs Object langs for output
* @param int $hideref Hide reference
* @param int $hidedesc Hide description
* @param int $issupplierline Is it a line for a supplier object ?
* @return string String with line
*/
function doc_getlinedesc($line, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0)
{
global $db, $conf, $langs;
$idprod = $line->fk_product;
$label = $line->label;
if (empty($label)) {
$label = $line->libelle;
}
$desc = $line->desc;
if (empty($desc)) {
$desc = $line->description;
}
$ref_supplier = $line->ref_supplier;
if (empty($ref_supplier)) {
$ref_supplier = $line->ref_fourn;
}
// TODO Not yet saved for supplier invoices, only supplier orders
$note = $line->note;
if ($issupplierline) {
$prodser = new ProductFournisseur($db);
} else {
$prodser = new Product($db);
}
if ($idprod) {
$prodser->fetch($idprod);
// If a predefined product and multilang and on other lang, we renamed label with label translated
if ($conf->global->MAIN_MULTILANGS && $outputlangs->defaultlang != $langs->defaultlang) {
if (!empty($prodser->multilangs[$outputlangs->defaultlang]["libelle"]) && $label == $prodser->label) {
$label = $prodser->multilangs[$outputlangs->defaultlang]["libelle"];
}
if (!empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && $desc == $prodser->description) {
$desc = $prodser->multilangs[$outputlangs->defaultlang]["description"];
}
if (!empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && $note == $prodser->note) {
$note = $prodser->multilangs[$outputlangs->defaultlang]["note"];
}
}
}
// Description short of product line
$libelleproduitservice = $label;
// Description long of product line
if ($desc && $desc != $label) {
if ($libelleproduitservice && empty($hidedesc)) {
$libelleproduitservice .= "\n";
}
if ($desc == '(CREDIT_NOTE)' && $line->fk_remise_except) {
$discount = new DiscountAbsolute($db);
$discount->fetch($line->fk_remise_except);
$libelleproduitservice = $outputlangs->transnoentitiesnoconv("DiscountFromCreditNote", $discount->ref_facture_source);
} elseif ($desc == '(DEPOSIT)' && $line->fk_remise_except) {
$discount = new DiscountAbsolute($db);
$discount->fetch($line->fk_remise_except);
$libelleproduitservice = $outputlangs->transnoentitiesnoconv("DiscountFromDeposit", $discount->ref_facture_source);
// Add date of deposit
if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) {
echo ' (' . dol_print_date($discount->datec, 'day', '', $outputlangs) . ')';
}
} else {
if ($idprod) {
if (empty($hidedesc)) {
$libelleproduitservice .= $desc;
}
} else {
$libelleproduitservice .= $desc;
}
}
}
// If line linked to a product
if ($idprod) {
// On ajoute la ref
if ($prodser->ref) {
$prefix_prodserv = "";
$ref_prodserv = "";
if ($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS) {
if ($prodser->isservice()) {
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service") . " ";
} else {
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Product") . " ";
}
}
if (empty($hideref)) {
if ($issupplierline) {
$ref_prodserv = $prodser->ref . ' (' . $outputlangs->trans("SupplierRef") . ' ' . $ref_supplier . ')';
} else {
$ref_prodserv = $prodser->ref;
}
// Show local ref only
$ref_prodserv .= " - ";
}
$libelleproduitservice = $prefix_prodserv . $ref_prodserv . $libelleproduitservice;
//.........这里部分代码省略.........
示例8: Notify
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
function run_trigger($action, $object, $user, $langs, $conf)
{
if (empty($conf->notification->enabled)) {
return 0;
}
// Module not active, we do nothing
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
if ($action == 'BILL_VALIDATE') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$ref = dol_sanitizeFileName($object->ref);
$filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
if (!file_exists($filepdf)) {
$filepdf = '';
}
$filepdf = '';
// We can't add PDF as it is not generated yet.
$langs->load("other");
$mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated", $object->ref);
$notify = new Notify($this->db);
$notify->send($action, $object->socid, $mesg, 'facture', $object->id, $filepdf);
} elseif ($action == 'ORDER_VALIDATE') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$ref = dol_sanitizeFileName($object->ref);
$filepdf = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf';
if (!file_exists($filepdf)) {
$filepdf = '';
}
$filepdf = '';
// We can't add PDF as it is not generated yet.
$langs->load("other");
$mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated", $object->ref);
$notify = new Notify($this->db);
$notify->send($action, $object->socid, $mesg, 'order', $object->id, $filepdf);
} elseif ($action == 'PROPAL_VALIDATE') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$ref = dol_sanitizeFileName($object->ref);
$filepdf = $conf->propal->dir_output . '/' . $ref . '/' . $ref . '.pdf';
if (!file_exists($filepdf)) {
$filepdf = '';
}
$filepdf = '';
// We can't add PDF as it is not generated yet.
$langs->load("other");
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated", $object->ref);
$notify = new Notify($this->db);
$notify->send($action, $object->socid, $mesg, 'propal', $object->id, $filepdf);
} elseif ($action == 'FICHEINTER_VALIDATE') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$ref = dol_sanitizeFileName($object->ref);
$filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
if (!file_exists($filepdf)) {
$filepdf = '';
}
$filepdf = '';
// We can't add PDF as it is not generated yet.
$langs->load("other");
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated", $object->ref);
$notify = new Notify($this->db);
$notify->send($action, $object->socid, $mesg, 'ficheinter', $object->id, $filepdf);
} elseif ($action == 'ORDER_SUPPLIER_APPROVE') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$ref = dol_sanitizeFileName($object->ref);
$filepdf = $conf->fournisseur->dir_output . '/commande/' . $ref . '/' . $ref . '.pdf';
if (!file_exists($filepdf)) {
$filepdf = '';
}
$mesg = $langs->transnoentitiesnoconv("Hello") . ",\n\n";
$mesg .= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy", $object->ref, $user->getFullName($langs));
$mesg .= "\n\n" . $langs->transnoentitiesnoconv("Sincerely") . ".\n\n";
$notify = new Notify($this->db);
$notify->send($action, $object->socid, $mesg, 'order_supplier', $object->id, $filepdf);
} elseif ($action == 'ORDER_SUPPLIER_REFUSE') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$ref = dol_sanitizeFileName($object->ref);
$filepdf = $conf->fournisseur->dir_output . '/commande/' . $ref . '/' . $ref . '.pdf';
if (!file_exists($filepdf)) {
$filepdf = '';
}
$mesg = $langs->transnoentitiesnoconv("Hello") . ",\n\n";
$mesg .= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy", $object->ref, $user->getFullName($langs));
$mesg .= "\n\n" . $langs->transnoentitiesnoconv("Sincerely") . ".\n\n";
$notify = new Notify($this->db);
$notify->send($action, $object->socid, $mesg, 'order_supplier', $object->id, $filepdf);
}
// If not found
/*
else
{
dol_syslog("Trigger '".$this->name."' for action '$action' was ran by ".__FILE__." but no handler found for this action.");
//.........这里部分代码省略.........
示例9: send
/**
* Check if notification are active for couple action/company.
* If yes, send mail and save trace into llx_notify.
*
* @param string $notifcode Code of action in llx_c_action_trigger (new usage) or Id of action in llx_c_action_trigger (old usage)
* @param Object $object Object the notification deals on
* @return int <0 if KO, or number of changes if OK
*/
function send($notifcode, $object)
{
global $user, $conf, $langs, $mysoc, $dolibarr_main_url_root;
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
dol_syslog(get_class($this) . "::send notifcode=" . $notifcode . ", object=" . $object->id);
$langs->load("other");
// Define $urlwithroot
$urlwithouturlroot = preg_replace('/' . preg_quote(DOL_URL_ROOT, '/') . '$/i', '', trim($dolibarr_main_url_root));
$urlwithroot = $urlwithouturlroot . DOL_URL_ROOT;
// This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
// Define some vars
$application = $mysoc->name;
//if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $application = $conf->global->MAIN_APPLICATION_TITLE;
$replyto = $conf->notification->email_from;
$filename = basename($file);
$mimefile = dol_mimetype($file);
$object_type = '';
$link = '';
$num = 0;
if (!in_array($notifcode, array('BILL_VALIDATE', 'ORDER_VALIDATE', 'PROPAL_VALIDATE', 'FICHINTER_VALIDATE', 'ORDER_SUPPLIER_VALIDATE', 'ORDER_SUPPLIER_APPROVE', 'ORDER_SUPPLIER_REFUSE', 'SHIPPING_VALIDATE'))) {
return 0;
}
$oldref = empty($object->oldref) ? $object->ref : $object->oldref;
$newref = empty($object->newref) ? $object->ref : $object->newref;
// Check notification per third party
$sql = "SELECT s.nom, c.email, c.rowid as cid, c.lastname, c.firstname, c.default_lang,";
$sql .= " a.rowid as adid, a.label, a.code, n.rowid, n.type";
$sql .= " FROM " . MAIN_DB_PREFIX . "socpeople as c,";
$sql .= " " . MAIN_DB_PREFIX . "c_action_trigger as a,";
$sql .= " " . MAIN_DB_PREFIX . "notify_def as n,";
$sql .= " " . MAIN_DB_PREFIX . "societe as s";
$sql .= " WHERE n.fk_contact = c.rowid AND a.rowid = n.fk_action";
$sql .= " AND n.fk_soc = s.rowid";
if (is_numeric($notifcode)) {
$sql .= " AND n.fk_action = " . $notifcode;
} else {
$sql .= " AND a.code = '" . $notifcode . "'";
}
// New usage
$sql .= " AND s.rowid = " . $object->socid;
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
if ($num > 0) {
$i = 0;
while ($i < $num && !$error) {
$obj = $this->db->fetch_object($result);
$sendto = dolGetFirstLastname($obj->firstname, $obj->lastname) . " <" . $obj->email . ">";
$notifcodedefid = $obj->adid;
if (dol_strlen($obj->email)) {
// Set output language
$outputlangs = $langs;
if ($obj->default_lang && $obj->default_lang != $langs->defaultlang) {
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang($obj->default_lang);
}
switch ($notifcode) {
case 'BILL_VALIDATE':
$link = '/compta/facture.php?facid=' . $object->id;
$dir_output = $conf->facture->dir_output;
$object_type = 'facture';
$mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated", $newref);
break;
case 'ORDER_VALIDATE':
$link = '/commande/card.php?id=' . $object->id;
$dir_output = $conf->commande->dir_output;
$object_type = 'order';
$mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated", $newref);
break;
case 'PROPAL_VALIDATE':
$link = '/comm/propal.php?id=' . $object->id;
$dir_output = $conf->propal->dir_output;
$object_type = 'propal';
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated", $newref);
break;
case 'FICHINTER_VALIDATE':
$link = '/fichinter/card.php?id=' . $object->id;
$dir_output = $conf->facture->dir_output;
$object_type = 'ficheinter';
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated", $object->ref);
break;
case 'ORDER_SUPPLIER_VALIDATE':
$link = '/fourn/commande/card.php?id=' . $object->id;
$dir_output = $conf->fournisseur->dir_output . '/commande/';
$object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("Hello") . ",\n\n";
$mesg .= $langs->transnoentitiesnoconv("EMailTextOrderValidatedBy", $object->ref, $user->getFullName($langs));
$mesg .= "\n\n" . $langs->transnoentitiesnoconv("Sincerely") . ".\n\n";
break;
case 'ORDER_SUPPLIER_APPROVE':
$link = '/fourn/commande/card.php?id=' . $object->id;
//.........这里部分代码省略.........
示例10: getState
/**
* Define array with couple subtitution key => subtitution value
*
* @param Contact $object contact
* @param Translate $outputlangs object for output
* @param array_key $array_key Name of the key for return array
* @return array of substitution key->code
*/
function get_substitutionarray_contact($object, $outputlangs, $array_key = 'object')
{
global $conf;
if (empty($object->country) && !empty($object->country_code)) {
$object->country = $outputlangs->transnoentitiesnoconv("Country" . $object->country_code);
}
if (empty($object->state) && !empty($object->state_code)) {
$object->state = getState($object->state_code, 0);
}
$array_contact = array($array_key . '_fullname' => $object->getFullName($outputlangs, 1), $array_key . '_lastname' => $object->lastname, $array_key . '_firstname' => $object->firstname, $array_key . '_address' => $object->address, $array_key . '_zip' => $object->zip, $array_key . '_town' => $object->town, $array_key . '_state_id' => $object->state_id, $array_key . '_state_code' => $object->state_code, $array_key . '_state' => $object->state, $array_key . '_country_id' => $object->country_id, $array_key . '_country_code' => $object->country_code, $array_key . '_country' => $object->country, $array_key . '_poste' => $object->poste, $array_key . '_socid' => $object->socid, $array_key . '_statut' => $object->statut, $array_key . '_code' => $object->code, $array_key . '_email' => $object->email, $array_key . '_jabberid' => $object->jabberid, $array_key . '_phone_pro' => $object->phone_pro, $array_key . '_phone_perso' => $object->phone_perso, $array_key . '_phone_mobile' => $object->phone_mobile, $array_key . '_fax' => $object->fax, $array_key . '_birthday' => $object->birthday, $array_key . '_default_lang' => $object->default_lang, $array_key . '_note_public' => $object->note_public, $array_key . '_note_private' => $object->note_private);
// Retrieve extrafields
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label('socpeople', true);
$object->fetch_optionals($object->id, $extralabels);
foreach ($extrafields->attribute_label as $key => $label) {
if ($extrafields->attribute_type[$key] == 'price') {
$object->array_options['options_' . $key] = price($object->array_options['options_' . $key], 0, $outputlangs, 0, 0, -1, $conf->currency);
} elseif ($extrafields->attribute_type[$key] == 'select') {
$object->array_options['options_' . $key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_' . $key]];
}
$array_contact = array_merge($array_contact, array($array_key . '_options_' . $key => $object->array_options['options_' . $key]));
}
return $array_contact;
}
示例11: getFullName
/**
* Return full name (civility+' '+name+' '+lastname)
*
* @param Translate $langs Language object for translation of civility
* @param int $option 0=No option, 1=Add civility
* @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname, 2=Firstname
* @param int $maxlen Maximum length
* @return string String with full name
*/
function getFullName($langs, $option = 0, $nameorder = -1, $maxlen = 0)
{
//print "lastname=".$this->lastname." name=".$this->name." nom=".$this->nom."<br>\n";
$lastname = $this->lastname;
$firstname = $this->firstname;
if (empty($lastname)) {
$lastname = isset($this->lastname) ? $this->lastname : (isset($this->name) ? $this->name : (isset($this->nom) ? $this->nom : ''));
}
$ret = '';
if ($option && $this->civility_id) {
if ($langs->transnoentitiesnoconv("Civility" . $this->civility_id) != "Civility" . $this->civility_id) {
$ret .= $langs->transnoentitiesnoconv("Civility" . $this->civility_id) . ' ';
} else {
$ret .= $this->civility_id . ' ';
}
}
$ret .= dolGetFirstLastname($firstname, $lastname, $nameorder);
return dol_trunc($ret, $maxlen);
}
示例12: while
//print $langsen->trans("Country"."FI");exit;
// Define $data array
dol_syslog("Count member sql=".$sql);
$resql=$db->query($sql);
if ($resql)
{
$num=$db->num_rows($resql);
$i=0;
while ($i < $num)
{
$obj=$db->fetch_object($resql);
if ($mode == 'memberbycountry')
{
$data[]=array('label'=>(($obj->code && $langs->trans("Country".$obj->code)!="Country".$obj->code)?$langs->trans("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
'code'=>$obj->code,
'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate)
);
}
if ($mode == 'memberbystate')
{
$data[]=array('label'=>(($obj->code && $langs->trans("Country".$obj->code)!="Country".$obj->code)?$langs->trans("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")),
'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate)
);
}
if ($mode == 'memberbytown')
示例13: Translate
//print $sql;
}
$langsen = new Translate('', $conf);
$langsen->setDefaultLang('en_US');
$langsen->load("dict");
//print $langsen->trans("Country"."FI");exit;
// Define $data array
dol_syslog("Count member", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$obj = $db->fetch_object($resql);
if ($mode == 'memberbycountry') {
$data[] = array('label' => $obj->code && $langs->trans("Country" . $obj->code) != "Country" . $obj->code ? $langs->trans("Country" . $obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown")), 'label_en' => $obj->code && $langsen->transnoentitiesnoconv("Country" . $obj->code) != "Country" . $obj->code ? $langsen->transnoentitiesnoconv("Country" . $obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown")), 'code' => $obj->code, 'nb' => $obj->nb, 'lastdate' => $db->jdate($obj->lastdate));
}
if ($mode == 'memberbyregion') {
$data[] = array('label' => $obj->code && $langs->trans("Country" . $obj->code) != "Country" . $obj->code ? $langs->trans("Country" . $obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown")), 'label_en' => $obj->code && $langsen->transnoentitiesnoconv("Country" . $obj->code) != "Country" . $obj->code ? $langsen->transnoentitiesnoconv("Country" . $obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown")), 'label2' => $obj->label2 ? $obj->label2 : $langs->trans("Unknown"), 'nb' => $obj->nb, 'lastdate' => $db->jdate($obj->lastdate));
}
if ($mode == 'memberbystate') {
$data[] = array('label' => $obj->code && $langs->trans("Country" . $obj->code) != "Country" . $obj->code ? $langs->trans("Country" . $obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown")), 'label_en' => $obj->code && $langsen->transnoentitiesnoconv("Country" . $obj->code) != "Country" . $obj->code ? $langsen->transnoentitiesnoconv("Country" . $obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown")), 'label2' => $obj->label2 ? $obj->label2 : $langs->trans("Unknown"), 'nb' => $obj->nb, 'lastdate' => $db->jdate($obj->lastdate));
}
if ($mode == 'memberbytown') {
$data[] = array('label' => $obj->code && $langs->trans("Country" . $obj->code) != "Country" . $obj->code ? $langs->trans("Country" . $obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown")), 'label_en' => $obj->code && $langsen->transnoentitiesnoconv("Country" . $obj->code) != "Country" . $obj->code ? $langsen->transnoentitiesnoconv("Country" . $obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown")), 'label2' => $obj->label2 ? $obj->label2 : $langs->trans("Unknown"), 'nb' => $obj->nb, 'lastdate' => $db->jdate($obj->lastdate));
}
$i++;
}
$db->free($resql);
} else {
dol_print_error($db);