77@phan-var-force int $error
78@phan-var-force ?string $permissiontoadd
79@phan-var-force ?string $permissiontoread
80@phan-var-force ?string $permissiontodelete
81@phan-var-force ?string $permissiontoclose
82@phan-var-force ?string $permissiontoapprove
83@phan-var-force ?int[] $toselect
84@phan-var-force ?string $diroutputmassaction
85@phan-var-force ?string $objectlabel
86@phan-var-force ?string $option
87@phan-var-force int $deliveryreceipt
88@phan-var-force string $month
89@phan-var-force string $year
90@phan-var-force ?array<string,mixed> $moreparams
91@phan-var-force ?string $search_status
92@phan-var-force ?int $hidedetails
93@phan-var-force ?int $hidedesc
94@phan-var-force ?int $hideref
95@phan-var-force string $confirm
100if (empty($objectclass) || empty($uploaddir)) {
101 dol_print_error(
null,
'include of actions_massactions.inc.php is done but var $objectclass or $uploaddir was not defined');
104if (empty($massaction)) {
110@phan-var-force "CommonObject"|"CommandeFournisseur"|"ConferenceOrBoothAttendee"|"Contrat"|"Contact"|"Expedition"|"ExpenseReport"|"Facture"|"FactureFournisseur"|"Fichinter"|"Holiday"|"Partnership"|"Project"|"Propal"|"Societe"|"SupplierProposal" $objectclass
111@phan-var-force string $massaction
112@phan-var-force string $uploaddir
119if (!empty($permtoread) && empty($permissiontoread)) {
120 $permissiontoread = $permtoread;
122if (!empty($permtocreate) && empty($permissiontoadd)) {
123 $permissiontoadd = $permtocreate;
125if (!empty($permtodelete) && empty($permissiontodelete)) {
126 $permissiontodelete = $permtodelete;
130$maxformassaction =
getDolGlobalInt(
'MAIN_LIMIT_FOR_MASS_ACTIONS', 1000);
131if ($massaction && is_array($toselect) && count($toselect) < 1) {
135if (!$error && isset($toselect) && is_array($toselect) && count($toselect) > $maxformassaction) {
136 setEventMessages($langs->trans(
'TooManyRecordForMassAction', $maxformassaction),
null,
'errors');
140if (!$error && $massaction ==
'confirm_presend' && !
GETPOST(
'sendmail')) {
141 $massaction =
'presend';
144if (!$error && $massaction ==
'confirm_presend') {
148 $langs->load(
"mails");
149 include_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
150 include_once DOL_DOCUMENT_ROOT.
'/core/lib/signature.lib.php';
152 $listofobjectid = array();
153 $listofobjectthirdparties = array();
154 $listofobjectcontacts = array();
155 $listofobjectref = array();
156 $contactidtosend = array();
157 $attachedfilesThirdpartyObj = array();
158 $oneemailperrecipient = (
GETPOSTINT(
'oneemailperrecipient') ? 1 : 0);
162 $objecttmp =
new $objectclass(
$db);
166 if ($objecttmp->element ==
'expensereport') {
168 } elseif ($objecttmp->element ==
'contact') {
170 } elseif ($objecttmp->element ==
'partnership' &&
getDolGlobalString(
'PARTNERSHIP_IS_MANAGED_FOR') ==
'member') {
172 } elseif ($objecttmp->element ==
'holiday') {
174 } elseif ($objecttmp->element ==
'conferenceorboothattendee') {
178 foreach ($toselect as $toselectid) {
179 $objecttmp =
new $objectclass(
$db);
180 '@phan-var-force CommonObject $objecttmp';
182 $result = $objecttmp->fetch($toselectid);
184 $listofobjectid[$toselectid] = $toselectid;
187 $tmpobjectid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid);
188 if ($objecttmp->element ==
'societe') {
189 '@phan-var-force Societe $objecttmp';
191 $tmpobjectid = $objecttmp->id;
192 } elseif ($objecttmp->element ==
'contact') {
193 '@phan-var-force Contact $objecttmp';
195 $tmpobjectid = $objecttmp->id;
196 } elseif ($objecttmp->element ==
'expensereport') {
197 '@phan-var-force ExpenseReport $objecttmp';
199 $tmpobjectid = $objecttmp->fk_user_author;
200 } elseif ($objecttmp->element ==
'partnership' &&
getDolGlobalString(
'PARTNERSHIP_IS_MANAGED_FOR') ==
'member') {
201 '@phan-var-force Partnership $objecttmp';
203 $tmpobjectid = $objecttmp->fk_member;
204 } elseif ($objecttmp->element ==
'holiday') {
205 '@phan-var-force Holiday $objecttmp';
207 $tmpobjectid = $objecttmp->fk_user;
208 } elseif ($objecttmp->element ==
'conferenceorboothattendee') {
209 '@phan-var-force ConferenceOrBoothAttendee $objecttmp';
211 $tmpobjectid = $objecttmp->id;
213 if (empty($tmpobjectid)) {
217 if ($objectclass ==
'Facture') {
218 '@phan-var-force Facture $objecttmp';
220 $tmparraycontact = array();
221 $tmparraycontact = $objecttmp->liste_contact(-1,
'external', 0,
'BILLING');
222 if (is_array($tmparraycontact) && count($tmparraycontact) > 0) {
223 foreach ($tmparraycontact as $data_email) {
224 $listofobjectcontacts[$toselectid][$data_email[
'id']] = $data_email[
'email'];
227 } elseif ($objectclass ==
'CommandeFournisseur') {
228 '@phan-var-force CommandeFournisseur $objecttmp';
230 $tmparraycontact = array();
231 $tmparraycontact = $objecttmp->liste_contact(-1,
'external', 0,
'CUSTOMER');
232 if (is_array($tmparraycontact) && count($tmparraycontact) > 0) {
233 foreach ($tmparraycontact as $data_email) {
234 $listofobjectcontacts[$toselectid][$data_email[
'id']] = $data_email[
'email'];
239 $listofobjectthirdparties[$tmpobjectid] = $tmpobjectid;
240 $listofobjectref[$tmpobjectid][$toselectid] = $objecttmp;
246 if (
GETPOST(
'fromtype',
'alpha') ===
'user' && empty($user->email)) {
249 $massaction =
'presend';
252 $receiver =
GETPOST(
'receiver',
'alphawithlgt');
253 if (!is_array($receiver)) {
254 if (empty($receiver) || $receiver ==
'-1') {
257 $receiver = array($receiver);
260 if (!trim(
GETPOST(
'sendto',
'alphawithlgt')) && count($receiver) == 0 && count($listofobjectthirdparties) == 1) {
262 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"MailRecipient")),
null,
'warnings');
263 $massaction =
'presend';
266 if (!
GETPOST(
'subject',
'restricthtml')) {
268 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"MailTopic")),
null,
'warnings');
269 $massaction =
'presend';
274 foreach ($listofobjectthirdparties as $thirdpartyid) {
275 $result = $thirdparty->fetch($thirdpartyid);
288 if (trim(
GETPOST(
'sendto',
'alphawithlgt'))) {
290 $tmparray[] = trim(
GETPOST(
'sendto',
'alphawithlgt'));
292 if (count($receiver) > 0 && is_object($thirdparty)) {
293 foreach ($receiver as $key => $val) {
295 if ($val ==
'thirdparty') {
296 $tmparray[] = $thirdparty->name.
' <'.$thirdparty->email.
'>';
297 } elseif ($val && method_exists($thirdparty,
'contact_get_property')) {
298 $tmparray[] = $thirdparty->contact_get_property((
int) $val,
'email');
303 $sendto = implode(
',', $tmparray);
306 $receivercc =
GETPOST(
'receivercc',
'alphawithlgt');
307 if (!is_array($receivercc)) {
308 if ($receivercc ==
'-1') {
309 $receivercc = array();
311 $receivercc = array($receivercc);
315 if (trim(
GETPOST(
'sendtocc',
'alphawithlgt'))) {
316 $tmparray[] = trim(
GETPOST(
'sendtocc',
'alphawithlgt'));
318 if (count($receivercc) > 0) {
319 foreach ($receivercc as $key => $val) {
321 if ($val ==
'thirdparty') {
322 $tmparray[] = $thirdparty->name.
' <'.$thirdparty->email.
'>';
324 $tmparray[] = $thirdparty->contact_get_property((
int) $val,
'email');
329 $sendtocc = implode(
',', $tmparray);
332 $listofqualifiedobj = array();
333 $listofqualifiedref = array();
334 $thirdpartywithoutemail = array();
336 foreach ($listofobjectref[$thirdpartyid] as $objectid => $objectobj) {
343 $langs->load(
"errors");
345 $resaction .=
'<div class="error">'.$langs->trans(
'ErrorOnlyProposalNotDraftCanBeSentInMassAction', $objectobj->ref).
'</div><br>';
349 $langs->load(
"errors");
351 $resaction .=
'<div class="error">'.$langs->trans(
'ErrorOnlyOrderNotDraftCanBeSentInMassAction', $objectobj->ref).
'</div><br>';
355 $langs->load(
"errors");
357 $resaction .=
'<div class="error">'.$langs->trans(
'ErrorOnlyInvoiceValidatedCanBeSentInMassAction', $objectobj->ref).
'</div><br>';
362 if (empty($sendto)) {
363 if ($objectobj->element ==
'societe') {
364 $sendto = $objectobj->email;
365 } elseif ($objectobj->element ==
'expensereport') {
367 $fuser->fetch($objectobj->fk_user_author);
368 $sendto = $fuser->email;
369 } elseif ($objectobj->element ==
'contact') {
371 $fcontact->fetch($objectobj->id);
372 $sendto = $fcontact->email;
373 } elseif ($objectobj->element ==
'partnership' &&
getDolGlobalString(
'PARTNERSHIP_IS_MANAGED_FOR') ==
'member') {
375 $fadherent->fetch($objectobj->fk_member);
376 $sendto = $fadherent->email;
377 } elseif ($objectobj->element ==
'holiday') {
379 $fuser->fetch($objectobj->fk_user);
380 $sendto = $fuser->email;
381 } elseif ($objectobj->element ==
'facture' && !empty($listofobjectcontacts[$objectid])) {
382 $emails_to_sends = array();
383 $objectobj->fetch_thirdparty();
384 $contactidtosend = array();
385 foreach ($listofobjectcontacts[$objectid] as $contactemailid => $contactemailemail) {
386 $emails_to_sends[] = $objectobj->thirdparty->contact_get_property($contactemailid,
'email');
387 if (!in_array($contactemailid, $contactidtosend)) {
388 $contactidtosend[] = $contactemailid;
391 if (count($emails_to_sends) > 0) {
392 $sendto = implode(
',', $emails_to_sends);
394 } elseif ($objectobj->element ==
'order_supplier' && !empty($listofobjectcontacts[$objectid])) {
395 $emails_to_sends = array();
396 $objectobj->fetch_thirdparty();
397 $contactidtosend = array();
398 foreach ($listofobjectcontacts[$objectid] as $contactemailid => $contactemailemail) {
399 $emails_to_sends[] = $objectobj->thirdparty->contact_get_property($contactemailid,
'email');
400 if (!in_array($contactemailid, $contactidtosend)) {
401 $contactidtosend[] = $contactemailid;
404 if (count($emails_to_sends) > 0) {
405 $sendto = implode(
',', $emails_to_sends);
407 } elseif ($objectobj->element ==
'conferenceorboothattendee') {
408 $sendto = $objectobj->email;
410 $objectobj->fetch_thirdparty();
411 $sendto = $objectobj->thirdparty->email;
415 if (empty($sendto)) {
416 if ($objectobj->element ==
'societe') {
418 $objectobj->thirdparty = $objectobj;
423 if (empty($thirdpartywithoutemail[$objectobj->thirdparty->id])) {
424 $resaction .=
'<div class="error">'.$langs->trans(
'NoRecipientEmail', $objectobj->thirdparty->name).
'</div><br>';
426 dol_syslog(
'No recipient for thirdparty: '.$objectobj->thirdparty->name, LOG_WARNING);
427 $thirdpartywithoutemail[$objectobj->thirdparty->id] = 1;
431 if (
GETPOST(
'addmaindocfile')) {
438 $filedir = $uploaddir.
'/'.$subdir.dol_sanitizeFileName($objectobj->ref);
439 $filepath = $filedir.
'/'.$filename;
442 if ($objectobj->element ==
'invoice_supplier') {
443 $fileparams =
dol_most_recent_file($uploaddir.
'/'.
get_exdir($objectobj->id, 2, 0, 0, $objectobj, $objectobj->element).$objectobj->ref, preg_quote($objectobj->ref,
'/').
'([^\-])+');
444 $filepath = $fileparams[
'fullname'];
447 if (
getDolGlobalInt(
'MAIL_MASS_ACTION_SEARCH_MOST_RECENT_FILE_IF_NOT_FOUND') && isset($filepath) && !
dol_is_file($filepath)) {
449 if (isset($fileparams)) {
450 $filepath = $fileparams[
'fullname'];
451 $filename = $fileparams[
'name'];
456 $filename_found =
'';
457 $filepath_found =
'';
458 $file_check_list = array();
459 $file_check_list[] = array(
463 if (
getDolGlobalString(
'MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND') && !empty($objectobj->last_main_doc)) {
464 $file_check_list[] = array(
465 'name' => basename($objectobj->last_main_doc),
466 'path' => DOL_DATA_ROOT .
'/' . $objectobj->last_main_doc,
469 foreach ($file_check_list as $file_check_arr) {
471 $filename_found = $file_check_arr[
'name'];
472 $filepath_found = $file_check_arr[
'path'];
477 if ($filepath_found) {
479 $attachedfilesThirdpartyObj[$thirdpartyid][$objectid] = array(
480 'paths' => array($filepath_found),
481 'names' => array($filename_found),
482 'mimes' => array(dol_mimetype($filepath_found))
486 $langs->load(
"errors");
487 foreach ($file_check_list as $file_check_arr) {
488 $resaction .=
'<div class="error">'.$langs->trans(
'ErrorCantReadFile', $file_check_arr[
'path']).
'</div><br>';
489 dol_syslog(
'Failed to read file: '.$file_check_arr[
'path'], LOG_WARNING);
496 $listofqualifiedobj[$objectid] = $objectobj;
497 $listofqualifiedref[$objectid] = $objectobj->ref;
504 if (count($listofqualifiedobj) > 0) {
505 $langs->load(
"commercial");
509 $fromtype =
GETPOST(
'fromtype');
510 if ($fromtype ===
'user') {
511 $from =
dol_string_nospecial($user->getFullName($langs),
' ', array(
",")).
' <'.$user->email.
'>';
512 } elseif ($fromtype ===
'company') {
514 } elseif (preg_match(
'/global_aliases_(\d+)/', $fromtype, $reg)) {
516 $from = trim($tmp[((
int) $reg[1] - 1)]);
517 } elseif (preg_match(
'/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) {
518 $sql =
"SELECT rowid, label, email FROM ".MAIN_DB_PREFIX.
"c_email_senderprofile WHERE rowid = ".(int) $reg[1];
519 $resql =
$db->query($sql);
520 $obj =
$db->fetch_object($resql);
529 $subject =
GETPOST(
'subject',
'restricthtml');
530 $message =
GETPOST(
'message',
'restricthtml');
532 $sendtobcc =
GETPOST(
'sendtoccc');
533 if ($objectclass ==
'Propal') {
536 if ($objectclass ==
'Commande') {
539 if ($objectclass ==
'Facture') {
542 if ($objectclass ==
'SupplierProposal') {
543 $sendtobcc .= (!
getDolGlobalString(
'MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO') ?
'' : (($sendtobcc ?
", " :
"") .
getDolGlobalString(
'MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO')));
545 if ($objectclass ==
'CommandeFournisseur') {
548 if ($objectclass ==
'FactureFournisseur') {
551 if ($objectclass ==
'Project') {
557 $looparray = array();
558 if (!$oneemailperrecipient) {
559 $looparray = $listofqualifiedobj;
560 foreach ($looparray as $key => $objecttmp) {
561 $looparray[$key]->thirdparty = $thirdparty;
564 $objectforloop =
new $objectclass(
$db);
565 $objectforloop->thirdparty = $thirdparty;
566 $looparray[0] = $objectforloop;
569 dol_syslog(
"We have set an array of ".count($looparray).
" emails to send. oneemailperrecipient=".$oneemailperrecipient);
571 foreach ($looparray as $objectid => $objecttmp) {
573 if (
isModEnabled(
'project') && method_exists($objecttmp,
'fetchProject') && is_null($objecttmp->project)) {
574 $objecttmp->fetchProject();
576 $substitutionarray = getCommonSubstitutionArray($langs, 0,
null, $objecttmp);
577 $substitutionarray[
'__ID__'] = ($oneemailperrecipient ? implode(
', ', array_keys($listofqualifiedobj)) : $objecttmp->id);
578 $substitutionarray[
'__REF__'] = ($oneemailperrecipient ? implode(
', ', $listofqualifiedref) : $objecttmp->
ref);
579 $substitutionarray[
'__EMAIL__'] = $thirdparty->email;
580 $substitutionarray[
'__CHECK_READ__'] =
'<img src="'.DOL_MAIN_URL_ROOT.
'/public/emailing/mailing-read.php?tag=undefined&securitykey='.
dol_hash(
getDolGlobalString(
'MAILING_EMAIL_UNSUBSCRIBE_KEY').
"-undefined",
'md5').
'" width="1" height="1" style="width:1px;height:1px" border="0"/>';
582 if ($oneemailperrecipient) {
583 $substitutionarray[
'__ONLINE_PAYMENT_URL__'] =
'';
584 $substitutionarray[
'__ONLINE_PAYMENT_TEXT_AND_URL__'] =
'';
587 $parameters = array(
'mode' =>
'formemail');
589 if (!empty($listofobjectthirdparties)) {
590 $parameters[
'listofobjectthirdparties'] = $listofobjectthirdparties;
592 if (!empty($listofobjectref)) {
593 $parameters[
'listofobjectref'] = $listofobjectref;
601 $attachedfiles = array(
'paths' => array(),
'names' => array(),
'mimes' => array());
602 if ($oneemailperrecipient) {
604 if (is_array($attachedfilesThirdpartyObj[$thirdparty->id]) && count($attachedfilesThirdpartyObj[$thirdparty->id])) {
605 foreach ($attachedfilesThirdpartyObj[$thirdparty->id] as $keyObjId => $objAttachedFiles) {
607 $attachedfiles = array(
608 'paths' => array_merge($attachedfiles[
'paths'], $objAttachedFiles[
'paths']),
609 'names' => array_merge($attachedfiles[
'names'], $objAttachedFiles[
'names']),
610 'mimes' => array_merge($attachedfiles[
'mimes'], $objAttachedFiles[
'mimes'])
614 } elseif (!empty($attachedfilesThirdpartyObj[$thirdparty->id][$objectid])) {
617 $attachedfiles = $attachedfilesThirdpartyObj[$thirdparty->id][$objectid];
620 $filepath = $attachedfiles[
'paths'];
621 $filename = $attachedfiles[
'names'];
622 $mimetype = $attachedfiles[
'mimes'];
625 if ($oneemailperrecipient) {
626 $trackid =
'thi'.$thirdparty->id;
627 if ($objecttmp->element ==
'expensereport') {
628 $trackid =
'use'.$thirdparty->id;
629 } elseif ($objecttmp->element ==
'contact') {
630 $trackid =
'ctc'.$thirdparty->id;
631 } elseif ($objecttmp->element ==
'holiday') {
632 $trackid =
'use'.$thirdparty->id;
635 $trackid = strtolower(get_class($objecttmp));
636 if (get_class($objecttmp) ==
'Contact') {
638 } elseif (get_class($objecttmp) ==
'Contrat') {
640 } elseif (get_class($objecttmp) ==
'Propal') {
642 } elseif (get_class($objecttmp) ==
'Commande') {
644 } elseif (get_class($objecttmp) ==
'Facture') {
646 } elseif (get_class($objecttmp) ==
'SupplierProposal') {
648 } elseif (get_class($objecttmp) ==
'CommandeFournisseur') {
650 } elseif (get_class($objecttmp) ==
'FactureFournisseur') {
654 $trackid .= $objecttmp->id;
660 if (empty($sendcontext)) {
661 $sendcontext =
'standard';
665 $vardir =
$conf->user->dir_output.
"/".$user->id;
666 $upload_dir_tmp = $vardir.
'/temp';
669 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
670 $mailfile =
new CMailFile($subjectreplaced, (
string) $sendto, $from, $messagereplaced, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, (
int) $deliveryreceipt, -1,
'',
'', $trackid,
'', $sendcontext,
'', $upload_dir_tmp);
671 if ($mailfile->error) {
672 $resaction .=
'<div class="error">'.$mailfile->error.
'</div>';
674 $result = $mailfile->sendfile();
676 $resaction .= $langs->trans(
'MailSuccessfulySent', $mailfile->getValidAddress($mailfile->addr_from, 2), $mailfile->getValidAddress($mailfile->addr_to, 2)).
'<br>';
681 foreach ($listofqualifiedobj as $objid2 => $objectobj2) {
682 if ((!$oneemailperrecipient) && $objid2 != $objectid) {
686 dol_syslog(
"Try to insert email event into agenda for objid=".$objid2.
" => objectobj=".get_class($objectobj2));
695 $actionmsg = $langs->transnoentities(
'MailSentByTo', $from, (
string) $sendto);
698 $actionmsg =
dol_concatdesc($actionmsg, $langs->transnoentities(
'Bcc').
": ".$sendtocc);
700 $actionmsg =
dol_concatdesc($actionmsg, $langs->transnoentities(
'MailTopic').
": ".$subjectreplaced);
701 $actionmsg =
dol_concatdesc($actionmsg, $langs->transnoentities(
'TextUsedInTheMessageBody').
":");
707 $objectobj2->sendtoid = (empty($contactidtosend) ? 0 : $contactidtosend);
708 $objectobj2->actionmsg = $actionmsg;
709 $objectobj2->actionmsg2 = $actionmsg2;
710 $objectobj2->fk_element = $objid2;
711 $objectobj2->elementtype = $objectobj2->element;
713 $objectobj2->actionmsg2 = $subjectreplaced;
716 $triggername = strtoupper(get_class($objectobj2)).
'_SENTBYMAIL';
717 if ($triggername ==
'SOCIETE_SENTBYMAIL') {
718 $triggername =
'COMPANY_SENTBYMAIL';
720 if ($triggername ==
'CONTRAT_SENTBYMAIL') {
721 $triggername =
'CONTRACT_SENTBYMAIL';
723 if ($triggername ==
'COMMANDE_SENTBYMAIL') {
724 $triggername =
'ORDER_SENTBYMAIL';
726 if ($triggername ==
'FACTURE_SENTBYMAIL') {
727 $triggername =
'BILL_SENTBYMAIL';
729 if ($triggername ==
'EXPEDITION_SENTBYMAIL') {
730 $triggername =
'SHIPPING_SENTBYMAIL';
732 if ($triggername ==
'COMMANDEFOURNISSEUR_SENTBYMAIL') {
733 $triggername =
'ORDER_SUPPLIER_SENTBYMAIL';
735 if ($triggername ==
'FACTUREFOURNISSEUR_SENTBYMAIL') {
736 $triggername =
'BILL_SUPPLIER_SENTBYMAIL';
738 if ($triggername ==
'SUPPLIERPROPOSAL_SENTBYMAIL') {
739 $triggername =
'PROPOSAL_SUPPLIER_SENTBYMAIL';
741 if ($triggername ==
'PROJET_SENTBYMAIL') {
742 $triggername =
'PROJECT_SENTBYMAIL';
745 if (!empty($triggername)) {
747 $result = $objectobj2->call_trigger($triggername, $user);
755 dol_syslog(
"Error in trigger ".$triggername.
' '.
$db->lasterror(), LOG_ERR);
762 $langs->load(
"other");
763 if ($mailfile->error) {
764 $resaction .= $langs->trans(
'ErrorFailedToSendMail', $from, (
string) $sendto);
765 $resaction .=
'<br><div class="error">'.$mailfile->error.
'</div>';
767 $resaction .=
'<div class="warning">No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS</div>';
769 $resaction .= $langs->trans(
'ErrorFailedToSendMail', $from, (
string) $sendto) .
'<br><div class="error">(unhandled error)</div>';
777 $resaction .= ($resaction ?
'<br>' : $resaction);
778 $resaction .=
'<strong>'.$langs->trans(
"ResultOfMailSending").
':</strong><br>'.
"\n";
779 $resaction .= $langs->trans(
"NbSelected").
': '.count($toselect).
"\n<br>";
780 $resaction .= $langs->trans(
"NbIgnored").
': '.($nbignored ? $nbignored : 0).
"\n<br>";
781 $resaction .= $langs->trans(
"NbSent").
': '.($nbsent ? $nbsent : 0).
"\n<br>";
786 setEventMessages($langs->trans(
"EMailSentForNElements", $nbsent.
'/'.count($toselect)),
null,
'mesgs');
799if (!$error && $massaction ==
'cancelorders') {
804 $orders =
GETPOST(
'toselect',
'array:int');
805 foreach ($orders as $id_order) {
807 if ($cmd->fetch($id_order) <= 0) {
812 $langs->load(
'errors');
813 setEventMessages($langs->trans(
"ErrorObjectMustHaveStatusValidToBeCanceled", $cmd->ref),
null,
'errors');
818 $result = $cmd->cancel($user);
838if (!$error && $massaction ==
"builddoc" && $permissiontoread && !
GETPOST(
'button_search')) {
839 if (empty($diroutputmassaction)) {
840 dol_print_error(
null,
'include of actions_massactions.inc.php is done but var $diroutputmassaction was not defined');
844 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
845 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
846 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
848 $objecttmp =
new $objectclass(
$db);
849 $listofobjectid = array();
850 $listofobjectthirdparties = array();
851 $listofobjectref = array();
852 foreach ($toselect as $toselectid) {
853 $objecttmp =
new $objectclass(
$db);
854 $result = $objecttmp->fetch($toselectid);
856 $listofobjectid[$toselectid] = $toselectid;
857 $thirdpartyid = !empty($objecttmp->fk_soc) ? $objecttmp->fk_soc : $objecttmp->socid;
858 $listofobjectthirdparties[$thirdpartyid] = $thirdpartyid;
859 $listofobjectref[$toselectid] = $objecttmp->ref;
863 $arrayofinclusion = array();
865 'listofobjectref' => $listofobjectref,
866 'arrayofinclusion' => &$arrayofinclusion,
868 $reshook = $hookmanager->executeHooks(
'updateSearchRegexToMergeDoc', $parameters,
$object, $action);
870 if (empty($reshook)) {
871 foreach ($listofobjectref as $tmppdf) {
874 foreach ($listofobjectref as $tmppdf) {
875 $arrayofinclusion[] =
'^'.preg_quote(
dol_sanitizeFileName($tmppdf),
'/').
'_[\w\-\'\&\.]+\.pdf$';
879 $listoffiles =
dol_dir_list($uploaddir,
'all', 1, $arrayofinclusion,
'\.meta$|\.png$',
'date', SORT_DESC, 0, 1);
881 dol_syslog(
"Found ".count($listoffiles).
" files");
886 foreach ($listofobjectref as $basename) {
888 foreach ($listoffiles as $filefound) {
889 if (strstr($filefound[
"name"], $basename)) {
890 $files[] = $filefound[
'fullname'];
897 $outputlangs = $langs;
900 $newlang =
GETPOST(
'lang_id',
'aZ09');
905 if (!empty($newlang)) {
907 $outputlangs->setDefaultLang($newlang);
916 $filename = preg_replace(
'/\s/',
'_', $filename);
919 if (in_array($objecttmp->element, array(
'facture',
'invoice_supplier')) && $search_status ==
Facture::STATUS_VALIDATED) {
920 if ($option ==
'late') {
927 $filename .=
'_'.$year;
930 $filename .=
'_'.$month;
933 if (count($files) > 0) {
935 $file = $diroutputmassaction.
'/'.$filename.
'_'.
dol_print_date($now,
'dayhourlog').
'.pdf';
938 foreach ($files as $f) {
939 $input_files .=
' '.escapeshellarg($f);
942 $cmd =
'pdftk '.$input_files.
' cat output '.escapeshellarg($file);
946 if (file_exists($file)) {
949 $langs->load(
"exports");
952 setEventMessages($langs->trans(
'ErrorPDFTkOutputFileNotFound'),
null,
'errors');
955 setEventMessages($langs->trans(
'NoPDFAvailableForDocGenAmongChecked'),
null,
'errors');
960 $page_largeur = $formatarray[
'width'];
961 $page_hauteur = $formatarray[
'height'];
962 $format = array($page_largeur, $page_hauteur);
966 if (class_exists(
'TCPDF')) {
967 $pdf->setPrintHeader(
false);
968 $pdf->setPrintFooter(
false);
973 $pdf->SetCompression(
false);
978 foreach ($files as $file) {
980 $pagecount = $pdf->setSourceFile($file);
981 for ($i = 1; $i <= $pagecount; $i++) {
982 $tplidx = $pdf->importPage($i);
983 $s = $pdf->getTemplatesize($tplidx);
984 $pdf->AddPage($s[
'h'] > $s[
'w'] ?
'P' :
'L');
985 $pdf->useTemplate($tplidx);
994 $filename = preg_replace(
'/\s/',
'_', $filename);
998 if (in_array($objecttmp->element, array(
'facture',
'invoice_supplier')) && $search_status ==
Facture::STATUS_VALIDATED) {
999 if ($option ==
'late') {
1005 if (!empty($year)) {
1006 $filename .=
'_'.$year;
1008 if (!empty($month)) {
1009 $filename .=
'_'.$month;
1013 $file = $diroutputmassaction.
'/'.$filename.
'_'.
dol_print_date($now,
'dayhourlog').
'.pdf';
1014 $pdf->Output($file,
'F');
1017 $langs->load(
"exports");
1020 setEventMessages($langs->trans(
'NoPDFAvailableForDocGenAmongChecked'),
null,
'errors');
1026if ($action ==
'remove_file') {
1027 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
1029 $langs->load(
"other");
1030 $upload_dir = $diroutputmassaction;
1031 $file = $upload_dir.
'/'.
GETPOST(
'file');
1043if (!$error && $massaction ==
'validate' && $permissiontoadd) {
1044 $objecttmp =
new $objectclass(
$db);
1046 if (($objecttmp->element ==
'facture' || $objecttmp->element ==
'invoice') &&
isModEnabled(
'stock') &&
getDolGlobalString(
'STOCK_CALCULATE_ON_BILL')) {
1047 $langs->load(
"errors");
1048 setEventMessages($langs->trans(
'ErrorMassValidationNotAllowedWhenStockIncreaseOnAction'),
null,
'errors');
1052 $langs->load(
"errors");
1053 setEventMessages($langs->trans(
'ErrorMassValidationNotAllowedWhenStockIncreaseOnAction'),
null,
'errors');
1056 if ($objecttmp->element ==
'facture') {
1059 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture";
1060 $sql .=
" WHERE rowid IN (".$db->sanitize(implode(
",", $toselect)).
")";
1061 $sql .=
" ORDER BY datef";
1063 $resql =
$db->query($sql);
1066 while (!empty($arr =
$db->fetch_row($resql))) {
1067 $toselectnew[] = $arr[0];
1069 $toselect = (empty($toselectnew)) ? $toselect : $toselectnew;
1083 $perrecordtransaction = (int)
getDolGlobalInt(
'MAIN_MASSVALIDATE_'.strtoupper($objectclass).
'_NO_GLOBAL_TRANSACTION');
1084 if (!$perrecordtransaction) {
1089 foreach ($toselect as $toselectid) {
1090 if ($perrecordtransaction) {
1093 $result = $objecttmp->fetch($toselectid);
1095 if (method_exists($objecttmp,
'validate')) {
1096 $result = $objecttmp->validate($user);
1097 } elseif (method_exists($objecttmp,
'setValid')) {
1098 $result = $objecttmp->setValid($user);
1100 $objecttmp->error =
'No method validate or setValid on this object';
1104 $langs->load(
"errors");
1105 setEventMessages($langs->trans(
"ErrorObjectMustHaveStatusDraftToBeValidated", $objecttmp->ref),
null,
'errors');
1107 if ($perrecordtransaction) {
1111 } elseif ($result < 0) {
1114 if ($perrecordtransaction) {
1122 $outputlangs = $langs;
1125 $newlang =
GETPOST(
'lang_id',
'aZ09');
1127 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && empty($newlang) && property_exists($objecttmp,
'thirdparty')) {
1128 if ((property_exists($objecttmp,
'socid') || property_exists($objecttmp,
'fk_soc')) && empty($objecttmp->thirdparty)) {
1129 $objecttmp->fetch_thirdparty();
1131 if (!empty($objecttmp->thirdparty)) {
1132 $newlang = $objecttmp->thirdparty->default_lang;
1135 if (!empty($newlang)) {
1137 $outputlangs->setDefaultLang($newlang);
1138 $outputlangs->load(
'products');
1140 $model = $objecttmp->model_pdf;
1141 $ret = $objecttmp->fetch($objecttmp->id);
1144 $hidedetails = isset($hidedetails) ? $hidedetails : (
getDolGlobalString(
'MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS') ? 1 : 0);
1145 $hidedesc = isset($hidedesc) ? $hidedesc : (
getDolGlobalString(
'MAIN_GENERATE_DOCUMENTS_HIDE_DESC') ? 1 : 0);
1146 $hideref = isset($hideref) ? $hideref : (
getDolGlobalString(
'MAIN_GENERATE_DOCUMENTS_HIDE_REF') ? 1 : 0);
1147 $moreparams = isset($moreparams) ? $moreparams :
null;
1149 $result = $objecttmp->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
1155 if ($perrecordtransaction) {
1162 if ($perrecordtransaction) {
1173 setEventMessages($langs->trans(
"RecordModifiedSuccessfully"),
null,
'mesgs');
1175 if (!$perrecordtransaction) {
1178 } elseif (!$perrecordtransaction) {
1185if (!$error && ($massaction ==
'delete' || ($action ==
'delete' && $confirm ==
'yes')) && $permissiontodelete) {
1188 $objecttmp =
new $objectclass(
$db);
1195 $unique_arr = array_unique($toselect);
1196 foreach ($unique_arr as $toselectid) {
1197 $result = $objecttmp->fetch($toselectid);
1201 $langs->load(
"errors");
1203 $TMsg[] =
'<div class="error">'.$langs->trans(
'ErrorOnlyDraftStatusCanBeDeletedInMassAction', $objecttmp->ref).
'</div><br>';
1207 if (method_exists($objecttmp,
'is_erasable') && $objecttmp->is_erasable() <= 0) {
1208 $langs->load(
"errors");
1210 $TMsg[] =
'<div class="error">'.$langs->trans(
'ErrorRecordHasChildren').
' '.$objecttmp->ref.
'</div><br>';
1215 $langs->load(
"errors");
1217 $TMsg[] =
'<div class="error">'.$langs->trans(
'ErrorLeaveRequestMustBeDraftCanceledOrRefusedToBeDeleted', $objecttmp->ref).
'</div><br>';
1221 if ($objectclass ==
"Task" && $objecttmp->hasChildren() > 0) {
1222 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"projet_task SET fk_task_parent = 0 WHERE fk_task_parent = ".((int) $objecttmp->id);
1223 $res =
$db->query($sql);
1231 if ($objecttmp->element ==
'societe') {
1233 '@phan-var-force Societe $objecttmp';
1235 $result = $objecttmp->delete($objecttmp->id, $user, 1);
1237 $objecttmp->oldcopy =
dol_clone($objecttmp);
1238 $result = $objecttmp->delete($user);
1241 if (empty($result)) {
1242 $TMsg = array_merge($objecttmp->errors, $TMsg);
1243 } elseif ($result < 0) {
1257 if (empty($error)) {
1261 } elseif ($nbok > 0) {
1268 if (!empty($TMsg)) {
1281if (!$error && $massaction ==
'generate_doc' && $permissiontoread) {
1284@phan-var-force
'Commande'|
'CommandeFournisseur'|
'Contrat'|
'Expedition'|
'ExpenseReport'|
'Facture'|
'FactureFournisseur'|
'Fichinter'|
'Project'|
'Propal'|
'SupplierProposal' $objectclass
1290 $objecttmp =
new $objectclass(
$db);
1292 foreach ($toselect as $toselectid) {
1293 $objecttmp->thirdparty =
null;
1294 $result = $objecttmp->fetch($toselectid);
1297 $outputlangs = $langs;
1301 $newlang =
GETPOST(
'lang_id',
'aZ09');
1303 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && empty($newlang) && isset($objecttmp->thirdparty->default_lang)) {
1304 $newlang = $objecttmp->thirdparty->default_lang;
1306 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && empty($newlang) && isset($objecttmp->default_lang)) {
1307 $newlang = $objecttmp->default_lang;
1309 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && empty($newlang) && empty($objecttmp->thirdparty)) {
1310 $objecttmp->fetch_thirdparty();
1311 $newlang = $objecttmp->thirdparty->default_lang;
1313 if (!empty($newlang)) {
1315 $outputlangs->setDefaultLang($newlang);
1319 $hidedetails = isset($hidedetails) ? $hidedetails : (
getDolGlobalString(
'MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS') ? 1 : 0);
1320 $hidedesc = isset($hidedesc) ? $hidedesc : (
getDolGlobalString(
'MAIN_GENERATE_DOCUMENTS_HIDE_DESC') ? 1 : 0);
1321 $hideref = isset($hideref) ? $hideref : (
getDolGlobalString(
'MAIN_GENERATE_DOCUMENTS_HIDE_REF') ? 1 : 0);
1322 $moreparams = isset($moreparams) ? $moreparams :
null;
1324 $result = $objecttmp->generateDocument($objecttmp->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
1352if (!$error && ($action ==
'affecttag' && $confirm ==
'yes') && $permissiontoadd) {
1356 $affecttag_type =
GETPOST(
'affecttag_type',
'alpha');
1357 if (!empty($affecttag_type)) {
1358 $affecttag_type_array = explode(
',', $affecttag_type);
1362 if (!empty($affecttag_type_array)) {
1364 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1366 $to_affecttag_type_array = array();
1367 $categ_type_array = $categ->getMapList();
1368 foreach ($categ_type_array as $categdef) {
1369 if (in_array($categdef[
'code'], $affecttag_type_array)) {
1370 $to_affecttag_type_array[] = $categdef[
'code'];
1375 if (!empty($to_affecttag_type_array)) {
1376 foreach ($to_affecttag_type_array as $categ_type) {
1377 $contcats =
GETPOST(
'contcats_' . $categ_type,
'array');
1378 foreach ($toselect as $toselectid) {
1379 $result =
$object->fetch($toselectid);
1381 $result =
$object->setCategoriesCommon($contcats, $categ_type,
false);
1400 $toselect = array();
1406if (!$error && ($action ==
'updateprice' && $confirm ==
'yes') && $permissiontoadd) {
1407 '@phan-var-force Product|ProductCustomerPrice $obj';
1408 '@phan-var-force Product|ProductCustomerPrice $object';
1411 if (GETPOSTISSET(
'pricerate')) {
1413 if ($pricepercentage == 0) {
1416 foreach ($toselect as $toselectid) {
1417 $result =
$object->fetch($toselectid);
1421 if (
$object->price_base_type ==
'TTC') {
1422 $newprice =
$object->price_ttc * (100 + $pricepercentage) / 100;
1423 $minprice =
$object->price_min_ttc;
1425 $newprice =
$object->price * (100 + $pricepercentage) / 100;
1426 $minprice =
$object->price_min;
1428 $res =
$object->updatePrice($newprice,
$object->price_base_type, $user,
$object->tva_tx, $minprice, 0,
$object->tva_npr, 0, 0, array(),
$object->default_vat_code);
1436 for ($level = 1; $level <= $maxlevel; $level++) {
1437 if (
$object->price_base_type ==
'TTC') {
1438 $newprice =
$object->multiprices_ttc[$level] * (100 + $pricepercentage) / 100;
1439 $minprice =
$object->multiprices_min_ttc[$level];
1441 $newprice =
$object->multiprices[$level] * (100 + $pricepercentage) / 100;
1442 $minprice =
$object->multiprices_min[$level];
1444 $res =
$object->updatePrice($newprice,
$object->price_base_type, $user,
$object->tva_tx, $minprice, $level,
$object->tva_npr, 0, 0, array(),
$object->default_vat_code);
1464 $toselect = array();
1470if (!$error && ($action ==
'setsupervisor' && $confirm ==
'yes') && $permissiontoadd) {
1471 '@phan-var-force User $object';
1474 $supervisortoset =
GETPOSTINT(
'supervisortoset');
1475 if (!empty($supervisortoset)) {
1476 foreach ($toselect as $toselectid) {
1477 $result =
$object->fetch($toselectid);
1479 $object->fk_user = $supervisortoset;
1480 $res =
$object->update($user);
1500 $toselect = array();
1506if (!$error && ($action ==
'affectuser' && $confirm ==
'yes') && $permissiontoadd) {
1511 $projectrole =
GETPOST(
'projectrole');
1512 $tasksrole =
GETPOST(
'tasksrole');
1513 if (!empty($usertoaffect)) {
1514 foreach ($toselect as $toselectid) {
1515 $result =
$object->fetch($toselectid);
1517 $res =
$object->add_contact($usertoaffect, $projectrole,
'internal');
1520 $task_array = $taskstatic->getTasksArray(
null,
null,
$object->id, 0, 0);
1522 foreach ($task_array as $task) {
1523 $tasksToAffect =
new Task(
$db);
1524 $result = $tasksToAffect->fetch($task->id);
1526 $res = $tasksToAffect->add_contact($usertoaffect, $tasksrole,
'internal');
1550 $toselect = array();
1556if (!$error && ($massaction ==
'enable' || ($action ==
'enable' && $confirm ==
'yes')) && $permissiontoadd) {
1559 $objecttmp =
new $objectclass(
$db);
1561 foreach ($toselect as $toselectid) {
1562 $result = $objecttmp->fetch($toselectid);
1564 if (in_array($objecttmp->element, array(
'societe'))) {
1565 $result = $objecttmp->setStatut(1);
1593if (!$error && ($massaction ==
'disable' || ($action ==
'disable' && $confirm ==
'yes')) && $permissiontoadd) {
1596 $objecttmp =
new $objectclass(
$db);
1598 foreach ($toselect as $toselectid) {
1599 $result = $objecttmp->fetch($toselectid);
1601 if (in_array($objecttmp->element, array(
'societe'))) {
1602 $result = $objecttmp->setStatut(0);
1630if (!$error && $action ==
'confirm_edit_value_extrafields' && $confirm ==
'yes' && $permissiontoadd) {
1633 $objecttmp =
new $objectclass(
$db);
1635 $e->fetch_name_optionals_label($objecttmp->table_element);
1638 $extrafieldKeyToUpdate =
GETPOST(
'extrafield-key-to-update');
1641 foreach ($toselect as $toselectid) {
1643 $objecttmp =
new $objectclass(
$db);
1644 $result = $objecttmp->fetch($toselectid);
1647 $ret = $e->setOptionalsFromPost(
null, $objecttmp, $extrafieldKeyToUpdate);
1649 $objecttmp->insertExtraFields();
1673if (!$error && ($massaction ==
'assignsalerepresentative' || ($action ==
'assignsalerepresentative' && $confirm ==
'yes')) && $permissiontoadd) {
1676 $objecttmp =
new $objectclass(
$db);
1679 foreach ($toselect as $toselectid) {
1680 $result = $objecttmp->fetch($toselectid);
1682 if (in_array($objecttmp->element, array(
'societe'))) {
1683 $result = $objecttmp->setSalesRep(
GETPOST(
"commercial",
"alpha"));
1701 setEventMessages($langs->trans(
"CommercialsAffected", $nbok),
null,
'mesgs');
1711if (!$error && ($massaction ==
'unassigncommercial' || ($action ==
'unassigncommercial' && $confirm ==
'yes')) && $permissiontoadd) {
1714 $objecttmp =
new $objectclass(
$db);
1717 foreach ($toselect as $toselectid) {
1718 $result = $objecttmp->fetch($toselectid);
1720 if (in_array($objecttmp->element, array(
'societe'))) {
1721 $TCommercial =
GETPOST(
"commercial",
"alpha");
1722 if (is_array($TCommercial)) {
1723 foreach ($TCommercial as $commercial) {
1724 $result = $objecttmp->del_commercial($user, $commercial);
1744 setEventMessages($langs->trans(
"CommercialsDisaffected", $nbok),
null,
'mesgs');
1754if (!$error && ($massaction ==
'approveleave' || ($action ==
'approveleave' && $confirm ==
'yes')) && $permissiontoapprove) {
1757 $objecttmp =
new $objectclass(
$db);
1758 '@phan-var-force Holiday $objecttmp';
1760 foreach ($toselect as $toselectid) {
1761 $result = $objecttmp->fetch($toselectid);
1764 setEventMessages($langs->trans(
'StatusOfRefMustBe', $objecttmp->ref, $langs->transnoentitiesnoconv(
'Validated')),
null,
'warnings');
1767 if ($user->id == $objecttmp->fk_validator) {
1768 $objecttmp->oldcopy =
dol_clone($objecttmp, 2);
1770 $objecttmp->date_valid =
dol_now();
1771 $objecttmp->fk_user_valid = $user->id;
1772 $objecttmp->date_approval =
dol_now();
1773 $objecttmp->fk_user_approve = $user->id;
1775 $objecttmp->statut = $objecttmp->status;
1777 $verif = $objecttmp->approve($user);
1787 $result = $tmpUser->fetch($objecttmp->fk_user);
1790 $nbopenedday =
num_open_day($objecttmp->date_debut_gmt, $objecttmp->date_fin_gmt, 0, 1, $objecttmp->halfday, $tmpUser->country_id);
1791 $soldeActuel = $objecttmp->getCpforUser($objecttmp->fk_user, $objecttmp->fk_type);
1792 $newSolde = ($soldeActuel - $nbopenedday);
1795 $result = $objecttmp->addLogCP($user->id, $objecttmp->fk_user, $langs->transnoentitiesnoconv(
"Holidays"), $newSolde, $objecttmp->fk_type);
1802 $result = $objecttmp->updateSoldeCP($objecttmp->fk_user, $newSolde, $objecttmp->fk_type);
1811 $destinataire =
new User(
$db);
1812 $destinataire->fetch($objecttmp->fk_user);
1813 $emailTo = $destinataire->email;
1816 dol_syslog(
"User that request leave has no email, so we redirect directly to finished page without sending email");
1820 $expediteur->fetch($objecttmp->fk_validator);
1830 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysValidated");
1833 $message = $langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",\n";
1836 $message .= $langs->transnoentities(
"HolidaysValidatedBody",
dol_print_date($objecttmp->date_debut,
'day'),
dol_print_date($objecttmp->date_fin,
'day')).
"\n";
1838 $message .=
"- ".$langs->transnoentitiesnoconv(
"ValidatedBy").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"\n";
1840 $message .=
"- ".$langs->transnoentitiesnoconv(
"Link").
" : ".
$dolibarr_main_url_root.
"/holiday/card.php?id=".$objecttmp->id.
"\n\n";
1843 $trackid =
'leav'.$objecttmp->id;
1845 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
1846 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'',
'', 0, 0,
'',
'', $trackid);
1849 $result = $mail->sendfile();
1858 $langs->load(
"errors");
1859 setEventMessages($langs->trans(
'ErrorNotApproverForHoliday', $objecttmp->ref),
null,
'errors');
1871 } elseif ($nbok == 1) {
1880if (!$error && ($massaction ==
'increaseholiday' || ($action ==
'increaseholiday' && $confirm ==
'yes')) && $permissiontoapprove && is_array($toselect)) {
1881 '@phan-var-force Holiday $holiday';
1884 $objecttmp =
new $objectclass(
$db);
1889 if ($nbdaysholidays <= 0) {
1895 foreach ($toselect as $toselectid) {
1896 $balancecpuser = $objecttmp->getCPforUser($toselectid, $typeholiday);
1897 if (!empty($balancecpuser)) {
1898 $newnbdaysholidays = $nbdaysholidays + $balancecpuser;
1900 $newnbdaysholidays = $nbdaysholidays;
1902 $result = $holiday->addLogCP($user->id, $toselectid, $langs->transnoentitiesnoconv(
'ManualUpdate'), $newnbdaysholidays, $typeholiday);
1909 $objecttmp->updateSoldeCP($toselectid, $newnbdaysholidays, $typeholiday);
1922 setEventMessages($langs->trans(
"HolidayRecordsIncreased", $nbok),
null,
'mesgs');
1923 } elseif ($nbok == 1) {
1927 $toselect = array();
1934if (!$error && ($massaction ==
'clonetasks' || ($action ==
'clonetasks' && $confirm ==
'yes'))) {
1937 include_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
1945 $iscontactofnewproject = 0;
1946 if (empty($newproject->public)) {
1947 $tmps = $newproject->getProjectsAuthorizedForUser($user, 0, 1, 0,
'(fk_statut:=:1)');
1948 $tmparray = explode(
',', $tmps);
1949 if (!in_array($newproject->id, $tmparray)) {
1950 $iscontactofnewproject = 1;
1955 $permisstiontoadd =
false;
1956 if ($user->hasRight(
'project',
'all',
'creer') || ($user->hasRight(
'project',
'creer') && ($newproject->public || $iscontactofnewproject))) {
1957 $permisstiontoadd =
true;
1960 if ($permisstiontoadd) {
1961 foreach (
GETPOST(
'selected') as $task) {
1962 $origin_task->fetch($task,
'', 0);
1967 require_once DOL_DOCUMENT_ROOT .
"/core/modules/project/task/" .
getDolGlobalString(
'PROJECT_TASK_ADDON') .
'.php';
1968 $modTask =
new $classnamemodtask();
1969 '@phan-var-force ModeleNumRefTask $modTask';
1971 $defaultref = $modTask->getNextValue(
null, $clone_task);
1975 $clone_task->fk_project =
GETPOSTINT(
'projectid');
1976 $clone_task->ref = $defaultref;
1977 $clone_task->label = $origin_task->label;
1978 $clone_task->description = $origin_task->description;
1979 $clone_task->planned_workload = $origin_task->planned_workload;
1980 $clone_task->fk_task_parent = $origin_task->fk_task_parent;
1981 $clone_task->date_c =
dol_now();
1982 $clone_task->date_start = $origin_task->date_start;
1983 $clone_task->date_end = $origin_task->date_end;
1984 $clone_task->progress = $origin_task->progress;
1987 $ret = $extrafields->setOptionalsFromPost(
null, $clone_task);
1989 $taskid = $clone_task->create($user);
1992 $result = $clone_task->add_contact(
GETPOSTINT(
"userid"),
'TASKEXECUTIVE',
'internal');
1995 if (
$db->lasterrno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
1996 $langs->load(
"projects");
1998 $duplicate_code_error =
true;
2009 setEventMessages($langs->trans(
'NumberOfTasksCloned', $num),
null,
'mesgs');
2010 header(
"Location: ".DOL_URL_ROOT.
'/projet/tasks.php?id='.
GETPOSTINT(
'projectid'));
2018if (!$error && $action ==
'createcreditnote' && $permissiontoadd) {
2021 setEventMessages($langs->trans(
'CreditNoteNotCreatedStockCalculateOnBillEnabled'),
null,
'errors');
2022 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/list.php?mainmenu=compta&leftmenu=facture');
2026 $objecttmp =
new $objectclass(
$db);
2027 if ($objecttmp->element ==
'facture' || $objecttmp->element ==
'invoice') {
2032 $unique_arr = array_unique($toselect);
2033 foreach ($unique_arr as $toselectid) {
2034 $sourceinvoice = $toselectid;
2035 $result = $objecttmp->fetch($sourceinvoice);
2040 $TMsg[] = $langs->trans(
'CreditNoteNotCreatedSourceInvoiceNotFound', $sourceinvoice);
2045 $isSupportedType =
false;
2047 $isSupportedType =
true;
2050 $isSupportedType =
true;
2053 $isSupportedType =
true;
2056 if (!$isSupportedType) {
2065 $TMsg[] = $langs->trans(
'CreditNoteNotCreatedInvoiceTypeNotSupported', $objecttmp->ref, $listtype[$objecttmp->type]);
2071 $TMsg[] = $langs->trans(
'CreditNoteNotCreatedInvoiceNotValidated', $objecttmp->ref);
2076 $totalpaid = $objecttmp->getSommePaiement();
2077 $totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
2078 $totaldeposits = $objecttmp->getSumDepositsUsed();
2079 if ($totalpaid > 0) {
2080 $TMsg[] = $langs->trans(
'CreditNoteNotCreatedPaymentAlreadyDone', $objecttmp->ref);
2083 if ($totalcreditnotes > 0) {
2084 $TMsg[] = $langs->trans(
'CreditNoteNotCreatedCreditNoteAlreadyUsed', $objecttmp->ref);
2087 if ($totaldeposits > 0) {
2088 $TMsg[] = $langs->trans(
'CreditNoteNotCreatedDepositAlreadyUsed', $objecttmp->ref);
2096 $object->entity = $objecttmp->entity;
2097 $object->socid = $objecttmp->socid;
2098 $object->subtype = $objecttmp->subtype;
2102 $object->ref_client = $objecttmp->ref_client;
2103 $object->ref_customer = $objecttmp->ref_customer;
2104 $object->fk_project = $objecttmp->fk_project;
2105 $object->cond_reglement_id = 0;
2106 $object->fk_account = $objecttmp->fk_account;
2107 $object->fk_incoterms = $objecttmp->fk_incoterms;
2108 $object->location_incoterms = $objecttmp->location_incoterms;
2109 $object->multicurrency_code = $objecttmp->multicurrency_code;
2110 $object->multicurrency_tx = $objecttmp->multicurrency_tx;
2112 $object->fk_facture_source = $sourceinvoice;
2116 if ($objecttmp->isSituationInvoice()) {
2117 $object->situation_counter = $objecttmp->situation_counter;
2118 $object->situation_cycle_ref = $objecttmp->situation_cycle_ref;
2119 $objecttmp->fetchPreviousNextSituationInvoice();
2126 $TMsg[] = $langs->trans(
'CreditNoteNotCreated', $objecttmp->ref);
2130 $facture_source = $objecttmp;
2133 $object->copy_linked_contact($objecttmp,
'internal');
2134 $object->copy_linked_contact($objecttmp,
'external');
2137 if (!empty($facture_source->lines)) {
2138 $fk_parent_line = 0;
2140 foreach ($facture_source->lines as $line) {
2142 if (method_exists($line,
'fetch_optionals')) {
2144 $line->fetch_optionals();
2148 if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) {
2149 $fk_parent_line = 0;
2152 if ($facture_source->isSituationInvoice()) {
2153 $source_fk_prev_id = $line->fk_prev_id;
2154 $line->fk_prev_id = $line->id;
2156 if (!empty($facture_source->tab_previous_situation_invoice)) {
2159 $tab_jumped_credit_notes = array();
2160 $lineIndex = count($facture_source->tab_previous_situation_invoice) - 1;
2161 $searchPreviousInvoice =
true;
2162 while ($searchPreviousInvoice) {
2163 if ($facture_source->tab_previous_situation_invoice[$lineIndex]->type ==
Facture::TYPE_SITUATION || $lineIndex < 1) {
2164 $searchPreviousInvoice =
false;
2168 $tab_jumped_credit_notes[$lineIndex] = $facture_source->tab_previous_situation_invoice[$lineIndex]->id;
2174 $maxPrevSituationPercent = 0;
2175 foreach ($facture_source->tab_previous_situation_invoice[$lineIndex]->lines as $prevLine) {
2176 if ($prevLine->id == $source_fk_prev_id) {
2177 $maxPrevSituationPercent = max($maxPrevSituationPercent, $prevLine->situation_percent);
2180 $line->total_ht -= $prevLine->total_ht;
2181 $line->total_tva -= $prevLine->total_tva;
2182 $line->total_ttc -= $prevLine->total_ttc;
2183 $line->total_localtax1 -= $prevLine->total_localtax1;
2184 $line->total_localtax2 -= $prevLine->total_localtax2;
2186 $line->multicurrency_subprice -= $prevLine->multicurrency_subprice;
2187 $line->multicurrency_total_ht -= $prevLine->multicurrency_total_ht;
2188 $line->multicurrency_total_tva -= $prevLine->multicurrency_total_tva;
2189 $line->multicurrency_total_ttc -= $prevLine->multicurrency_total_ttc;
2194 $line->situation_percent = $maxPrevSituationPercent - $line->situation_percent;
2199 $maxPrevSituationPercent = 0;
2200 foreach ($tab_jumped_credit_notes as $index => $creditnoteid) {
2201 foreach ($facture_source->tab_previous_situation_invoice[$index]->lines as $prevLine) {
2202 if ($prevLine->fk_prev_id == $source_fk_prev_id) {
2203 $maxPrevSituationPercent = $prevLine->situation_percent;
2205 $line->total_ht -= $prevLine->total_ht;
2206 $line->total_tva -= $prevLine->total_tva;
2207 $line->total_ttc -= $prevLine->total_ttc;
2208 $line->total_localtax1 -= $prevLine->total_localtax1;
2209 $line->total_localtax2 -= $prevLine->total_localtax2;
2211 $line->multicurrency_subprice -= $prevLine->multicurrency_subprice;
2212 $line->multicurrency_total_ht -= $prevLine->multicurrency_total_ht;
2213 $line->multicurrency_total_tva -= $prevLine->multicurrency_total_tva;
2214 $line->multicurrency_total_ttc -= $prevLine->multicurrency_total_ttc;
2220 $line->situation_percent += $maxPrevSituationPercent;
2226 $line->fk_facture =
$object->id;
2227 $line->fk_parent_line = $fk_parent_line;
2229 $line->subprice = -$line->subprice;
2231 $line->total_ht = -$line->total_ht;
2232 $line->total_tva = -$line->total_tva;
2233 $line->total_ttc = -$line->total_ttc;
2234 $line->total_localtax1 = -$line->total_localtax1;
2235 $line->total_localtax2 = -$line->total_localtax2;
2237 $line->multicurrency_subprice = -$line->multicurrency_subprice;
2238 $line->multicurrency_total_ht = -$line->multicurrency_total_ht;
2239 $line->multicurrency_total_tva = -$line->multicurrency_total_tva;
2240 $line->multicurrency_total_ttc = -$line->multicurrency_total_ttc;
2242 $line->context[
'createcreditnotefrominvoice'] = 1;
2243 $result = $line->insert(0, 1);
2248 if ($result > 0 && $line->product_type == 9) {
2249 $fk_parent_line = $result;
2257 if (!empty(
$object->fk_facture_source) &&
$id > 0) {
2258 $facture_source->fetch(
$object->fk_facture_source);
2259 $facture_source->fetchObjectLinked();
2261 if (!empty($facture_source->linkedObjectsIds)) {
2262 foreach ($facture_source->linkedObjectsIds as $sourcetype => $TIds) {
2263 $object->add_object_linked($sourcetype, current($TIds));
2269 $result =
$object->validate($user);
2272 $TMsg[] = $langs->trans(
'CreditNoteNotCreatedErrorOnValidation', $objecttmp->ref);
2278 $outputlangs = $langs;
2281 $newlang =
GETPOST(
'lang_id',
'aZ09');
2284 $newlang =
$object->thirdparty->default_lang;
2286 if (!empty($newlang)) {
2288 $outputlangs->setDefaultLang($newlang);
2289 $outputlangs->load(
'products');
2295 $result =
$object->generateDocument($model, $outputlangs, (
int) $hidedetails, (
int) $hidedesc, (
int) $hideref);
2307 $result = $discountcheck->fetch(0,
$object->id);
2310 if (empty($discountcheck->id)) {
2315 $amount_ht = $amount_tva = $amount_ttc = array();
2316 $multicurrency_amount_ht = $multicurrency_amount_tva = $multicurrency_amount_ttc = array();
2320 foreach (
$object->lines as $line) {
2321 if ($line->product_type < 9 && $line->total_ht != 0) {
2322 $keyforvatrate = $line->tva_tx.($line->vat_src_code ?
' ('.$line->vat_src_code.
')' :
'');
2324 if (!isset($amount_ht[$keyforvatrate])) {
2325 $amount_ht[$keyforvatrate] = 0;
2327 $amount_ht[$keyforvatrate] += $line->total_ht;
2328 if (!isset($amount_tva[$keyforvatrate])) {
2329 $amount_tva[$keyforvatrate] = 0;
2331 $amount_tva[$keyforvatrate] += $line->total_tva;
2332 if (!isset($amount_ttc[$keyforvatrate])) {
2333 $amount_ttc[$keyforvatrate] = 0;
2335 $amount_ttc[$keyforvatrate] += $line->total_ttc;
2336 if (!isset($multicurrency_amount_ht[$keyforvatrate])) {
2337 $multicurrency_amount_ht[$keyforvatrate] = 0;
2339 $multicurrency_amount_ht[$keyforvatrate] += $line->multicurrency_total_ht;
2340 if (!isset($multicurrency_amount_tva[$keyforvatrate])) {
2341 $multicurrency_amount_tva[$keyforvatrate] = 0;
2343 $multicurrency_amount_tva[$keyforvatrate] += $line->multicurrency_total_tva;
2344 if (!isset($multicurrency_amount_ttc[$keyforvatrate])) {
2345 $multicurrency_amount_ttc[$keyforvatrate] = 0;
2347 $multicurrency_amount_ttc[$keyforvatrate] += $line->multicurrency_total_ttc;
2354 $discount->description =
'(CREDIT_NOTE)';
2355 $discount->fk_soc =
$object->socid;
2356 $discount->socid =
$object->socid;
2357 $discount->socid =
$object->socid;
2358 $discount->fk_facture_source =
$object->id;
2363 foreach ($amount_ht as $tva_tx => $xxx) {
2364 $discount->amount_ht = -((float) $amount_ht[$tva_tx]);
2365 $discount->amount_tva = -((float) $amount_tva[$tva_tx]);
2366 $discount->amount_ttc = -((float) $amount_ttc[$tva_tx]);
2367 $discount->total_ht = -((float) $amount_ht[$tva_tx]);
2368 $discount->total_tva = -((float) $amount_tva[$tva_tx]);
2369 $discount->total_ttc = -((float) $amount_ttc[$tva_tx]);
2370 $discount->multicurrency_amount_ht = -((float) $multicurrency_amount_ht[$tva_tx]);
2371 $discount->multicurrency_amount_tva = -((float) $multicurrency_amount_tva[$tva_tx]);
2372 $discount->multicurrency_amount_ttc = -((float) $multicurrency_amount_ttc[$tva_tx]);
2373 $discount->multicurrency_total_ht = -((float) $multicurrency_amount_ht[$tva_tx]);
2374 $discount->multicurrency_total_tva = -((float) $multicurrency_amount_tva[$tva_tx]);
2375 $discount->multicurrency_total_ttc = -((float) $multicurrency_amount_ttc[$tva_tx]);
2380 if (preg_match(
'/\((.*)\)/', $tva_tx, $reg)) {
2381 $vat_src_code = $reg[1];
2382 $tva_tx = preg_replace(
'/\s*\(.*\)/',
'', $tva_tx);
2385 $discount->tva_tx = abs((
float) $tva_tx);
2386 $discount->vat_src_code = $vat_src_code;
2388 $id_discount = $discount->create($user);
2389 if ($id_discount < 0) {
2395 if (empty($error) && $id_discount > 0) {
2397 $result =
$object->setPaid($user);
2403 $discount->fetch($id_discount);
2404 $result = $discount->link_to_invoice(0,
$object->fk_facture_source);
2407 $TMsg[] = $langs->trans(
'CreditNoteNotCreatedErrorOnDiscountLink', $objecttmp->ref);
2413 $objecttmp->fetch($objecttmp->id);
2414 if ($objecttmp->getRemainToPay(0) == 0) {
2415 $result = $objecttmp->setPaid($user);
2418 $TMsg[] = $langs->trans(
'CreditNoteNotCreatedErrorOnSetPaidSourceInvoice', $objecttmp->ref);
2423 $outputlangs = $langs;
2426 $newlang =
GETPOST(
'lang_id',
'aZ09');
2429 $objecttmp->fetch_thirdparty();
2430 $newlang = $objecttmp->thirdparty->default_lang;
2432 if (!empty($newlang)) {
2434 $outputlangs->setDefaultLang($newlang);
2436 $ret = $objecttmp->fetch($objecttmp->id);
2438 $result = $objecttmp->generateDocument($objecttmp->model_pdf, $outputlangs, (
int) $hidedetails, (
int) $hidedesc, (
int) $hideref);
2446 $TMsg[] = $langs->trans(
'CreditNoteNotCreatedErrorOnSourceInvoiceNotFullyPaidAfterDiscount', $objecttmp->ref);
2452 $TMsg[] = $langs->trans(
'CreditNoteNotCreatedErrorOnSetPaid', $objecttmp->ref);
2458 $TMsg[] = $langs->trans(
'CreditNoteNotCreatedErrorOnDiscount', $objecttmp->ref);
2463 $TMsg[] = $langs->trans(
'CreditNoteNotCreatedAlreadyConverted', $objecttmp->ref);
2471 $TMsg[] = $langs->trans(
'CreditNoteCreated',
$object->ref, $objecttmp->ref);
2476 foreach ($TMsg as $msg) {
2482 setEventMessages($langs->trans(
'CreditNotesCreated', $nbok),
null,
'mesgs');
2485 $toselect = array();
2486 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/list.php?mainmenu=compta&leftmenu=facture');
2489 setEventMessages($langs->trans(
'ThisMassActionIsOnlyForInvoices'),
null,
'errors');
2490 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/list.php?mainmenu=compta&leftmenu=facture');
2495if (empty($toselect)) {
2498$parameters[
'toselect'] = &$toselect;
2499$parameters[
'uploaddir'] = $uploaddir;
2500$parameters[
'massaction'] = $massaction;
2501$parameters[
'diroutputmassaction'] = isset($diroutputmassaction) ? $diroutputmassaction :
null;
2504$reshook = $hookmanager->executeHooks(
'doMassActions', $parameters,
$object, $action);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
global $dolibarr_main_url_root
Class to manage members of a foundation.
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
Class to manage categories.
Class to manage customers orders.
const STATUS_DRAFT
Draft status.
const STATUS_VALIDATED
Validated status.
Class for ConferenceOrBoothAttendee.
Class to manage absolute discounts.
Class to manage invoices.
const TYPE_REPLACEMENT
Replacement invoice.
const STATUS_DRAFT
Draft status.
const TYPE_STANDARD
Standard invoice.
const TYPE_SITUATION
Situation invoice.
const TYPE_PROFORMA
Proforma invoice (should not be used.
const STATUS_VALIDATED
Validated (need to be paid)
const TYPE_DEPOSIT
Deposit invoice.
const TYPE_CREDIT_NOTE
Credit note invoice.
const STATUS_VALIDATED
Validated status.
const STATUS_DRAFT
Draft status.
const STATUS_REFUSED
Refused.
const STATUS_CANCELED
Canceled.
const STATUS_APPROVED
Approved.
Class to manage projects.
const STATUS_DRAFT
Draft status.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
Class to manage Dolibarr users.
num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $halfday=0, $countryCodeOrId='', $user_id=0)
Function to return number of working days (and text of units) between two dates (working days)
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_is_file($pathoffile)
Return if path is a file.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
dol_most_recent_file($dir, $regexfilter='', $excludefilter=array('(\.meta|_preview.*\.png) $', '^\.'), $nohook=0, $mode=0)
Return file(s) into a directory (by default most recent)
dol_now($mode='gmt')
Return date for now.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_string_nospecial($str, $newstr='_', $badcharstoreplace='', $badcharstoremove='', $keepspaces=0)
Clean a string from all punctuation characters to use it as a ref or login.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
dolChmod($filepath, $newmask='')
Change mod of a file.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
pdf_getFormat($outputlangs=null, $mode='setup')
Return array with format properties of default PDF format.
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
pdf_getInstance($format='', $metric='mm', $pagetype='P')
Return a PDF instance object.
dol_hash($chain, $type='0', $nosalt=0, $mode=0)
Returns a hash (non reversible encryption) of a string.