37require
'../../main.inc.php';
47require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
51 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/lib/invoice.lib.php';
58$langs->loadLangs(array(
'bills',
'companies',
'compta',
'admin',
'other',
'products',
'banks'));
60$action =
GETPOST(
'action',
'aZ09');
61$massaction =
GETPOST(
'massaction',
'alpha');
63$confirm =
GETPOST(
'confirm',
'alpha');
64$cancel =
GETPOST(
'cancel',
'alpha');
65$toselect =
GETPOST(
'toselect',
'array:int');
66$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'invoicetemplatelist';
67$backtopage =
GETPOST(
'backtopage',
'alpha');
68$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
76 $socid = $user->socid;
78$objecttype =
'facture_rec';
79if ($action ==
"create" || $action ==
"add") {
84$year_date_when =
GETPOST(
'year_date_when');
85$month_date_when =
GETPOST(
'month_date_when');
86$selectedLines =
GETPOST(
'toselect',
'array:int');
89$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
90$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
92if (empty($page) || $page == -1) {
95$offset = $limit * $page;
100 $sortfield =
'f.titre';
102$pageprev = $page - 1;
103$pagenext = $page + 1;
106if (($id > 0 || $ref) && $action !=
'create' && $action !=
'add') {
107 $ret =
$object->fetch($id, $ref);
117$hookmanager->initHooks(array(
'invoicereccard',
'globalcard'));
120$extrafields->fetch_name_optionals_label(
$object->table_element);
122$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
124$permissiontoadd = $user->hasRight(
'facture',
'creer');
125$permissionnote = $user->hasRight(
'facture',
'creer');
126$permissiondellink = $user->hasRight(
'facture',
'creer');
127$permissiontoedit = $user->hasRight(
'facture',
'creer');
128$permissiontoeditextra = $permissiontoadd;
129if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
131 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
134$usercanread = $user->hasRight(
'facture',
'lire');
135$usercancreate = $user->hasRight(
'facture',
'creer');
136$usercanissuepayment = $user->hasRight(
'facture',
'paiement');
137$usercandelete = $user->hasRight(
'facture',
'supprimer');
140$usercanvalidate = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'facture',
'invoice_advance',
'validate')));
141$usercansend = (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'facture',
'invoice_advance',
'send'));
142$usercanreopen = (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'facture',
'invoice_advance',
'reopen'));
143$usercanunvalidate = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !empty($usercancreate)) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'facture',
'invoice_advance',
'unvalidate')));
144$usermustrespectpricemin = ((
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !$user->hasRight(
'produit',
'ignore_price_min_advance')) || !
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS'));
147$usercanproductignorepricemin = ((
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !$user->hasRight(
'produit',
'ignore_price_min_advance')) || !
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS'));
148$usercancreatemargin = $user->hasRight(
"margins",
"creer");
149$usercanreadallmargin = $user->hasRight(
"margins",
"liretous");
150$usercancreatewithdrarequest = $user->hasRight(
"prelevement",
"bons",
"creer");
164if (
GETPOST(
'cancel',
'alpha')) {
165 if ($action !=
'updateline') {
173if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
177$parameters = array(
'socid' => $socid);
178$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
183if (empty($reshook)) {
184 $backurlforlist = DOL_URL_ROOT.
'/compta/facture/invoicetemplate_list.php';
186 if (empty($backtopage) || ($cancel && empty($id))) {
187 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
188 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
189 $backtopage = $backurlforlist;
191 $backtopage = DOL_URL_ROOT.
'/compta/facture/invoicetemplate_list.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
199 if (!empty($backtopageforcancel)) {
200 header(
"Location: ".$backtopageforcancel);
202 } elseif (!empty($backtopage)) {
203 header(
"Location: ".$backtopage);
210 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
213 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
215 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
217 include DOL_DOCUMENT_ROOT.
'/core/actions_lineupdown.inc.php';
226 if ($action ==
'add' && $usercancreate) {
227 if (!
GETPOST(
'title',
'alphanohtml')) {
228 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->trans(
"Title")),
null,
'errors');
243 if (empty($reyear) || empty($remonth) || empty($reday)) {
244 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->trans(
"Date")),
null,
'errors');
267 $object->rule_for_lines_dates =
GETPOST(
'rule_for_lines_dates',
'alpha');
269 $object->frequency = $frequency;
271 $object->nb_gen_max = $nb_gen_max;
275 $object->fk_project = $projectid;
277 $date_next_execution =
dol_mktime($rehour, $remin, 0, $remonth, $reday, $reyear);
278 $object->date_when = $date_next_execution;
280 $ret = $extrafields->setOptionalsFromPost(
null, $object);
291 $srcObject->fetchObjectLinked();
293 if (!empty($srcObject->linkedObjectsIds[
'contrat'])) {
294 $contractidid = reset($srcObject->linkedObjectsIds[
'contrat']);
296 $object->origin_type =
'contrat';
297 $object->origin_id = $contractidid;
299 } elseif (!empty($srcObject->linkedObjectsIds[
'commande'])) {
300 $orderid = reset($srcObject->linkedObjectsIds[
'commande']);
302 $object->linked_objects[
'commande'] = $orderid;
303 } elseif (!empty($srcObject->linkedObjectsIds[
'propal'])) {
304 $proposalid = reset($srcObject->linkedObjectsIds[
'propal']);
305 $object->linked_objects[
'propal'] = $proposalid;
314 $onlylines =
GETPOST(
'toselect',
'array:int');
316 $result =
$object->create($user, $oldinvoice->id, 0, $onlylines);
318 $result = $oldinvoice->delete($user, 1);
333 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?facid='.
$object->id);
344 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'facture',
'supprimer')) {
347 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/invoicetemplate_list.php');
353 if ($action ==
'setconditions' && $usercancreate) {
355 $object->context[
'actionmsg'] = $langs->trans(
"FieldXModified", $langs->transnoentitiesnoconv(
"PaymentTerm"));
357 } elseif ($action ==
'setmode' && $usercancreate) {
359 $object->context[
'actionmsg'] = $langs->trans(
"FieldXModified", $langs->transnoentitiesnoconv(
"PaymentMode"));
361 $object->setValueFrom(
'fk_societe_rib', 0);
364 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?facid='.
$object->id);
366 } elseif ($action ==
'classin' && $usercancreate) {
368 $object->context[
'actionmsg'] = $langs->trans(
"FieldXModified", $langs->transnoentitiesnoconv(
"Project"));
370 } elseif ($action ==
'setref' && $usercancreate) {
372 $object->context[
'actionmsg'] = $langs->trans(
"FieldXModifiedFromYToZ", $langs->transnoentitiesnoconv(
"Title"),
$object->title, $ref);
373 $result =
$object->setValueFrom(
'titre', $ref,
'',
null,
'text',
'', $user,
'BILLREC_MODIFY');
379 if (
$object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
380 $langs->load(
"errors");
381 setEventMessages($langs->trans(
'ErrorRefAlreadyExists', $ref),
null,
'errors');
386 } elseif ($action ==
'setbankaccount' && $usercancreate) {
388 $object->context[
'actionmsg'] = $langs->trans(
"FieldXModified", $langs->transnoentitiesnoconv(
"Bank"));
390 } elseif ($action ==
'setbankaccountcustomer' && $usercancreate) {
392 $object->context[
'actionmsg'] = $langs->trans(
"FieldXModified", $langs->transnoentitiesnoconv(
"DebitBankAccount"));
393 $fk_societe_rib = (
GETPOSTINT(
'accountcustomerid') !=
"-1") ?
GETPOSTINT(
'accountcustomerid') : 0;
394 $result =
$object->setValueFrom(
'fk_societe_rib', $fk_societe_rib);
395 } elseif ($action ==
'setfrequency' && $usercancreate) {
397 $object->context[
'actionmsg'] = $langs->trans(
"FieldXModified", $langs->transnoentitiesnoconv(
"Frequency"));
399 } elseif ($action ==
'setdate_when' && $usercancreate) {
405 } elseif ($action ==
'setnb_gen_max' && $usercancreate) {
408 } elseif ($action ==
'setauto_validate' && $usercancreate) {
411 } elseif ($action ==
'setEmailTemplate' && $usercancreate) {
414 } elseif ($action ==
'setgenerate_pdf' && $usercancreate) {
417 } elseif ($action ==
'setmodelpdf' && $usercancreate) {
420 } elseif ($action ==
'disable' && $usercancreate) {
424 $object->context[
'actionmsg'] = $langs->trans(
"RecordDisabled");
426 $res =
$object->setValueFrom(
'suspended', 1,
'',
null,
'text',
'', $user,
'BILLREC_MODIFY');
437 } elseif ($action ==
'enable' && $usercancreate) {
441 $object->context[
'actionmsg'] = $langs->trans(
"RecordEnabled");
443 $res =
$object->setValueFrom(
'suspended', 0,
'',
null,
'text',
'', $user,
'BILLREC_MODIFY');
454 } elseif ($action ==
'setmulticurrencycode' && $usercancreate) {
456 $result =
$object->setMulticurrencyCode(
GETPOST(
'multicurrency_code',
'alpha'));
458 } elseif ($action ==
'setmulticurrencyrate' && $usercancreate) {
462 } elseif ($action ==
'setruleforlinesdates' && $usercancreate) {
463 $object->context[
'actionmsg'] = $langs->trans(
"FieldXModified", $langs->transnoentitiesnoconv(
"RuleForLinesDates"));
464 $ruleForLinesDates = GETPOSTISSET(
'rule_for_lines_dates') ?
GETPOST(
'rule_for_lines_dates',
'alpha') :
'prepaid';
465 $object->setValueFrom(
'rule_for_lines_dates', $ruleForLinesDates);
469 if ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $usercancreate) {
480 if ($line->delete($user) > 0) {
481 $result =
$object->update_price(1);
494 } elseif ($action ==
'confirm_delete_subtotalline' && $confirm ==
'yes' && $usercancreate) {
499 $result =
$object->deleteSubtotalLine($langs,
GETPOSTINT(
'lineid'), (
bool)
GETPOST(
'deletecorrespondingsubtotalline'), $user);
501 $result =
$object->update_price(1);
506 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
516 } elseif ($action ==
'update_extras' && $permissiontoeditextra) {
519 $attribute_name =
GETPOST(
'attribute',
'aZ09');
522 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
528 $result =
$object->updateExtraField($attribute_name,
'BILLREC_MODIFY');
536 $action =
'edit_extras';
541 if ($action ==
'addline' && $usercancreate) {
542 $langs->load(
'errors');
547 $product_desc = (GETPOSTISSET(
'dp_desc') ?
GETPOST(
'dp_desc',
'restricthtml') :
'');
550 $prod_entry_mode =
GETPOST(
'prod_entry_mode',
'alpha');
551 if ($prod_entry_mode ==
'free') {
557 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ProductOrService")),
null,
'errors');
562 $tva_tx = (
GETPOST(
'tva_tx',
'alpha') ?
GETPOST(
'tva_tx',
'alpha') : 0);
566 if (empty($remise_percent)) {
571 $extralabelsline = $extrafields->fetch_name_optionals_label(
$object->table_element_line);
572 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line, $predef);
574 if (is_array($extralabelsline)) {
576 foreach ($extralabelsline as $key => $value) {
577 unset($_POST[
"options_".$key.$predef]);
581 if ((empty($idprod) || $idprod < 0) && ($price_ht < 0) && ((
float) $qty < 0)) {
582 setEventMessages($langs->trans(
'ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv(
'UnitPriceHT'), $langs->transnoentitiesnoconv(
'Qty')),
null,
'errors');
585 if ($prod_entry_mode ==
'free' && (empty($idprod) || $idprod < 0) &&
GETPOST(
'type') < 0) {
586 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Type')),
null,
'errors');
589 if ($prod_entry_mode ==
'free' && (empty($idprod) || $idprod < 0) && (!($price_ht >= 0) || $price_ht ==
'')) {
590 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"UnitPriceHT")),
null,
'errors');
594 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Qty')),
null,
'errors');
597 if ($prod_entry_mode ==
'free' && (empty($idprod) || $idprod < 0) && empty($product_desc)) {
598 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Description')),
null,
'errors');
602 $langs->load(
"errors");
603 setEventMessages($langs->trans(
'ErrorQtyForCustomerInvoiceCantBeNegative'),
null,
'errors');
607 if (!$error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) {
613 $ret =
$object->fetch_thirdparty();
618 $price_base_type = (
GETPOST(
'price_base_type',
'alpha') ?
GETPOST(
'price_base_type',
'alpha') :
'HT');
629 if (!empty($idprod) && $idprod > 0) {
631 $prod->fetch($idprod);
647 $pu_ht = $datapriceofproduct[
'pu_ht'];
648 $pu_ttc = $datapriceofproduct[
'pu_ttc'];
649 $price_min = $datapriceofproduct[
'price_min'];
650 $price_base_type = empty($datapriceofproduct[
'price_base_type']) ?
'HT' : $datapriceofproduct[
'price_base_type'];
654 $tmpvat = (float)
price2num(preg_replace(
'/\s*\(.*\)/',
'', $tva_tx));
655 $tmpprodvat =
price2num(preg_replace(
'/\s*\(.*\)/',
'', (
string)
$prod->tva_tx));
658 if (!empty($price_ht)) {
660 $pu_ttc =
price2num((
float) $pu_ht * (1 + ($tmpvat / 100)),
'MU');
661 } elseif ($tmpvat != $tmpprodvat) {
664 if ($price_base_type !=
'HT') {
665 $pu_ht =
price2num((
float) $pu_ttc / (1 + ($tmpvat / 100)),
'MU');
667 $pu_ttc =
price2num((
float) $pu_ht * (1 + ($tmpvat / 100)),
'MU');
671 $outputlangs = $langs;
677 if (
GETPOST(
'lang_id',
'aZ09')) {
678 $newlang =
GETPOST(
'lang_id',
'aZ09');
680 if (empty($newlang)) {
681 $newlang =
$object->thirdparty->default_lang;
683 if (!empty($newlang)) {
685 $outputlangs->setDefaultLang($newlang);
686 $outputlangs->load(
'products');
689 $desc = (!empty(
$prod->multilangs [$outputlangs->defaultlang] [
"description"])) ?
$prod->multilangs [$outputlangs->defaultlang] [
"description"] :
$prod->
description;
691 $desc =
$prod->description;
699 if (!empty(
$prod->customcode)) {
700 $tmptxt .= $outputlangs->transnoentitiesnoconv(
"CustomsCode").
': '.
$prod->customcode;
702 if (!empty(
$prod->customcode) && !empty(
$prod->country_code)) {
705 if (!empty(
$prod->country_code)) {
706 $tmptxt .= $outputlangs->transnoentitiesnoconv(
"CountryOrigin").
': '.
getCountry(
$prod->country_code,
'',
$db, $outputlangs, 0);
709 if (!empty(
$prod->customcode)) {
710 $tmptxt .= $langs->transnoentitiesnoconv(
"CustomsCode").
': '.
$prod->customcode;
712 if (!empty(
$prod->customcode) && !empty(
$prod->country_code)) {
715 if (!empty(
$prod->country_code)) {
716 $tmptxt .= $langs->transnoentitiesnoconv(
"CountryOrigin").
': '.
getCountry(
$prod->country_code,
'',
$db, $langs, 0);
724 $fk_unit =
$prod->fk_unit;
728 $tva_npr = (preg_match(
'/\*/', $tva_tx) ? 1 : 0);
729 $tva_tx = str_replace(
'*',
'', $tva_tx);
730 if (empty($tva_tx)) {
733 $label = (
GETPOST(
'product_label') ?
GETPOST(
'product_label') :
'');
734 $desc = $product_desc;
739 $date_start_fill =
GETPOSTINT(
'date_start_fill');
743 $fournprice = (int) (
GETPOST(
'fournprice'.$predef) ?
GETPOST(
'fournprice'.$predef) :
'');
755 $fk_parent_line =
GETPOSTINT(
'fk_parent_line');
757 if ($usercanproductignorepricemin && (!empty($price_min) && ((
float)
price2num($pu_ht) * (1 - (
float)
price2num($remise_percent) / 100) < (
float)
price2num($price_min)))) {
758 $mesg = $langs->trans(
"CantBeLessThanMinPrice",
price(
price2num($price_min,
'MU'), 0, $langs, 0, 0, -1,
$conf->currency));
762 $result =
$object->addline($desc, $pu_ht, (
float) $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, 0, $pu_ttc, $type, -1, $special_code, $label, (
int) $fk_unit, 0, $date_start_fill, $date_end_fill, (
int) $fournprice, (
float) $buyingprice, $fk_parent_line);
767 if ($objectline->fetch($result)) {
768 $objectline->array_options = $array_options;
769 $result = $objectline->insertExtraFields();
795 unset($_POST[
'prod_entry_mode']);
797 unset($_POST[
'qty']);
798 unset($_POST[
'type']);
799 unset($_POST[
'remise_percent']);
800 unset($_POST[
'price_ht']);
801 unset($_POST[
'multicurrency_price_ht']);
802 unset($_POST[
'price_ttc']);
803 unset($_POST[
'tva_tx']);
804 unset($_POST[
'product_ref']);
805 unset($_POST[
'product_label']);
806 unset($_POST[
'product_desc']);
807 unset($_POST[
'fournprice']);
808 unset($_POST[
'buying_price']);
809 unset($_POST[
'np_marginRate']);
810 unset($_POST[
'np_markRate']);
811 unset($_POST[
'dp_desc']);
812 unset($_POST[
'idprod']);
813 unset($_POST[
'units']);
815 unset($_POST[
'date_starthour']);
816 unset($_POST[
'date_startmin']);
817 unset($_POST[
'date_startsec']);
818 unset($_POST[
'date_startday']);
819 unset($_POST[
'date_startmonth']);
820 unset($_POST[
'date_startyear']);
821 unset($_POST[
'date_endhour']);
822 unset($_POST[
'date_endmin']);
823 unset($_POST[
'date_endsec']);
824 unset($_POST[
'date_endday']);
825 unset($_POST[
'date_endmonth']);
826 unset($_POST[
'date_endyear']);
828 unset($_POST[
'date_start_fill']);
829 unset($_POST[
'date_end_fill']);
831 unset($_POST[
'situations']);
832 unset($_POST[
'progress']);
840 } elseif ($action ==
'confirm_addtitleline' && $usercancreate) {
843 $langs->load(
'subtotals');
845 $desc =
GETPOST(
'subtotallinedesc',
'alphanohtml');
846 $depth =
GETPOSTINT(
'subtotallinelevel') ?? 1;
848 $subtotal_options = array();
850 foreach (FactureRec::$TITLE_OPTIONS as $option) {
851 $value =
GETPOST($option,
'alphanohtml');
853 $subtotal_options[$option] = $value ==
'on' ? 1 : $value;
858 $result =
$object->addSubtotalLine($langs, $desc, (
int) $depth, $subtotal_options);
869 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
871 } elseif ($action ==
'confirm_addsubtotalline' && $usercancreate) {
874 $langs->load(
'subtotals');
876 $choosen_line =
GETPOST(
'subtotaltitleline',
'alphanohtml');
877 foreach (
$object->lines as $line) {
878 if ($line->desc == $choosen_line && $line->special_code == SUBTOTALS_SPECIAL_CODE) {
880 $depth = -$line->qty;
884 $subtotal_options = array();
886 foreach (FactureRec::$SUBTOTAL_OPTIONS as $option) {
887 $value =
GETPOST($option,
'alphanohtml');
889 $subtotal_options[$option] = $value ==
'on' ? 1 : $value;
894 if (isset($desc) && isset($depth)) {
895 $result =
$object->addSubtotalLine($langs, $desc, (
int) $depth, $subtotal_options);
898 $object->errors[] = $langs->trans(
"CorrespondingTitleNotFound");
907 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
909 } elseif ($action ==
'updateline' && $usercancreate && !
GETPOST(
'cancel',
'alpha')) {
910 if (!
$object->fetch($id) > 0) {
933 if (preg_match(
'/\*/', $vat_rate)) {
938 $vat_rate = str_replace(
'*',
'', $vat_rate);
943 $fournprice = (int) (
GETPOST(
'fournprice') ?
GETPOST(
'fournprice') :
'');
947 $pu_equivalent = $pu_ht;
948 $pu_equivalent_ttc = $pu_ttc;
950 $currency_tx =
$object->multicurrency_tx;
954 if ($pu_ht ==
'' && $pu_ht_devise !=
'' && $currency_tx !=
'' && !empty((
float) $currency_tx)) {
955 $pu_equivalent = (float) $pu_ht_devise / (
float) $currency_tx;
957 if ($pu_ttc ==
'' && $pu_ttc_devise !=
'' && $currency_tx !=
'' && !empty((
float) $currency_tx)) {
958 $pu_equivalent_ttc = (float) $pu_ttc_devise / (
float) $currency_tx;
973 $extralabelsline = $extrafields->fetch_name_optionals_label(
$object->table_element_line);
974 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
977 if ($objectline->fetch(
GETPOSTINT(
'lineid'))) {
978 $objectline->array_options = $array_options;
979 $result = $objectline->insertExtraFields();
984 $position = ($objectline->rang >= 0 ? $objectline->rang : 0);
987 if (is_array($extralabelsline)) {
989 foreach ($extralabelsline as $key => $value) {
990 unset($_POST[
"options_".$key]);
996 if ($special_code == 3) {
1009 if (empty($remise_percent)) {
1010 $remise_percent = 0;
1013 $price_base_type =
'HT';
1015 if (empty($pu) && !empty($pu_ttc)) {
1017 $price_base_type =
'TTC';
1022 if (!empty($productid)) {
1024 $product->fetch($productid);
1026 $type = $product->type;
1028 $price_min = $product->price_min;
1030 $price_min = $product->multiprices_min[
$object->thirdparty->price_level];
1032 $price_min_ttc = $product->price_min_ttc;
1034 $price_min_ttc = $product->multiprices_min_ttc[
$object->thirdparty->price_level];
1043 if ($pu_equivalent && $price_min && (((
float)
price2num($pu_equivalent) * (1 - (
float) $remise_percent / 100)) < (float)
price2num($price_min)) && $price_base_type ==
'HT') {
1044 $mesg = $langs->trans(
"CantBeLessThanMinPrice",
price(
price2num($price_min,
'MU'), 0, $langs, 0, 0, -1,
$conf->currency));
1047 $action =
'editline';
1048 } elseif ($pu_equivalent_ttc && $price_min_ttc && (((
float)
price2num($pu_equivalent_ttc) * (1 - (
float) $remise_percent / 100)) < (
float)
price2num($price_min_ttc)) && $price_base_type ==
'TTC') {
1049 $mesg = $langs->trans(
"CantBeLessThanMinPriceInclTax",
price(
price2num($price_min_ttc,
'MU'), 0, $langs, 0, 0, -1,
$conf->currency));
1052 $action =
'editline';
1057 $label = (
GETPOST(
'product_label') ?
GETPOST(
'product_label') :
'');
1061 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
1066 $langs->load(
"errors");
1067 setEventMessages($langs->trans(
'ErrorQtyForCustomerInvoiceCantBeNegative'),
null,
'errors');
1071 $date_start_fill =
GETPOSTINT(
'date_start_fill');
1072 $date_end_fill =
GETPOSTINT(
'date_end_fill');
1073 $fk_parent_line =
GETPOST(
'fk_parent_line',
'int');
1077 $result =
$object->updateline(
1096 (
float) $pu_ht_devise,
1101 (
float) $buyingprice,
1102 (
int) $fk_parent_line
1126 unset($_POST[
'qty']);
1127 unset($_POST[
'type']);
1128 unset($_POST[
'productid']);
1129 unset($_POST[
'remise_percent']);
1130 unset($_POST[
'price_ht']);
1131 unset($_POST[
'multicurrency_price_ht']);
1132 unset($_POST[
'price_ttc']);
1133 unset($_POST[
'tva_tx']);
1134 unset($_POST[
'product_ref']);
1135 unset($_POST[
'product_label']);
1136 unset($_POST[
'product_desc']);
1137 unset($_POST[
'fournprice']);
1138 unset($_POST[
'buying_price']);
1139 unset($_POST[
'np_marginRate']);
1140 unset($_POST[
'np_markRate']);
1142 unset($_POST[
'dp_desc']);
1143 unset($_POST[
'idprod']);
1144 unset($_POST[
'units']);
1146 unset($_POST[
'date_starthour']);
1147 unset($_POST[
'date_startmin']);
1148 unset($_POST[
'date_startsec']);
1149 unset($_POST[
'date_startday']);
1150 unset($_POST[
'date_startmonth']);
1151 unset($_POST[
'date_startyear']);
1152 unset($_POST[
'date_endhour']);
1153 unset($_POST[
'date_endmin']);
1154 unset($_POST[
'date_endsec']);
1155 unset($_POST[
'date_endday']);
1156 unset($_POST[
'date_endmonth']);
1157 unset($_POST[
'date_endyear']);
1159 unset($_POST[
'situations']);
1160 unset($_POST[
'progress']);
1165 } elseif ($action ==
'updatetitleline' && GETPOSTISSET(
"save") && $usercancreate && !
GETPOST(
'cancel',
'alpha')) {
1168 $langs->load(
'subtotals');
1170 $desc =
GETPOST(
'line_desc',
'alphanohtml') ?? $langs->trans(
"Title");
1173 $subtotal_options = array();
1175 foreach (Facture::$TITLE_OPTIONS as $option) {
1176 $value =
GETPOST($option,
'alphanohtml');
1178 $subtotal_options[$option] = $value ==
'on' ? 1 : $value;
1183 $result =
$object->updateSubtotalLine($langs,
GETPOSTINT(
'lineid'), $desc, $depth, $subtotal_options);
1194 } elseif ($action ==
'updatesubtotalline' && GETPOSTISSET(
"save") && $usercancreate && !
GETPOST(
'cancel',
'alpha')) {
1197 $langs->load(
'subtotals');
1199 $desc =
GETPOST(
'line_desc',
'alphanohtml');
1202 $subtotal_options = array();
1204 foreach (Facture::$SUBTOTAL_OPTIONS as $option) {
1205 $value =
GETPOST($option,
'alphanohtml');
1207 $subtotal_options[$option] = $value ==
'on' ? 1 : $value;
1212 $result =
$object->updateSubtotalLine($langs,
GETPOSTINT(
'lineid'), $desc, $depth, $subtotal_options);
1228$title =
$object->ref.
" - ".$langs->trans(
'Card');
1238 $formproject =
null;
1248if ($action ==
'create') {
1249 print
load_fiche_titre($langs->trans(
"CreateRepeatableInvoice"),
'',
'bill');
1255 if ($sourceInvoice->fetch($id, $ref) > 0) {
1256 $result = $sourceInvoice->getLinesArray();
1258 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
1259 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1260 print
'<input type="hidden" name="action" value="add">';
1261 print
'<input type="hidden" name="facid" value="'.$sourceInvoice->id.
'">';
1270 if ($sourceInvoice->fk_account > 0) {
1274 print
'<table class="border centpercent">';
1276 $sourceInvoice->fetch_thirdparty();
1279 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Title").
'</td><td>';
1280 print
'<input class="flat quatrevingtpercent" type="text" name="title" value="'.dol_escape_htmltag(
GETPOST(
"title",
'alphanohtml')).
'" autofocus>';
1284 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Customer").
'</td><td>'.$sourceInvoice->thirdparty->getNomUrl(1,
'customer').
'</td>';
1289 print
"<tr><td>".$langs->trans(
"InvoiceSubtype").
"</td><td>";
1290 print $form->getSelectInvoiceSubtype(GETPOSTISSET(
'subtype') ?
GETPOSTINT(
'subtype') : $sourceInvoice->subtype,
'subtype', 0, 0,
'');
1294 $note_public = GETPOSTISSET(
'note_public') ?
GETPOST(
'note_public',
'restricthtml') : $sourceInvoice->note_public;
1295 $note_private = GETPOSTISSET(
'note_private') ?
GETPOST(
'note_private',
'restricthtml') : $sourceInvoice->note_private;
1298 $substitutionarray = getCommonSubstitutionArray($langs, 2,
null, $sourceInvoice);
1300 $substitutionarray[
'__INVOICE_PREVIOUS_MONTH__'] = $langs->trans(
"PreviousMonthOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
dol_time_plus_duree($sourceInvoice->date, -1,
'm'),
'%m').
')';
1301 $substitutionarray[
'__INVOICE_MONTH__'] = $langs->trans(
"MonthOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date($sourceInvoice->date,
'%m').
')';
1302 $substitutionarray[
'__INVOICE_NEXT_MONTH__'] = $langs->trans(
"NextMonthOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
dol_time_plus_duree($sourceInvoice->date, 1,
'm'),
'%m').
')';
1303 $substitutionarray[
'__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans(
"TextPreviousMonthOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
dol_time_plus_duree($sourceInvoice->date, -1,
'm'),
'%B').
')';
1304 $substitutionarray[
'__INVOICE_MONTH_TEXT__'] = $langs->trans(
"TextMonthOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date($sourceInvoice->date,
'%B').
')';
1305 $substitutionarray[
'__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans(
"TextNextMonthOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
dol_time_plus_duree($sourceInvoice->date, 1,
'm'),
'%B').
')';
1306 $substitutionarray[
'__INVOICE_PREVIOUS_YEAR__'] = $langs->trans(
"PreviousYearOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
dol_time_plus_duree($sourceInvoice->date, -1,
'y'),
'%Y').
')';
1307 $substitutionarray[
'__INVOICE_YEAR__'] = $langs->trans(
"YearOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date($sourceInvoice->date,
'%Y').
')';
1308 $substitutionarray[
'__INVOICE_NEXT_YEAR__'] = $langs->trans(
"NextYearOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
dol_time_plus_duree($sourceInvoice->date, 1,
'y'),
'%Y').
')';
1310 $substitutionarray[
'__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans(
"DateNextInvoiceBeforeGen").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
dol_time_plus_duree($sourceInvoice->date, 1,
'm'),
'dayhour').
')';
1311 $substitutionarray[
'__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans(
"DateNextInvoiceAfterGen").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
dol_time_plus_duree($sourceInvoice->date, 2,
'm'),
'dayhour').
')';
1312 $substitutionarray[
'__INVOICE_COUNTER_CURRENT__'] = $langs->trans(
"Count");
1313 $substitutionarray[
'__INVOICE_COUNTER_MAX__'] = $langs->trans(
"MaxPeriodNumber");
1315 $htmltext =
'<i>'.$langs->trans(
"FollowingConstantsWillBeSubstituted").
':<br>';
1316 foreach ($substitutionarray as $key => $val) {
1317 $htmltext .= $key.
' = '.$langs->trans($val).
'<br>';
1319 $htmltext .=
'</i>';
1322 print
"<tr><td>".$langs->trans(
"Author").
"</td><td>".$user->getFullName($langs).
"</td></tr>";
1325 print
"<tr><td>".$langs->trans(
"PaymentConditions").
"</td><td>";
1326 print $form->getSelectConditionsPaiements(GETPOSTISSET(
'cond_reglement_id') ?
GETPOSTINT(
'cond_reglement_id') : $sourceInvoice->cond_reglement_id,
'cond_reglement_id', -1, 0, 0,
'');
1331 print
"<tr><td>".$langs->trans(
"PaymentMode").
"</td><td>";
1332 print
img_picto(
'',
'payment',
'class="pictofixedwidth"');
1333 print $form->select_types_paiements((
string) (GETPOSTISSET(
'mode_reglement_id') ?
GETPOSTINT(
'mode_reglement_id') : $sourceInvoice->mode_reglement_id),
'mode_reglement_id',
'', 0, 1, 0, 0, 1,
'', 1);
1338 print
"<tr><td>".$langs->trans(
'DebitBankAccount').
"</td><td>";
1339 $defaultRibId = $sourceInvoice->thirdparty->getDefaultRib();
1340 $form->selectRib(GETPOSTISSET(
'accountcustomerid') ?
GETPOSTINT(
'accountcustomerid') : $defaultRibId,
'accountcustomerid',
'(fk_soc:=:'.$sourceInvoice->socid.
")", 1,
'', 1);
1344 $(document).ready(function() {
1345 if($("#selectmode_reglement_id option:selected").data("code") != "' . $factureRec::PAYMENTCODETOEDITSOCIETERIB .
'") {
1346 hideselectfksocieterib();
1348 $("#selectmode_reglement_id").change(function() {
1349 if($("#selectmode_reglement_id option:selected").data("code") != "'. $factureRec::PAYMENTCODETOEDITSOCIETERIB .
'") {
1350 hideselectfksocieterib(1);
1352 showselectfksocieterib();
1357 function hideselectfksocieterib(empty = 0){
1358 $("#selectaccountcustomerid").closest("tr").hide();
1360 $("#selectaccountcustomerid").val("-1").change();
1364 function showselectfksocieterib(){
1365 $("#selectaccountcustomerid").closest("tr").show();
1370 if ($sourceInvoice->fk_account > 0) {
1371 print
"<tr><td>".$langs->trans(
'BankAccount').
"</td><td>";
1372 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.$sourceInvoice->id, (
string) $sourceInvoice->fk_account,
'none');
1378 print
"<tr><td>".$langs->trans(
"RuleForLinesDates").
"</td><td>";
1379 print $form->getSelectRuleForLinesDates(GETPOSTISSET(
'rule_for_lines_dates') ?
GETPOST(
'rule_for_lines_dates',
'alpha') : $factureRec->rule_for_lines_dates);
1387 $extralabels = $extrafields->fetch_name_optionals_label($draft->table_element);
1388 if ($draft->fetch_optionals() > 0) {
1389 $sourceInvoice->array_options = array_merge($sourceInvoice->array_options, $draft->array_options);
1392 print $sourceInvoice->showOptionals($extrafields,
'create', $parameters);
1395 if (
isModEnabled(
'project') && is_object($sourceInvoice->thirdparty) && $sourceInvoice->thirdparty->id > 0 && is_object($formproject)) {
1396 $projectid =
GETPOST(
'projectid') ?
GETPOST(
'projectid') : $sourceInvoice->fk_project;
1397 $langs->load(
'projects');
1398 print
'<tr><td>'.$langs->trans(
'Project').
'</td><td>';
1399 print
img_picto(
'',
'project',
'class="pictofixedwidth"');
1400 $numprojet = $formproject->select_projects($sourceInvoice->thirdparty->id, $projectid,
'projectid', 0, 0, 1, 0, 0, 0, 0,
'', 0, 0,
'');
1401 print
' <a href="'.DOL_URL_ROOT.
'/projet/card.php?socid='.$sourceInvoice->thirdparty->id.
'&action=create&status=1&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?action=create&socid='.$sourceInvoice->thirdparty->id.(!empty($id) ?
'&id='.$id :
'')).
'">'.
img_object($langs->trans(
"AddProject"),
'add').
'</a>';
1406 print
"<tr><td>".$langs->trans(
'Model').
"</td><td>";
1407 include_once DOL_DOCUMENT_ROOT.
'/core/modules/facture/modules_facture.php';
1409 print
img_picto(
'',
'generic',
'class="pictofixedwidth"');
1411 print $form->selectarray(
'modelpdf', $list,
$conf->global->FACTURE_ADDON_PDF);
1416 print
'<td class="tdtop">';
1417 print $form->textwithpicto($langs->trans(
'NotePublic'), $htmltext, 1,
'help',
'', 0, 2,
'notepublic');
1420 $doleditor =
new DolEditor(
'note_public', $note_public,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1421 print $doleditor->Create(1);
1424 if (empty($user->socid)) {
1426 print
'<td class="tdtop">';
1427 print $form->textwithpicto($langs->trans(
'NotePrivate'), $htmltext, 1,
'help',
'', 0, 2,
'noteprivate');
1430 $doleditor =
new DolEditor(
'note_private', $note_private,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1431 print $doleditor->Create(1);
1441 $title = $langs->trans(
"Recurrence");
1444 print
'<span class="opacitymedium">'.$langs->trans(
"ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv(
'Module2300Name')).
'</span><br><br>';
1448 print
'<table class="border centpercent">';
1451 print
'<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans(
"Frequency"), $langs->transnoentitiesnoconv(
'toolTipFrequency')).
"</td><td>";
1452 print
'<input type="text" class="width50" name="frequency" value="'.GETPOST(
'frequency',
'int').
'"> ';
1453 print $form->selectarray(
'unit_frequency', array(
'd' => $langs->trans(
'Day'),
'm' => $langs->trans(
'Month'),
'y' => $langs->trans(
'Year')), (
GETPOST(
'unit_frequency') ?
GETPOST(
'unit_frequency') :
'm'));
1457 print
"<tr><td>".$form->textwithpicto($langs->trans(
'NextDateToExecution'), $langs->trans(
"NextDateToExecutionHelp")).
"</td><td>";
1459 print $form->selectDate($date_next_execution,
'', 1, 1, 0,
"add", 1, 1);
1463 print
"<tr><td>".$langs->trans(
"MaxPeriodNumber").
"</td><td>";
1464 print
'<input type="text" class="width50" name="nb_gen_max" value="'.GETPOSTINT(
'nb_gen_max').
'">';
1468 print
"<tr><td>".$langs->trans(
"StatusOfAutoGeneratedInvoices").
"</td><td>";
1469 $select = array(
'0' => $langs->trans(
'BillStatusDraft'),
'1' => $langs->trans(
'BillStatusValidated'),
'2' => $langs->trans(
'BillStatusValidatedWithSendind'));
1470 print $form->selectarray(
'auto_validate', $select,
GETPOSTINT(
'auto_validate'));
1474 print
"<tr id='col_auto_send_model_mail' class='".(GETPOSTINT(
'auto_validate') != 2 ?
'hidden' :
'').
"'><td>" . $langs->trans(
"EmailTemplateForAutoSend") .
"</td><td>";
1475 print $form->selectModelMail(
"auto_send_",
"facture_send", 1, 0,
GETPOSTINT(
'auto_send_model_mail'));
1478 $(document).ready(function() {
1479 $('#auto_validate').on('change', function () {
1480 if(+$(this).val() === 2) {
1481 $('#col_auto_send_model_mail').show();
1483 $('#col_auto_send_model_mail').hide();
1484 $('#select_auto_send_model_mail').val(0);
1492 print
"<tr><td>".$langs->trans(
"StatusOfGeneratedDocuments").
"</td><td>";
1493 $select = array(
'0' => $langs->trans(
'DoNotGenerateDoc'),
'1' => $langs->trans(
'AutoGenerateDoc'));
1494 print $form->selectarray(
'generate_pdf', $select,
GETPOSTINT(
'generate_pdf'));
1497 print
'<input type="hidden" name="generate_pdf" value="1">';
1505 $title = $langs->trans(
"ProductsAndServices");
1507 $title = $langs->trans(
"Products");
1509 $title = $langs->trans(
"Services");
1517 print
'<div class="div-table-responsive-no-min">';
1518 print
'<table id="tablelines" class="noborder noshadow centpercent nomarginbottom">';
1521 if (!empty($sourceInvoice->lines)) {
1522 $sourceInvoice->printOriginLinesList(
'', $selectedLines);
1531 if (!empty($flag_price_may_change)) {
1532 print
'<tr><td colspan="3" class="left">';
1533 print
'<select name="usenewprice" class="flat">';
1534 print
'<option value="0">'.$langs->trans(
"AlwaysUseFixedPrice").
'</option>';
1535 print
'<option value="1" disabled>'.$langs->trans(
"AlwaysUseNewPrice").
'</option>';
1543 print $form->buttonsSaveCancel(
"Create");
1556 if ($action ==
'ask_deleteline') {
1557 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$lineid, $langs->trans(
'DeleteProductLine'), $langs->trans(
'ConfirmDeleteProductLine'),
'confirm_deleteline',
'',
'no', 1);
1560 if ($action ==
'delete') {
1561 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteRepeatableInvoice'), $langs->trans(
'ConfirmDeleteRepeatableInvoice'),
'confirm_delete',
'',
'no', 1);
1564 if ($action ==
'ask_subtotal_deleteline') {
1565 $langs->load(
"subtotals");
1566 $title =
"DeleteSubtotalLine";
1567 $question =
"ConfirmDeleteSubtotalLine";
1568 if (
GETPOST(
'type') ==
'title') {
1569 $formconfirm = array(array(
'type' =>
'checkbox',
'name' =>
'deletecorrespondingsubtotalline',
'label' => $langs->trans(
"DeleteCorrespondingSubtotalLine"),
'value' => 0));
1570 $title =
"DeleteTitleLine";
1571 $question =
"ConfirmDeleteTitleLine";
1573 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$lineid, $langs->trans($title), $langs->trans($question),
'confirm_delete_subtotalline', $formconfirm,
'no', 1);
1577 if ($action ==
'add_title_line') {
1578 $langs->load(
'subtotals');
1580 $depth_array =
$object->getPossibleLevels($langs);
1582 } elseif ($action ==
'add_subtotal_line') {
1583 $langs->load(
'subtotals');
1585 $titles =
$object->getPossibleTitles();
1590 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
1591 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
1592 if (empty($reshook)) {
1593 $formconfirm .= $hookmanager->resPrint;
1594 } elseif ($reshook > 0) {
1595 $formconfirm = $hookmanager->resPrint;
1601 $author->fetch(
$object->user_creation_id);
1609 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/facture/invoicetemplate_list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1612 if ($action !=
'editref') {
1613 $morehtmlref .= $form->editfieldkey(
$object->ref,
'ref',
$object->ref, $object, $user->hasRight(
'facture',
'creer'),
'',
'', 0, 2);
1615 $morehtmlref .= $form->editfieldval(
'',
'ref',
$object->ref, $object, $user->hasRight(
'facture',
'creer'),
'string');
1618 $morehtmlref .=
'<div class="refidno">';
1623 $morehtmlref .=
$object->thirdparty->getNomUrl(1,
'customer');
1626 $langs->load(
"projects");
1627 $morehtmlref .=
'<br>';
1628 if ($user->hasRight(
'facture',
'creer')) {
1629 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1630 if ($action !=
'classify') {
1631 $morehtmlref .=
'<a class="editfielda" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'action' =>
'classify',
'id' =>
$object->id],
true).
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1633 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->socid, (
string)
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
1635 if (!empty(
$object->fk_project)) {
1637 $proj->fetch(
$object->fk_project);
1638 $morehtmlref .=
' : '.$proj->getNomUrl(1);
1640 $morehtmlref .=
' - '.$proj->title;
1647 $morehtmlref .=
'</div>';
1649 $morehtmlstatus =
'';
1651 dol_banner_tab($object,
'ref', $linkback, 1,
'title',
'none', $morehtmlref,
'', 0,
'', $morehtmlstatus);
1653 print
'<div class="fichecenter">';
1654 print
'<div class="fichehalfleft">';
1655 print
'<div class="underbanner clearboth"></div>';
1657 print
'<table class="border centpercent tableforfield">';
1661 print
"<tr><td>".$langs->trans(
"InvoiceSubtype").
"</td><td>";
1663 print
$object->getSubtypeLabel(
'facture_rec');
1669 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Author").
'</td><td>';
1670 print $author->getNomUrl(-1);
1675 print
'<table class="nobordernopadding centpercent"><tr><td>';
1676 print $langs->trans(
'PaymentConditionsShort');
1678 if ($action !=
'editconditions' && $user->hasRight(
'facture',
'creer')) {
1679 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editconditions&token='.newToken().
'&facid='.
$object->id.
'">'.
img_edit($langs->trans(
'SetConditions'), 1).
'</a></td>';
1681 print
'</tr></table>';
1683 if ($action ==
'editconditions') {
1684 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'].
'?facid='.
$object->id, (
string)
$object->cond_reglement_id,
'cond_reglement_id');
1686 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'].
'?facid='.
$object->id, (
string)
$object->cond_reglement_id,
'none');
1692 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1693 print $langs->trans(
'PaymentMode');
1695 if ($action !=
'editmode' && $user->hasRight(
'facture',
'creer')) {
1696 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editmode&token='.newToken().
'&facid='.
$object->id.
'">'.
img_edit($langs->trans(
'SetMode'), 1).
'</a></td>';
1698 print
'</tr></table>';
1700 if ($action ==
'editmode') {
1701 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?facid='.
$object->id, (
string)
$object->mode_reglement_id,
'mode_reglement_id',
'CRDT', 1, 1);
1703 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?facid='.
$object->id, (
string)
$object->mode_reglement_id,
'none');
1709 if (
$object->mode_reglement_code == $object::PAYMENTCODETOEDITSOCIETERIB) {
1710 print
'<tr><td class="nowrap">';
1711 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
1712 print $langs->trans(
'DebitBankAccount');
1716 print
'<td class="right"><a class="editfielda" href="' . $_SERVER[
"PHP_SELF"] .
'?action=editbankaccountcustomer&token=' . newToken() .
'&id=' .
$object->id .
'">' .
img_edit($langs->trans(
'SetDebitBankAccount'), 1) .
'</a></td>';
1718 print
'</tr></table>';
1721 if ($action ==
'editbankaccountcustomer') {
1722 $form->formRib($_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id, (
string)
$object->fk_societe_rib,
'accountcustomerid',
'fk_soc='.$object->socid, 1, 1);
1724 $form->formRib($_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id, (
string)
$object->fk_societe_rib,
'none',
'', 0, 1);
1731 print
'<tr><td class="nowrap">';
1732 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
1733 print $langs->trans(
'BankAccount');
1736 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editbankaccount&token='.newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->trans(
'SetBankAccount'), 1).
'</a></td>';
1738 print
'</tr></table>';
1740 if ($action ==
'editbankaccount') {
1741 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
string)
$object->fk_account,
'fk_account', 1);
1743 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
string)
$object->fk_account,
'none');
1751 print
'<table class="nobordernopadding centpercent"><tr><td>';
1752 print $langs->trans(
'RuleForLinesDates');
1754 if ($action !=
'editruleforlinesdates' && $user->hasRight(
'facture',
'creer')) {
1755 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editruleforlinesdates&token='.newToken().
'&facid='.
$object->id.
'">'.
img_edit($langs->trans(
'SetRuleForLinesDates'), 1).
'</a></td>';
1757 print
'</tr></table>';
1759 if ($action ==
'editruleforlinesdates') {
1760 $form->form_rule_for_lines_dates($_SERVER[
'PHP_SELF'].
'?facid='.
$object->id,
$object->rule_for_lines_dates,
'rule_for_lines_dates');
1762 $form->form_rule_for_lines_dates($_SERVER[
'PHP_SELF'].
'?facid='.
$object->id,
$object->rule_for_lines_dates,
'none');
1768 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1771 print
'<tr><td class="nowrap">';
1772 print
'<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
1773 print $langs->trans(
'Model');
1776 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editmodelpdf&token='.newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->trans(
'SetModel'), 1).
'</a></td>';
1778 print
'</tr></table>';
1780 if ($action ==
'editmodelpdf') {
1781 include_once DOL_DOCUMENT_ROOT.
'/core/modules/facture/modules_facture.php';
1784 foreach ($models as $k => $model) {
1785 $list[] = str_replace(
':',
'|', $k).
':'.$model;
1787 $select =
'select;'.implode(
',', $list);
1788 print $form->editfieldval($langs->trans(
"Model"),
'modelpdf',
$object->model_pdf, $object, $user->hasRight(
'facture',
'creer'), $select);
1802 print
'<div class="fichehalfright">';
1804 print
'<!-- amounts -->'.
"\n";
1805 print
'<div class="underbanner clearboth"></div>'.
"\n";
1808 $title = $langs->trans(
"Recurrence");
1810 print
'<table class="border tableforfield centpercent">';
1812 include DOL_DOCUMENT_ROOT.
'/core/tpl/object_currency_amount.tpl.php';
1820 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"AmountHT").
'</td>';
1821 print
'<td class="nowraponall amountcard right">'.price($sign *
$object->total_ht, 0, $langs, 1, -1, -1,
$conf->currency).
'</td>';
1824 print
'<td class="nowraponall amountcard right">' .
price($sign *
$object->multicurrency_total_ht, 0, $langs, 0, -1, -1,
$object->multicurrency_code) .
'</td>';
1829 print
'<tr><td>'.$langs->trans(
"AmountVAT").
'</td>';
1830 print
'<td class="nowrap amountcard right">'.price($sign *
$object->total_tva, 0, $langs, 1, -1, -1,
$conf->currency).
'</td>';
1833 print
'<td class="nowraponall amountcard right">' .
price($sign *
$object->multicurrency_total_tva, 0, $langs, 0, -1, -1,
$object->multicurrency_code) .
'</td>';
1838 if ((
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->useLocalTax(1)) ||
$object->total_localtax1 != 0) {
1840 print
'<td class="titlefieldmiddle">'.$langs->transcountry(
"AmountLT1",
$mysoc->country_code).
'</td>';
1841 print
'<td class="nowraponall amountcard right">'.price($sign *
$object->total_localtax1, 1,
'', 1, - 1, - 1,
$conf->currency).
'</td></tr>';
1845 print
'<td class="nowraponall amountcard right">' .
price($sign *
$object->multicurrency_total_localtax1, 0, $langs, 0, -1, -1,
$object->multicurrency_code) .
'</td>';
1850 if ((
$mysoc->localtax2_assuj ==
"1" &&
$mysoc->useLocalTax(2)) ||
$object->total_localtax2 != 0) {
1852 print
'<td>'.$langs->transcountry(
"AmountLT2",
$mysoc->country_code).
'</td>';
1853 print
'<td class=nowraponall amountcard right">'.price($sign *
$object->total_localtax2, 1,
'', 1, - 1, - 1,
$conf->currency).
'</td></tr>';
1857 print
'<td class="nowraponall amountcard right">' .
price($sign *
$object->multicurrency_total_localtax2, 0, $langs, 0, -1, -1,
$object->multicurrency_code) .
'</td>';
1918 print
'<tr><td>'.$langs->trans(
"AmountTTC").
'</td><td class="nowraponall amountcard right">'.
price($sign *
$object->total_ttc, 0, $langs, 1, -1, -1,
$conf->currency).
'</td>';
1921 print
'<td class="nowrap amountcard right">' .
price($sign *
$object->multicurrency_total_ttc, 0, $langs, 0, -1, -1,
$object->multicurrency_code) .
'</td>';
1926 print
'<tr class="liste_titre"><td class="liste_titre">'.img_picto(
'',
'recurring',
'class="pictofixedwidth"').$title.
'</td>';
1934 print
'<tr><td style="width: 50%">';
1935 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1936 print $langs->trans(
'Frequency');
1938 if ($action !=
'editfrequency' && $user->hasRight(
'facture',
'creer')) {
1939 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editfrequency&token='.newToken().
'&facid='.
$object->id.
'">'.
img_edit($langs->trans(
'Edit'), 1).
'</a></td>';
1941 print
'</tr></table>';
1943 if ($action ==
'editfrequency') {
1944 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'?facid='.
$object->id.
'">';
1945 print
'<input type="hidden" name="action" value="setfrequency">';
1946 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1947 print
'<table class="nobordernopadding">';
1949 print
'<input type="text" name="frequency" class="width50 marginrightonly right" value="'.$object->frequency.
'">';
1950 print $form->selectarray(
'unit_frequency', array(
'd' => $langs->trans(
'Day'),
'm' => $langs->trans(
'Month'),
'y' => $langs->trans(
'Year')), (
$object->unit_frequency ?
$object->unit_frequency :
'm'));
1952 print
'<td class="left"><input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
"Modify").
'"></td>';
1953 print
'</tr></table></form>';
1956 print $langs->trans(
'FrequencyPer_'.
$object->unit_frequency,
$object->frequency);
1958 print
'<span class="opacitymedium">'.$langs->trans(
"NotARecurringInvoiceTemplate").
'</span>';
1970 if ($action ==
'date_when' ||
$object->frequency > 0) {
1971 print $form->editfieldkey($form->textwithpicto($langs->trans(
"NextDateToExecution"), $langs->trans(
"NextDateToExecutionHelp")),
'date_when',
$object->date_when, $object, $user->hasRight(
'facture',
'creer'),
'day');
1973 print $form->textwithpicto($langs->trans(
"NextDateToExecution"), $langs->trans(
"NextDateToExecutionHelp"));
1976 if ($action ==
'date_when' ||
$object->frequency > 0) {
1977 print $form->editfieldval($langs->trans(
"NextDateToExecution"),
'date_when',
$object->date_when, $object, $user->hasRight(
'facture',
'creer'),
'day',
$object->date_when,
null,
'',
'', 0,
'strikeIfMaxNbGenReached');
1980 if (!
$object->isMaxNbGenReached()) {
1985 print
img_info($langs->trans(
"MaxNumberOfGenerationReached"));
1995 if ($action ==
'nb_gen_max' ||
$object->frequency > 0) {
1996 print $form->editfieldkey($langs->trans(
"MaxPeriodNumber"),
'nb_gen_max', (
string)
$object->nb_gen_max, $object, $user->hasRight(
'facture',
'creer'));
1998 print $langs->trans(
"MaxPeriodNumber");
2001 if ($action ==
'nb_gen_max' ||
$object->frequency > 0) {
2002 print $form->editfieldval($langs->trans(
"MaxPeriodNumber"),
'nb_gen_max',
$object->nb_gen_max ?
$object->nb_gen_max :
'',
$object, $user->hasRight(
'facture',
'creer'));
2014 if ($action ==
'auto_validate' ||
$object->frequency > 0) {
2015 print $form->editfieldkey($langs->trans(
"StatusOfAutoGeneratedInvoices"),
'auto_validate', (
string)
$object->auto_validate, $object, $user->hasRight(
'facture',
'creer'));
2017 print $langs->trans(
"StatusOfAutoGeneratedInvoices");
2020 $select =
'select;0:' . $langs->trans(
'BillStatusDraft') .
',1:' . $langs->trans(
'BillStatusValidated') .
',2:' . $langs->trans(
'BillStatusValidatedWithSendind');
2021 if ($action ==
'auto_validate' ||
$object->frequency > 0) {
2022 print $form->editfieldval($langs->trans(
"StatusOfAutoGeneratedInvoices"),
'auto_validate',
$object->auto_validate, $object, $user->hasRight(
'facture',
'creer'), $select);
2032 print
'<tr><td style="width: 50%">';
2033 print
'<table class="nobordernopadding" width="100%"><tr><td>';
2034 print $langs->trans(
"EmailTemplateForAutoSend");
2036 if ($action !=
'editEmailTemplate' && $user->hasRight(
'facture',
'creer')) {
2037 print
'<td class="right"><a class="editfielda" href="' . $_SERVER[
"PHP_SELF"] .
'?action=editEmailTemplate&token=' . newToken() .
'&facid=' .
$object->id .
'">' .
img_edit($langs->trans(
'Edit'), 1) .
'</a></td>';
2039 print
'</tr></table>';
2042 if ($action ==
'editEmailTemplate') {
2044 print
'<form method="POST" action="' . $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'">';
2045 print
'<input type="hidden" name="token" value="' . newToken() .
'">';
2046 print
'<input type="hidden" name="action" value="setEmailTemplate">';
2047 print $form->selectModelMail(
"auto_send_",
"facture_send", 1, 0,
$object->fk_email_template);
2048 print
'<input type="submit" class="button valignmiddle smallpaddingimp" name="modify" value="' . $langs->trans(
"Modify") .
'">';
2049 print
'<input type="submit" class="button button-cancel valignmiddle smallpaddingimp" name="cancel" value="' . $langs->trans(
"Cancel") .
'">';
2053 if (!empty(
$object->fk_email_template)) {
2054 $sql =
"SELECT label
2055 FROM ".$db->prefix().
"c_email_templates
2056 WHERE rowid = ".((int)
$object->fk_email_template);
2057 $result =
$db->query($sql);
2059 if ($obj =
$db->fetch_object($result)) {
2064 print $langs->trans(
'DefaultMailModel');
2076 if ($action ==
'generate_pdf' ||
$object->frequency > 0) {
2077 print $form->editfieldkey($langs->trans(
"StatusOfGeneratedDocuments"),
'generate_pdf', (
string)
$object->generate_pdf, $object, $user->hasRight(
'facture',
'creer'));
2079 print $langs->trans(
"StatusOfGeneratedDocuments");
2083 $select =
'select;0:'.$langs->trans(
'DoNotGenerateDoc').
',1:'.$langs->trans(
'AutogenerateDoc');
2084 if ($action ==
'generate_pdf' ||
$object->frequency > 0) {
2085 print $form->editfieldval($langs->trans(
"StatusOfGeneratedDocuments"),
'generate_pdf',
$object->generate_pdf,
$object, $user->hasRight(
'facture',
'creer'), $select);
2093 print
'<input type="hidden" name="generate_pdf" value="1">';
2104 print
info_admin($langs->trans(
"EnableAndSetupModuleCron", $langs->transnoentitiesnoconv(
"Module2300Name")));
2107 print
'<div class="underbanner clearboth"></div>';
2108 print
'<table class="border centpercent tableforfield">';
2111 print
'<tr><td style="width: 50%">'.$langs->trans(
"NbOfGenerationDone").
'</td>';
2119 print $langs->trans(
"DateLastGeneration");
2133 print
'<div class="clearboth"></div><br>';
2137 print
'<form name="addproduct" id="addproduct" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.(($action !=
'editline') ?
'#add' :
'#line_'.
GETPOSTINT(
'lineid')).
'" method="POST">';
2138 print
'<input type="hidden" name="token" value="' . newToken().
'">';
2139 print
'<input type="hidden" name="action" value="' . (($action !=
'editline') ?
'addline' :
'updateline').
'">';
2140 print
'<input type="hidden" name="mode" value="">';
2141 print
'<input type="hidden" name="id" value="' .
$object->id.
'">';
2142 print
'<input type="hidden" name="page_y" value="">';
2144 if (!empty(
$conf->use_javascript_ajax) &&
$object->statut == 0) {
2146 include DOL_DOCUMENT_ROOT.
'/core/tpl/subtotal_ajaxrow.tpl.php';
2148 include DOL_DOCUMENT_ROOT .
'/core/tpl/ajaxrow.tpl.php';
2152 print
'<div class="div-table-responsive-no-min">';
2153 print
'<table id="tablelines" class="noborder noshadow centpercent nomarginbottom">';
2156 $canchangeproduct = 1;
2161 if (
$object->status == $object::STATUS_DRAFT && $user->hasRight(
'facture',
'creer') && $action !=
'valid' && $action !=
'editline') {
2162 if ($action !=
'editline') {
2165 $parameters = array();
2166 $reshook = $hookmanager->executeHooks(
'formAddObjectLine', $parameters, $object, $action);
2170 if (empty($reshook)) {
2187 print
'<div class="tabsAction">';
2189 $parameters = array();
2190 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
2191 if (empty($reshook)) {
2194 'class' =>
'classfortooltip',
2201 $langs->load(
"subtotals");
2203 $url_button = array();
2205 $url_button[] = array(
2206 'lang' =>
'subtotals',
2208 'perm' => (
bool) $usercancreate,
2209 'label' => $langs->trans(
'AddTitleLine'),
2210 'url' =>
'/compta/facture/card-rec.php?id='.$object->id.
'&action=add_title_line&token='.newToken()
2213 $url_button[] = array(
2214 'lang' =>
'subtotals',
2216 'perm' => (
bool) $usercancreate,
2217 'label' => $langs->trans(
'AddSubtotalLine'),
2218 'url' =>
'/compta/facture/card-rec.php?id='.$object->id.
'&action=add_subtotal_line&token='.newToken()
2220 print dolGetButtonAction(
'', $langs->trans(
'Subtotal'),
'default', $url_button,
'',
true);
2223 if (empty(
$object->suspended)) {
2224 if ($user->hasRight(
'facture',
'creer')) {
2226 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' .
dol_escape_htmltag($langs->trans(
"MaxGenerationReached")) .
'">' . $langs->trans(
"CreateBill") .
'</a></div>';
2228 if (empty(
$object->frequency) ||
$object->date_when <= $nowlasthour) {
2229 print
'<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT .
'/compta/facture/card.php?action=create&socid=' .
$object->thirdparty->id .
'&fac_rec=' .
$object->id .
'">' . $langs->trans(
"CreateBill") .
'</a></div>';
2231 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' .
dol_escape_htmltag($langs->trans(
"DateIsNotEnough")) .
'">' . $langs->trans(
"CreateBill") .
'</a></div>';
2235 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans(
"CreateBill") .
'</a></div>';
2239 if ($user->hasRight(
'facture',
'creer')) {
2240 if (empty(
$object->suspended)) {
2241 print
'<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?action=disable&id='.
$object->id.
'&token='.newToken().
'">'.$langs->trans(
"Disable").
'</a></div>';
2243 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=enable&id='.
$object->id.
'&token='.newToken().
'">'.$langs->trans(
"Enable").
'</a></div>';
2248 print dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id .
'&action=delete&token=' . newToken(),
'delete', $user->hasRight(
'facture',
'supprimer'));
2254 print
'<div class="fichecenter"><div class="fichehalfleft">';
2255 print
'<a name="builddoc"></a>';
2259 $tmparray = $form->showLinkToObjectBlock($object, array(), array(
'invoice'), 1);
2260 $linktoelem = $tmparray[
'linktoelem'];
2261 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
2262 print $htmltoenteralink;
2264 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
2268 print
'<div class="fichehalfright">';
2272 $morehtmlcenter =
'<div class="nowraponall">';
2274 $morehtmlcenter .= dolGetButtonTitle($langs->trans(
'FullList'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/compta/facture/agenda-rec.php?id='.
$object->id);
2275 $morehtmlcenter .=
'</div>';
2278 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2280 $somethingshown = $formactions->showactions($object,
$object->element, (is_object(
$object->thirdparty) ?
$object->thirdparty->id : 0), 1,
'', $MAXEVENT,
'', $morehtmlcenter);
2285 print $langs->trans(
"NoRecordFound");
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
const STATUS_DRAFT
Draft status.
Class to manage a WYSIWYG editor.
Class to manage invoices.
const TYPE_REPLACEMENT
Replacement invoice.
const STATUS_DRAFT
Draft status.
const TYPE_STANDARD
Standard invoice.
Class to manage invoice lines of templates.
Class to manage invoice templates.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
Class to manage products or services.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_get_last_hour($date, $gm='tzserver')
Return GMT time for last hour of a given GMT date (it replaces hours, min and second part to 23:59:59...
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
$date_start
Variables from include:
dol_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='')
Show information in HTML for admin users or standard users.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
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.
dol_htmlcleanlastbr($stringtodecode)
This function remove all ending and br at end.
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...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
get_localtax($vatrate, $local, $thirdparty_buyer=null, $thirdparty_seller=null, $vatnpr=0)
Return localtax rate for a particular VAT rate, when selling a product with vat $vatrate,...
img_info($titlealt='default')
Show info logo.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
invoice_rec_prepare_head($object)
Return array head with list of tabs to view object information.
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.