diff --git a/htdocs/core/datepicker.php b/htdocs/core/datepicker.php index 074760e88ca..a53f26f52a1 100644 --- a/htdocs/core/datepicker.php +++ b/htdocs/core/datepicker.php @@ -41,8 +41,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php -$langs->load("main"); -$langs->load("agenda"); +// Load translation files required by the page +$langs->loadLangs(array("agenda","main")); $right=($langs->trans("DIRECTION")=='rtl'?'left':'right'); $left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 5318220beb8..041157f20a2 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -35,10 +35,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php'; */ class doc_generic_user_odt extends ModelePDFUser { - var $emetteur; // Objet societe qui emet + public $emetteur; // Objet societe qui emet - var $phpmin = array(5,2,0); // Minimum version of PHP required by module - var $version = 'dolibarr'; + public $phpmin = array(5,4,0); // Minimum version of PHP required by module + public $version = 'dolibarr'; /** @@ -50,8 +50,8 @@ class doc_generic_user_odt extends ModelePDFUser { global $conf,$langs,$mysoc; - $langs->load("main"); - $langs->load("companies"); + // Load translation files required by the page + $langs->loadLangs(array("main","companies")); $this->db = $db; $this->name = "ODT templates"; diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index 887a4cda084..fbd2d1bb79d 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -97,8 +97,8 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup { global $conf,$langs; - $langs->load("companies"); - $langs->load("errors"); + // Load translation files required by the page + $langs->loadLangs(array("errors","companies")); $form = new Form($this->db); diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index 3f266e700cc..f4f178031de 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -28,8 +28,8 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; -$langs->load("products"); -$langs->load("other"); +// Load translation files required by the page +$langs->loadLangs(array("products","other")); $id=GETPOST('id','int'); $action=GETPOST('action','alpha'); diff --git a/htdocs/core/tools.php b/htdocs/core/tools.php index 25e2eb3f903..3ceaaf17d33 100644 --- a/htdocs/core/tools.php +++ b/htdocs/core/tools.php @@ -24,8 +24,8 @@ require '../main.inc.php'; -$langs->load("companies"); -$langs->load("other"); +// Load translation files required by the page +$langs->loadLangs(array("companies","other")); // Security check $socid=0; diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 6994aa6f3e6..343b9a1376e 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -82,9 +82,8 @@ class InterfaceActionsAuto extends DolibarrTriggers // Actions if ($action == 'COMPANY_CREATE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("companies"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","companies")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("NewCompanyToDolibarr",$object->name); $object->actionmsg=$langs->transnoentities("NewCompanyToDolibarr",$object->name); @@ -95,9 +94,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'COMPANY_SENTBYMAIL') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("orders"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","orders")); if (empty($object->actionmsg2)) dol_syslog('Trigger called with property actionmsg2 on object not defined', LOG_ERR); @@ -106,9 +104,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'CONTRACT_VALIDATE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("contracts"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","contracts")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ContractValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); $object->actionmsg=$langs->transnoentities("ContractValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); @@ -117,9 +114,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'CONTRACT_SENTBYMAIL') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("contract"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","contracts")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ContractSentByEMail",$object->ref); if (empty($object->actionmsg)) @@ -132,9 +128,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'PROPAL_VALIDATE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("propal"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","propal")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); $object->actionmsg=$langs->transnoentities("PropalValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); @@ -143,9 +138,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'PROPAL_SENTBYMAIL') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("propal"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","propal")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProposalSentByEMail",$object->ref); if (empty($object->actionmsg)) @@ -158,9 +152,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'PROPAL_CLOSE_SIGNED') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("propal"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","propal")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref); @@ -169,9 +162,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'PROPAL_CLASSIFY_BILLED') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("propal"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","propal")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClassifiedBilledInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("PropalClassifiedBilledInDolibarr",$object->ref); @@ -180,9 +172,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'PROPAL_CLOSE_REFUSED') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("propal"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","propal")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); @@ -191,8 +182,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'ORDER_VALIDATE') { - $langs->load("agenda"); - $langs->load("orders"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","orders")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); $object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); @@ -201,9 +192,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'ORDER_CLOSE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("orders"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","orders")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderDeliveredInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("OrderDeliveredInDolibarr",$object->ref); @@ -212,9 +202,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'ORDER_CLASSIFY_BILLED') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("orders"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","orders")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderBilledInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("OrderBilledInDolibarr",$object->ref); @@ -223,9 +212,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'ORDER_CANCEL') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("orders"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","orders")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderCanceledInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("OrderCanceledInDolibarr",$object->ref); @@ -234,9 +222,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'ORDER_SENTBYMAIL') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("orders"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","orders")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderSentByEMail",$object->ref); if (empty($object->actionmsg)) @@ -249,9 +236,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'BILL_VALIDATE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("bills"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","bills")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); $object->actionmsg=$langs->transnoentities("InvoiceValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); @@ -260,9 +246,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'BILL_UNVALIDATE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("bills"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","bills")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref); @@ -271,9 +256,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'BILL_SENTBYMAIL') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("bills"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","bills")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceSentByEMail",$object->ref); if (empty($object->actionmsg)) @@ -286,9 +270,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'BILL_PAYED') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("bills"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","bills")); // Values for this action can't be defined by caller. $object->actionmsg2=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref); @@ -298,9 +281,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'BILL_CANCEL') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("bills"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","bills")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); @@ -309,9 +291,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'FICHINTER_CREATE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("interventions"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","interventions")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionCreatedInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("InterventionCreatedInDolibarr",$object->ref); @@ -322,9 +303,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'FICHINTER_VALIDATE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("interventions"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","interventions")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); $object->actionmsg=$langs->transnoentities("InterventionValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); @@ -335,9 +315,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'FICHINTER_MODIFY') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("interventions"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","interventions")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionModifiedInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("InterventionModifiedInDolibarr",$object->ref); @@ -348,9 +327,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'FICHINTER_SENTBYMAIL') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("interventions"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","interventions")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionSentByEMail",$object->ref); if (empty($object->actionmsg)) @@ -363,9 +341,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'FICHINTER_CLASSIFY_BILLED') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("interventions"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","interventions")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionClassifiedBilledInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("InterventionClassifiedBilledInDolibarr",$object->ref); @@ -374,9 +351,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'FICHINTER_CLASSIFY_UNBILLED') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("interventions"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","interventions")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionClassifiedUnbilledInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("InterventionClassifiedUnbilledInDolibarr",$object->ref); @@ -385,9 +361,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'FICHINTER_DELETE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("interventions"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","interventions")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionDeletedInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("InterventionDeletedInDolibarr",$object->ref); @@ -398,9 +373,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'SHIPPING_VALIDATE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("sendings"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","sendings")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ShippingValidated",($object->newref?$object->newref:$object->ref)); if (empty($object->actionmsg)) @@ -413,9 +387,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'SHIPPING_SENTBYMAIL') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("sendings"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","sendings")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ShippingSentByEMail",$object->ref); if (empty($object->actionmsg)) @@ -428,9 +401,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'PROPOSAL_SUPPLIER_VALIDATE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("propal"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","propal")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); $object->actionmsg=$langs->transnoentities("PropalValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); @@ -439,9 +411,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'PROPOSAL_SUPPLIER_SENTBYMAIL') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("propal"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","propal")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProposalSentByEMail",$object->ref); if (empty($object->actionmsg)) @@ -454,9 +425,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_SIGNED') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("propal"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","propal")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref); @@ -465,9 +435,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_REFUSED') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("propal"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","propal")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); @@ -476,9 +445,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'ORDER_SUPPLIER_CREATE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("orders"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","orders")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderCreatedInDolibarr",($object->newref?$object->newref:$object->ref)); $object->actionmsg=$langs->transnoentities("OrderCreatedInDolibarr",($object->newref?$object->newref:$object->ref)); @@ -487,9 +455,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("orders"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","orders")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); $object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); @@ -498,9 +465,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'ORDER_SUPPLIER_APPROVE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("orders"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","orders")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderApprovedInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("OrderApprovedInDolibarr",$object->ref); @@ -509,9 +475,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'ORDER_SUPPLIER_REFUSE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("orders"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","orders")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderRefusedInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("OrderRefusedInDolibarr",$object->ref); @@ -520,9 +485,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'ORDER_SUPPLIER_SUBMIT') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("orders"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","orders")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderSubmitedInDolibarr",($object->newref?$object->newref:$object->ref)); $object->actionmsg=$langs->transnoentities("SupplierOrderSubmitedInDolibarr",($object->newref?$object->newref:$object->ref)); @@ -531,9 +495,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'ORDER_SUPPLIER_RECEIVE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("orders"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","orders")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderReceivedInDolibarr",($object->newref?$object->newref:$object->ref)); $object->actionmsg=$langs->transnoentities("SupplierOrderReceivedInDolibarr",($object->newref?$object->newref:$object->ref)); @@ -542,10 +505,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("bills"); - $langs->load("orders"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","orders","bills")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderSentByEMail",$object->ref); if (empty($object->actionmsg)) @@ -558,10 +519,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'ORDER_SUPPLIER_CLASSIFY_BILLED') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("bills"); - $langs->load("orders"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","orders","bills")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderClassifiedBilled",$object->ref); if (empty($object->actionmsg)) @@ -573,9 +532,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'BILL_SUPPLIER_VALIDATE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("bills"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","bills")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); $object->actionmsg=$langs->transnoentities("InvoiceValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); @@ -584,9 +542,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'BILL_SUPPLIER_UNVALIDATE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("bills"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","bills")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref); @@ -595,10 +552,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("bills"); - $langs->load("orders"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","orders","bills")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierInvoiceSentByEMail",$object->ref); if (empty($object->actionmsg)) @@ -611,9 +566,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'BILL_SUPPLIER_PAYED') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("bills"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","bills")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref); @@ -622,9 +576,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'BILL_SUPPLIER_CANCELED') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("bills"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","bills")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); @@ -635,9 +588,8 @@ class InterfaceActionsAuto extends DolibarrTriggers // Members elseif ($action == 'MEMBER_VALIDATE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("members"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","members")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberValidatedInDolibarr",$object->getFullName($langs)); $object->actionmsg=$langs->transnoentities("MemberValidatedInDolibarr",$object->getFullName($langs)); @@ -648,9 +600,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'MEMBER_MODIFY') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("members"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","members")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberModifiedInDolibarr",$object->getFullName($langs)); $object->actionmsg=$langs->transnoentities("MemberModifiedInDolibarr",$object->getFullName($langs)); @@ -661,9 +612,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'MEMBER_SUBSCRIPTION_CREATE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("members"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","members")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionAddedInDolibarr",$object->ref,$object->getFullName($langs)); $object->actionmsg=$langs->transnoentities("MemberSubscriptionAddedInDolibarr",$object->ref,$object->getFullName($langs)); @@ -677,9 +627,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'MEMBER_SUBSCRIPTION_MODIFY') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("members"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","members")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionModifiedInDolibarr",$object->ref,$object->getFullName($langs)); $object->actionmsg=$langs->transnoentities("MemberSubscriptionModifiedInDolibarr",$object->ref,$object->getFullName($langs)); @@ -693,9 +642,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'MEMBER_SUBSCRIPTION_DELETE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("members"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","members")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionDeletedInDolibarr",$object->ref,$object->getFullName($langs)); $object->actionmsg=$langs->transnoentities("MemberSubscriptionDeletedInDolibarr",$object->ref,$object->getFullName($langs)); @@ -709,9 +657,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'MEMBER_RESILIATE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("members"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","members")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberResiliatedInDolibarr",$object->getFullName($langs)); $object->actionmsg=$langs->transnoentities("MemberResiliatedInDolibarr",$object->getFullName($langs)); @@ -722,9 +669,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'MEMBER_DELETE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("members"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","members")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberDeletedInDolibarr",$object->getFullName($langs)); $object->actionmsg=$langs->transnoentities("MemberDeletedInDolibarr",$object->getFullName($langs)); @@ -737,9 +683,8 @@ class InterfaceActionsAuto extends DolibarrTriggers // Projects elseif ($action == 'PROJECT_CREATE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("projects"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","projects")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectCreatedInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("ProjectCreatedInDolibarr",$object->ref); @@ -747,10 +692,10 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid=0; } - elseif($action == 'PROJECT_VALIDATE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("projects"); + elseif($action == 'PROJECT_VALIDATE') + { + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","projects")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectValidatedInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("ProjectValidatedInDolibarr",$object->ref); @@ -758,10 +703,10 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid=0; } - elseif($action == 'PROJECT_MODIFY') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("projects"); + elseif($action == 'PROJECT_MODIFY') + { + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","projects")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectModifiedInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("ProjectModifiedInDolibarr",$object->ref); @@ -771,10 +716,10 @@ class InterfaceActionsAuto extends DolibarrTriggers } // Project tasks - elseif($action == 'TASK_CREATE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("projects"); + elseif($action == 'TASK_CREATE') + { + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","projects")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskCreatedInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("TaskCreatedInDolibarr",$object->ref); @@ -783,10 +728,10 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid=0; } - elseif($action == 'TASK_MODIFY') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("projects"); + elseif($action == 'TASK_MODIFY') + { + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","projects")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskModifiedInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("TaskModifieddInDolibarr",$object->ref); @@ -795,10 +740,10 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid=0; } - elseif($action == 'TASK_DELETE') { - $langs->load("agenda"); - $langs->load("other"); - $langs->load("projects"); + elseif($action == 'TASK_DELETE') + { + // Load translation files required by the page + $langs->loadLangs(array("agenda","other","projects")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskDeletedInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("TaskDeletedInDolibarr",$object->ref); @@ -807,10 +752,11 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid=0; } // TODO Merge all previous cases into this generic one - else { + else + { // Note: We are here only if $conf->global->MAIN_AGENDA_ACTIONAUTO_action is on (tested at begining of this function) - $langs->load("agenda"); - $langs->load("other"); + // Load translation files required by the page + $langs->loadLangs(array("agenda","other")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities($action."InDolibarr",$object->ref); if (empty($object->actionmsg)) $object->actionmsg=$langs->transnoentities($action."InDolibarr",$object->ref); diff --git a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php index 00a58667f43..c1cf1bfd936 100644 --- a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php +++ b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php @@ -114,13 +114,12 @@ class InterfaceStripe */ public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) { - // Put here code you want to execute when a Dolibarr business events occurs. + // Put here code you want to execute when a Dolibarr business event occurs. // Data and type of action are stored into $object and $action global $langs, $db, $conf; - $langs->load("members"); - $langs->load("users"); - $langs->load("mails"); - $langs->load('other'); + + // Load translation files required by the page + $langs->loadLangs(array("members","other","users","mails")); require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; $stripe = new Stripe($db); diff --git a/htdocs/don/document.php b/htdocs/don/document.php index 7459bf82453..b8396ab72bb 100644 --- a/htdocs/don/document.php +++ b/htdocs/don/document.php @@ -40,9 +40,8 @@ if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } -$langs->load("other"); -$langs->load("donations"); -$langs->load("companies"); +// Load translation files required by the page +$langs->loadLangs(array("other","donations","companies")); $id = GETPOST('id','int'); $ref = GETPOST('ref', 'alpha'); diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 1e7d93302d8..3fffe242e20 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -28,8 +28,8 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; -$langs->load("companies"); -$langs->load("donations"); +// Load translation files required by the page +$langs->loadLangs(array("donations","companies")); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); diff --git a/htdocs/don/note.php b/htdocs/don/note.php index d78aa2c7ea5..7c3636eef4a 100644 --- a/htdocs/don/note.php +++ b/htdocs/don/note.php @@ -35,9 +35,8 @@ if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } -$langs->load("companies"); -$langs->load("bills"); -$langs->load("donations"); +// Load translation files required by the page +$langs->loadLangs(array("bills","donations","companies")); $id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility $ref=GETPOST('ref','alpha'); diff --git a/htdocs/don/payment/card.php b/htdocs/don/payment/card.php index e4a7ef5c5d4..dde03cb461d 100644 --- a/htdocs/don/payment/card.php +++ b/htdocs/don/payment/card.php @@ -28,9 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php'; if (! empty($conf->banque->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; -$langs->load('bills'); -$langs->load('banks'); -$langs->load('companies'); +// Load translation files required by the page +$langs->loadLangs(array("bills","banks","companies")); // Security check $id=GETPOST('rowid')?GETPOST('rowid','int'):GETPOST('id','int'); diff --git a/htdocs/don/stats/index.php b/htdocs/don/stats/index.php index cb574da939a..4398dfd8b8e 100644 --- a/htdocs/don/stats/index.php +++ b/htdocs/don/stats/index.php @@ -47,9 +47,8 @@ $year = GETPOST('year')>0?GETPOST('year'):$nowyear; $startyear=$year-1; $endyear=$year; -$langs->load("sendings"); -$langs->load("other"); -$langs->load("companies"); +// Load translation files required by the page +$langs->loadLangs(array("sendings","other","companies")); /*