From da6c6c9e0a7321f2ec8441910f24918e62d6eb32 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 8 Nov 2020 14:39:20 +0100 Subject: [PATCH] Clean code --- htdocs/accountancy/customer/list.php | 6 - htdocs/accountancy/expensereport/list.php | 6 - htdocs/accountancy/supplier/list.php | 6 - htdocs/admin/emailcollector_card.php | 55 -------- htdocs/admin/mails_senderprofile_list.php | 2 +- htdocs/asset/list.php | 2 +- htdocs/bom/bom_list.php | 2 +- htdocs/compta/bank/list.php | 2 +- .../compta/cashcontrol/cashcontrol_list.php | 2 +- htdocs/compta/facture/class/facture.class.php | 6 +- htdocs/contact/card.php | 2 +- htdocs/core/lib/functions.lib.php | 12 +- htdocs/core/tpl/card_presend.tpl.php | 2 +- ...terface_50_modAgenda_ActionsAuto.class.php | 25 +++- .../class/emailcollector.class.php | 21 +++- htdocs/fourn/commande/card.php | 4 +- htdocs/fourn/facture/card.php | 4 +- htdocs/mrp/mo_list.php | 2 +- htdocs/product/inventory/inventory.php | 2 +- htdocs/product/inventory/list.php | 2 +- htdocs/projet/list.php | 2 +- htdocs/public/recruitment/view.php | 2 +- htdocs/reception/card.php | 117 ++---------------- .../recruitmentjobposition_list.php | 2 +- htdocs/supplier_proposal/card.php | 4 +- htdocs/ticket/list.php | 2 +- htdocs/zapier/hook_card.php | 19 --- htdocs/zapier/hook_list.php | 2 +- 28 files changed, 83 insertions(+), 232 deletions(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index a06d2f25d8c..eb2743258d7 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -357,12 +357,6 @@ if ($result) { print ''.$langs->trans("DescVentilTodoCustomer").'

'; - /*$topicmail="Information"; - $modelmail="project"; - $objecttmp=new Project($db); - $trackid='prj'.$object->id; - include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';*/ - if ($msg) print $msg.'
'; $moreforfilter = ''; diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 2ee3044895a..500c11d3cce 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -285,12 +285,6 @@ if ($result) { print ''.$langs->trans("DescVentilTodoExpenseReport").'

'; - /*$topicmail="Information"; - $modelmail="project"; - $objecttmp=new Project($db); - $trackid='prj'.$object->id; - include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';*/ - if ($msg) print $msg.'
'; $moreforfilter = ''; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 96b36fa8fa3..cbdecd2e85e 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -358,12 +358,6 @@ if ($result) { print ''.$langs->trans("DescVentilTodoCustomer").'

'; - /*$topicmail="Information"; - $modelmail="project"; - $objecttmp=new Project($db); - $trackid='prj'.$object->id; - include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';*/ - if ($msg) print $msg.'
'; $moreforfilter = ''; diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 7a48883fd55..f0544e1e914 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -688,61 +688,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea { print info_admin($debuginfo); } - - - // Select mail models is same action as presend - if (GETPOST('modelselected')) { - $action = 'presend'; - } - - /* - if ($action != 'presend') { - print '
'; - print ''; // ancre - */ - // Documents - /*$objref = dol_sanitizeFileName($object->ref); - $relativepath = $comref . '/' . $comref . '.pdf'; - $filedir = $conf->emailcollector->dir_output . '/' . $objref; - $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; - $genallowed = $user->rights->emailcollector->read; // If you can read, you can build the PDF to read content - $delallowed = $user->rights->emailcollector->create; // If you can create/edit, you can remove a file on card - print $formfile->showdocuments('emailcollector', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); - */ - /* - // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object, null, array('emailcollector')); - $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); - - print '
'; - - $MAXEVENT = 10; - - $morehtmlright = ''; - $morehtmlright .= $langs->trans("SeeAll"); - $morehtmlright .= ''; - - // List of actions on element - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; - $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, 'emailcollector_emailcollector', $socid, 1, '', $MAXEVENT, '', $morehtmlright); - - print '
'; - } - */ - - //Select mail models is same action as presend - /* - if (GETPOST('modelselected')) $action = 'presend'; - - // Presend form - $modelmail='inventory'; - $defaulttopic='InformationMessage'; - $diroutput = $conf->product->dir_output.'/inventory'; - $trackid = 'stockinv'.$object->id; - - include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; - */ } // End of page diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index 488997b5b78..d9540d30995 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -427,7 +427,7 @@ print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorde $topicmail = "Information"; //$modelmail="subscription"; $objecttmp = new EmailSenderProfile($db); -//$trackid='sub'.$object->id; +//$trackid = (($action == 'testhtml') ? "testhtml" : "test"); include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index 2a7271fed4a..cffcc8a962d 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -339,7 +339,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort $topicmail = "SendAssetsRef"; $modelmail = "asset"; $objecttmp = new Asset($db); -$trackid = 'xxxx'.$object->id; +$trackid = 'asset'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 6143f795b1d..1135f5df5dd 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -439,7 +439,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort $topicmail = "SendBillOfMaterialsRef"; $modelmail = "bom"; $objecttmp = new BOM($db); -$trackid = 'xxxx'.$object->id; +$trackid = 'bom'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 22bd08da1ba..c7e336a279c 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -262,7 +262,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort $topicmail = "Information"; //$modelmail="subscription"; $objecttmp = new Account($db); -//$trackid='sub'.$object->id; +$trackid='bank'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index 55ad8914a9e..fdc3e57bdba 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -343,7 +343,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort $topicmail = "SendCashControlRef"; $modelmail = "cashcontrol"; $objecttmp = new CashControl($db); -$trackid = 'xxxx'.$object->id; +$trackid = 'cashfence'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 2c890aa21de..cbb59378c89 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2442,14 +2442,14 @@ class Facture extends CommonInvoice * @param string $force_number Reference to force on invoice * @param int $idwarehouse Id of warehouse to use for stock decrease if option to decreasenon stock is on (0=no decrease) * @param int $notrigger 1=Does not execute triggers, 0= execute triggers - * @param int $batch_rule 0=do not decrement batch, else batch rule to use - * 1=take in batches ordered by sellby and eatby dates + * @param int $batch_rule 0=do not decrement batch, else batch rule to use, 1=take in batches ordered by sellby and eatby dates * @return int <0 if KO, 0=Nothing done because invoice is not a draft, >0 if OK */ public function validate($user, $force_number = '', $idwarehouse = 0, $notrigger = 0, $batch_rule = 0) { global $conf, $langs; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $productStatic = null; $warehouseStatic = null; if ($batch_rule > 0) { @@ -2494,7 +2494,7 @@ class Facture extends CommonInvoice // Check parameters if ($this->type == self::TYPE_REPLACEMENT) // if this is a replacement invoice { - // Controle que facture source connue + // Check that source invoice is known if ($this->fk_facture_source <= 0) { $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceReplacement")); diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 5a332ce4f9c..ad646af15b0 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1558,7 +1558,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) $modelmail = 'contact'; $defaulttopic = 'Information'; $diroutput = $conf->contact->dir_output; - $trackid = 'con'.$object->id; + $trackid = 'ctc'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f8087dc396e..8ebac12eb2c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6235,9 +6235,14 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, if (!empty($conf->expedition->enabled) && (!is_object($object) || $object->element == 'shipping')) { - $substitutionarray['__SHIPPINGTRACKNUM__'] = 'Shipping tacking number'; + $substitutionarray['__SHIPPINGTRACKNUM__'] = 'Shipping tracking number'; $substitutionarray['__SHIPPINGTRACKNUMURL__'] = 'Shipping tracking url'; } + if (!empty($conf->reception->enabled) && (!is_object($object) || $object->element == 'reception')) + { + $substitutionarray['__RECEPTIONTRACKNUM__'] = 'Shippin tracking number of shipment'; + $substitutionarray['__RECEPTIONTRACKNUMURL__'] = 'Shipping tracking url'; + } } else { $substitutionarray['__ID__'] = $object->id; $substitutionarray['__REF__'] = $object->ref; @@ -6359,6 +6364,11 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__SHIPPINGTRACKNUM__'] = $object->tracking_number; $substitutionarray['__SHIPPINGTRACKNUMURL__'] = $object->tracking_url; } + if (is_object($object) && $object->element == 'reception') + { + $substitutionarray['__RECEPTIONTRACKNUM__'] = $object->tracking_number; + $substitutionarray['__RECEPTIONTRACKNUMURL__'] = $object->tracking_url; + } if (is_object($object) && $object->element == 'contrat' && $object->id > 0 && is_array($object->lines)) { diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index 99f9b250306..92a767a23ea 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -75,7 +75,7 @@ if ($action == 'presend') $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang($newlang); // Load traductions files required by page - $outputlangs->loadLangs(array('commercial', 'bills', 'orders', 'contracts', 'members', 'propal', 'products', 'supplier_proposal', 'interventions')); + $outputlangs->loadLangs(array('commercial', 'bills', 'orders', 'contracts', 'members', 'propal', 'products', 'supplier_proposal', 'interventions', 'receptions')); } $topicmail = ''; diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 7c58b033ac8..c684eba2eec 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -733,6 +733,30 @@ class InterfaceActionsAuto extends DolibarrTriggers } } + // If trackid is not defined, we set it + if (empty($object->trackid)) { + // See also similar list into emailcollector.class.php + if (preg_match('/^COMPANY_/', $action)) { $object->trackid = 'thi'.$object->id; } + elseif (preg_match('/^CONTACT_/', $action)) { $object->trackid = 'ctc'.$object->id; } + elseif (preg_match('/^CONTRACT_/', $action)) { $object->trackid = 'con'.$object->id; } + elseif (preg_match('/^PROPAL_/', $action)) { $object->trackid = 'pro'.$object->id; } + elseif (preg_match('/^ORDER_/', $action)) { $object->trackid = 'ord'.$object->id; } + elseif (preg_match('/^BILL_/', $action)) { $object->trackid = 'inv'.$object->id; } + elseif (preg_match('/^FICHINTER_/', $action)) { $object->trackid = 'int'.$object->id; } + elseif (preg_match('/^SHIPPING_/', $action)) { $object->trackid = 'shi'.$object->id; } + elseif (preg_match('/^RECEPTION_/', $action)) { $object->trackid = 'rec'.$object->id; } + elseif (preg_match('/^PROPOSAL_SUPPLIER/', $action)) { $object->trackid = 'spr'.$object->id; } + elseif (preg_match('/^ORDER_SUPPLIER_/', $action)) { $object->trackid = 'sor'.$object->id; } + elseif (preg_match('/^BILL_SUPPLIER_/', $action)) { $object->trackid = 'sin'.$object->id; } + elseif (preg_match('/^MEMBER_SUBSCRIPTION_/', $action)) { $object->trackid = 'sub'.$object->id; } + elseif (preg_match('/^MEMBER_/', $action)) { $object->trackid = 'mem'.$object->id; } + elseif (preg_match('/^PROJECT_/', $action)) { $object->trackid = 'proj'.$object->id; } + elseif (preg_match('/^TASK_/', $action)) { $object->trackid = 'tas'.$object->id; } + elseif (preg_match('/^TICKET_/', $action)) { $object->trackid = 'tic'.$object->id; } + + $object->trackid = ''; + } + $object->actionmsg = dol_concatdesc($langs->transnoentities("Author").': '.$user->login, $object->actionmsg); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); @@ -740,7 +764,6 @@ class InterfaceActionsAuto extends DolibarrTriggers // Add entry in event table $now = dol_now(); - print 'trackid = '.$action.'-'.get_class($object); if (isset($_SESSION['listofnames-'.$object->trackid])) { $attachs = $_SESSION['listofnames-'.$object->trackid]; if ($attachs && strpos($action, 'SENTBYMAIL')) { diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index aed02f40531..1776e9855d5 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1342,6 +1342,15 @@ class EmailCollector extends CommonObject $trackid = $reg[1].$reg[2]; $objectid = $reg[2]; + // See also list into interface_50_modAgenda_ActionsAuto + if ($reg[1] == 'thi') + { + $objectemail = new Societe($this->db); + } + if ($reg[1] == 'ctc') + { + $objectemail = new Contact($this->db); + } if ($reg[1] == 'inv') { $objectemail = new Facture($this->db); @@ -1350,14 +1359,14 @@ class EmailCollector extends CommonObject { $objectemail = new Project($this->db); } + if ($reg[1] == 'tas') + { + $objectemail = new Task($this->db); + } if ($reg[1] == 'con') { $objectemail = new Contact($this->db); } - if ($reg[1] == 'thi') - { - $objectemail = new Societe($this->db); - } if ($reg[1] == 'use') { $objectemail = new User($this->db); @@ -1370,6 +1379,10 @@ class EmailCollector extends CommonObject { $objectemail = new RecruitmentCandidature($this->db); } + if ($reg[1] == 'mem') + { + $objectemail = new Adherent($this->db); + } } elseif (preg_match('/<(.*@.*)>/', $reference, $reg)) { // This is an external reference, we check if we have it in our database if (!is_object($objectemail)) { diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index b5a0111e4f4..600e60265d5 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1084,7 +1084,7 @@ if (empty($reshook)) // Actions to send emails $triggersendname = 'ORDER_SUPPLIER_SENTBYMAIL'; $autocopy = 'MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO'; - $trackid = 'sor'.$object->id; + $trackid = 'sord'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; // Actions to build doc @@ -2875,7 +2875,7 @@ if ($action == 'create') $defaulttopic = 'SendOrderRef'; $diroutput = $conf->fournisseur->commande->dir_output; $autocopy = 'MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO'; - $trackid = 'sor'.$object->id; + $trackid = 'sord'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index af963952765..709cbdb84f7 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1548,7 +1548,7 @@ if (empty($reshook)) $triggersendname = 'BILL_SUPPLIER_SENTBYMAIL'; $paramname = 'id'; $autocopy = 'MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO'; - $trackid = 'sin'.$object->id; + $trackid = 'sinv'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; // Actions to build doc @@ -3308,7 +3308,7 @@ if ($action == 'create') $defaulttopic = 'SendBillRef'; $diroutput = $conf->fournisseur->facture->dir_output; $autocopy = 'MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO'; - $trackid = 'sin'.$object->id; + $trackid = 'sinv'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; } diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index 3c9312d50f6..beeefbd19ff 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -345,7 +345,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort $topicmail = "SendMoRef"; $modelmail = "mo"; $objecttmp = new Mo($db); -$trackid = 'xxxx'.$object->id; +$trackid = 'mo'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 67906022057..dab4f6d1fa7 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -120,7 +120,7 @@ if (empty($reshook)) // Actions to send emails /*$triggersendname = 'MYOBJECT_SENTBYMAIL'; $autocopy='MAIN_MAIL_AUTOCOPY_MYOBJECT_TO'; - $trackid='myobject'.$object->id; + $trackid='stockinv'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';*/ if (GETPOST('addline', 'alpha')) { diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index 879a6196450..747abda86b8 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -324,7 +324,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort $topicmail = "Information"; $modelmail = "inventory"; $objecttmp = new Inventory($db); -$trackid = 'inve'.$object->id; +$trackid = 'stockinv'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index bf706550318..6c08dd6c384 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -484,7 +484,7 @@ print_barre_liste($form->textwithpicto($title, $texthelp), $page, $_SERVER["PHP_ $topicmail = "Information"; $modelmail = "project"; $objecttmp = new Project($db); -$trackid = 'prj'.$object->id; +$trackid = 'proj'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) diff --git a/htdocs/public/recruitment/view.php b/htdocs/public/recruitment/view.php index 556394c0a77..0940a39d48f 100644 --- a/htdocs/public/recruitment/view.php +++ b/htdocs/public/recruitment/view.php @@ -140,7 +140,7 @@ if ($action == "view" || $action == "presend" || $action == "close" || $action = $triggersendname = 'CANDIDATURE_SENTBYMAIL'; $paramname = 'id'; $autocopy = 'MAIN_MAIL_AUTOCOPY_CANDIDATURE_TO'; // used to know the automatic BCC to add -$trackid = 'can'.$object->id; +$trackid = 'recruitmentcandidature'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 560147f46d3..62fc287fba3 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -2068,116 +2068,13 @@ if ($action == 'create') print '
'; } - if ($action == 'presend') - { - $ref = dol_sanitizeFileName($object->ref); - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->reception->dir_output.'/'.$ref, preg_quote($ref, '/').'[^\-]+'); - $file = $fileparams['fullname']; - // Define output language - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) - $newlang = $_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) - $newlang = $object->thirdparty->default_lang; - if (!empty($newlang)) - { - $outputlangs = new Translate('', $conf); - $outputlangs->setDefaultLang($newlang); - $outputlangs->load('receptions'); - } - // Build document if it not exists - if (!$file || !is_readable($file)) - { - $result = $object->generateDocument(GETPOST('model') ?GETPOST('model') : $object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref); - if ($result <= 0) - { - dol_print_error($db, $object->error, $object->errors); - exit; - } - $fileparams = dol_most_recent_file($conf->reception->dir_output.'/reception/'.$ref, preg_quote($ref, '/').'[^\-]+'); - $file = $fileparams['fullname']; - } - print '
'; - print '
'; - print '
'; - print load_fiche_titre($langs->trans('SendReceptionByEMail')); - print dol_get_fiche_head(''); - // Cree l'objet formulaire mail - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - $formmail->param['langsmodels'] = (empty($newlang) ? $langs->defaultlang : $newlang); - $formmail->fromtype = (GETPOST('fromtype') ?GETPOST('fromtype') : (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user')); - if ($formmail->fromtype === 'user') { - $formmail->fromid = $user->id; - } - $formmail->trackid = 'shi'.$object->id; - if (!empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set - { - include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $formmail->frommail = dolAddEmailTrackId($formmail->frommail, 'shi'.$object->id); - } - $formmail->withfrom = 1; - $liste = array(); - foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key] = $value; - $formmail->withto = GETPOST("sendto") ?GETPOST("sendto") : $liste; - $formmail->withtocc = $liste; - $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC; - $formmail->withtopic = $outputlangs->trans('SendReceptionRef', '__RECEPTIONREF__'); - $formmail->withfile = 2; - $formmail->withbody = 1; - $formmail->withdeliveryreceipt = 1; - $formmail->withcancel = 1; - // Tableau des substitutions - $formmail->setSubstitFromObject($object, $langs); - $formmail->substit['__RECEPTIONREF__'] = $object->ref; - $formmail->substit['__RECEPTIONTRACKNUM__'] = $object->tracking_number; - $formmail->substit['__RECEPTIONTRACKNUMURL__'] = $object->tracking_url; - //Find the good contact adress - if ($typeobject == 'commande' && $object->$typeobject->id && !empty($conf->commande->enabled)) { - $objectsrc = new Commande($db); - $objectsrc->fetch($object->$typeobject->id); - } - if ($typeobject == 'propal' && $object->$typeobject->id && !empty($conf->propal->enabled)) { - $objectsrc = new Propal($db); - $objectsrc->fetch($object->$typeobject->id); - } - $custcontact = ''; - $contactarr = array(); - if (is_object($objectsrc)) // For the case the reception was created without orders - { - $contactarr = $objectsrc->liste_contact(-1, 'external'); - } - if (is_array($contactarr) && count($contactarr) > 0) { - foreach ($contactarr as $contact) { - if ($contact['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) { - require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; - $contactstatic = new Contact($db); - $contactstatic->fetch($contact['id']); - $custcontact = $contactstatic->getFullName($langs, 1); - } - } - if (!empty($custcontact)) { - $formmail->substit['__CONTACTCIVNAME__'] = $custcontact; - } - } - // Tableau des parametres complementaires - $formmail->param['action'] = 'send'; - $formmail->param['models'] = 'reception_send'; - $formmail->param['models_id'] = GETPOST('modelmailselected', 'int'); - $formmail->param['receptionid'] = $object->id; - $formmail->param['returnurl'] = $_SERVER["PHP_SELF"].'?id='.$object->id; - // Init list of files - if (GETPOST("mode") == 'init') - { - $formmail->clear_attached_files(); - $formmail->add_attached_files($file, basename($file), dol_mimetype($file)); - } - // Show form - print $formmail->get_form(); - print dol_get_fiche_end(); - } + // Presend form + $modelmail = 'shipping_send'; + $defaulttopic = 'SendReceptionRef'; + $diroutput = $conf->reception->dir_output; + $trackid = 'rec'.$object->id; + + include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; } diff --git a/htdocs/recruitment/recruitmentjobposition_list.php b/htdocs/recruitment/recruitmentjobposition_list.php index 72349c94914..c942975a91d 100644 --- a/htdocs/recruitment/recruitmentjobposition_list.php +++ b/htdocs/recruitment/recruitmentjobposition_list.php @@ -388,7 +388,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort $topicmail = "SendRecruitmentJobPositionRef"; $modelmail = "recruitmentjobposition"; $objecttmp = new RecruitmentJobPosition($db); -$trackid = 'xxxx'.$object->id; +$trackid = 'recruitmentjobposition'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index a703816ce71..066d68b8902 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -495,7 +495,7 @@ if (empty($reshook)) // Actions to send emails $triggersendname = 'PROPOSAL_SUPPLIER_SENTBYMAIL'; $autocopy = 'MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO'; - $trackid = 'spr'.$object->id; + $trackid = 'spro'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; // Actions to build doc @@ -1952,7 +1952,7 @@ if ($action == 'create') $defaulttopic = 'SendAskRef'; $diroutput = $conf->supplier_proposal->dir_output; $autocopy = 'MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO'; - $trackid = 'spr'.$object->id; + $trackid = 'spro'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; } diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 3d82c9b6cf2..32cf9eccfe3 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -584,7 +584,7 @@ if ($mode == 'mine') { $topicmail = "SendTicketRef"; $modelmail = "ticket"; $objecttmp = new Ticket($db); -$trackid = 'tick'.$object->id; +$trackid = 'tic'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) diff --git a/htdocs/zapier/hook_card.php b/htdocs/zapier/hook_card.php index ab081f1cf58..548b79de866 100644 --- a/htdocs/zapier/hook_card.php +++ b/htdocs/zapier/hook_card.php @@ -101,12 +101,6 @@ if (empty($reshook)) { // Actions when printing a doc from card include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; - - // Actions to send emails - $triggersendname = 'MYOBJECT_SENTBYMAIL'; - $autocopy = 'MAIN_MAIL_AUTOCOPY_MYOBJECT_TO'; - $trackid = 'myobject'.$object->id; - include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; } @@ -391,19 +385,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'; } - - //Select mail models is same action as presend - /* - if (GETPOST('modelselected')) $action = 'presend'; - - // Presend form - $modelmail='inventory'; - $defaulttopic='InformationMessage'; - $diroutput = $conf->product->dir_output.'/inventory'; - $trackid = 'stockinv'.$object->id; - - include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; - */ } // End of page diff --git a/htdocs/zapier/hook_list.php b/htdocs/zapier/hook_list.php index 8450ec3e0d8..59432aea44b 100644 --- a/htdocs/zapier/hook_list.php +++ b/htdocs/zapier/hook_list.php @@ -354,7 +354,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort $topicmail = "SendHookRef"; $modelmail = "hook"; $objecttmp = new Hook($db); -$trackid = 'xxxx'.$object->id; +$trackid = 'zapier'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) {