Clean code
This commit is contained in:
parent
1c1a9a5463
commit
da6c6c9e0a
@ -357,12 +357,6 @@ if ($result) {
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoCustomer").'</span></br><br>';
|
||||
|
||||
/*$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.'<br>';
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
@ -285,12 +285,6 @@ if ($result) {
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoExpenseReport").'</span></br><br>';
|
||||
|
||||
/*$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.'<br>';
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
@ -358,12 +358,6 @@ if ($result) {
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoCustomer").'</span></br><br>';
|
||||
|
||||
/*$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.'<br>';
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
@ -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 '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<a name="builddoc"></a>'; // 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 '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
$MAXEVENT = 10;
|
||||
|
||||
$morehtmlright = '<a href="' . dol_buildpath('/emailcollector/emailcollector_info.php', 1) . '?id=' . $object->id . '">';
|
||||
$morehtmlright .= $langs->trans("SeeAll");
|
||||
$morehtmlright .= '</a>';
|
||||
|
||||
// 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 '</div></div></div>';
|
||||
}
|
||||
*/
|
||||
|
||||
//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
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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"));
|
||||
|
||||
@ -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';
|
||||
}
|
||||
|
||||
@ -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))
|
||||
{
|
||||
|
||||
@ -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 = '';
|
||||
|
||||
@ -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')) {
|
||||
|
||||
@ -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)) {
|
||||
|
||||
@ -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';
|
||||
}
|
||||
|
||||
@ -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';
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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')) {
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
|
||||
@ -2068,116 +2068,13 @@ if ($action == 'create')
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
}
|
||||
|
||||
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 '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
|
||||
print '<div class="clearboth"></div>';
|
||||
print '<br>';
|
||||
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';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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';
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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 '</div></div></div>';
|
||||
}
|
||||
|
||||
//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
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user