36require
'../../main.inc.php';
45require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
49 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/lib/invoice.lib.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
57$langs->loadLangs(array(
'bills',
'companies',
'compta',
'admin',
'other',
'products',
'banks'));
59$action =
GETPOST(
'action',
'aZ09');
60$massaction =
GETPOST(
'massaction',
'alpha');
62$confirm =
GETPOST(
'confirm',
'alpha');
63$cancel =
GETPOST(
'cancel',
'alpha');
64$toselect =
GETPOST(
'toselect',
'array:int');
65$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'invoicetemplatelist';
66$backtopage =
GETPOST(
'backtopage',
'alpha');
67$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
75 $socid = $user->socid;
77$objecttype =
'facture_rec';
78if ($action ==
"create" || $action ==
"add") {
83$year_date_when =
GETPOST(
'year_date_when');
84$month_date_when =
GETPOST(
'month_date_when');
85$selectedLines =
GETPOST(
'toselect',
'array:int');
88$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
89$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
91if (empty($page) || $page == -1) {
94$offset = $limit * $page;
99 $sortfield =
'f.titre';
101$pageprev = $page - 1;
102$pagenext = $page + 1;
105if (($id > 0 || $ref) && $action !=
'create' && $action !=
'add') {
106 $ret =
$object->fetch($id, $ref);
116$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;
274 $object->fk_project = $projectid;
276 $date_next_execution =
dol_mktime($rehour, $remin, 0, $remonth, $reday, $reyear);
277 $object->date_when = $date_next_execution;
279 $ret = $extrafields->setOptionalsFromPost(
null, $object);
290 $srcObject->fetchObjectLinked();
292 if (!empty($srcObject->linkedObjectsIds[
'contrat'])) {
293 $contractidid = reset($srcObject->linkedObjectsIds[
'contrat']);
295 $object->origin_type =
'contrat';
296 $object->origin_id = $contractidid;
298 } elseif (!empty($srcObject->linkedObjectsIds[
'commande'])) {
299 $orderid = reset($srcObject->linkedObjectsIds[
'commande']);
301 $object->linked_objects[
'commande'] = $orderid;
302 } elseif (!empty($srcObject->linkedObjectsIds[
'propal'])) {
303 $proposalid = reset($srcObject->linkedObjectsIds[
'propal']);
304 $object->linked_objects[
'propal'] = $proposalid;
310 $oldinvoice =
new Facture($db);
313 $onlylines =
GETPOST(
'toselect',
'array:int');
315 $result =
$object->create($user, $oldinvoice->id, 0, $onlylines);
317 $result = $oldinvoice->delete($user, 1);
332 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?facid='.
$object->id);
343 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'facture',
'supprimer')) {
346 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/invoicetemplate_list.php');
352 if ($action ==
'setconditions' && $usercancreate) {
354 $object->context[
'actionmsg'] = $langs->trans(
"FieldXModified", $langs->transnoentitiesnoconv(
"PaymentTerm"));
356 } elseif ($action ==
'setmode' && $usercancreate) {
358 $object->context[
'actionmsg'] = $langs->trans(
"FieldXModified", $langs->transnoentitiesnoconv(
"PaymentMode"));
360 $object->setValueFrom(
'fk_societe_rib', 0);
363 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?facid='.
$object->id);
365 } elseif ($action ==
'classin' && $usercancreate) {
367 $object->context[
'actionmsg'] = $langs->trans(
"FieldXModified", $langs->transnoentitiesnoconv(
"Project"));
369 } elseif ($action ==
'setref' && $usercancreate) {
371 $object->context[
'actionmsg'] = $langs->trans(
"FieldXModifiedFromYToZ", $langs->transnoentitiesnoconv(
"Title"),
$object->title, $ref);
372 $result =
$object->setValueFrom(
'titre', $ref,
'',
null,
'text',
'', $user,
'BILLREC_MODIFY');
378 if (
$object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
379 $langs->load(
"errors");
380 setEventMessages($langs->trans(
'ErrorRefAlreadyExists', $ref),
null,
'errors');
385 } elseif ($action ==
'setbankaccount' && $usercancreate) {
387 $object->context[
'actionmsg'] = $langs->trans(
"FieldXModified", $langs->transnoentitiesnoconv(
"Bank"));
389 } elseif ($action ==
'setbankaccountcustomer' && $usercancreate) {
391 $object->context[
'actionmsg'] = $langs->trans(
"FieldXModified", $langs->transnoentitiesnoconv(
"DebitBankAccount"));
392 $fk_societe_rib = (
GETPOSTINT(
'accountcustomerid') !=
"-1") ?
GETPOSTINT(
'accountcustomerid') : 0;
393 $result =
$object->setValueFrom(
'fk_societe_rib', $fk_societe_rib);
394 } elseif ($action ==
'setfrequency' && $usercancreate) {
396 $object->context[
'actionmsg'] = $langs->trans(
"FieldXModified", $langs->transnoentitiesnoconv(
"Frequency"));
398 } elseif ($action ==
'setdate_when' && $usercancreate) {
404 } elseif ($action ==
'setnb_gen_max' && $usercancreate) {
407 } elseif ($action ==
'setauto_validate' && $usercancreate) {
410 } elseif ($action ==
'setgenerate_pdf' && $usercancreate) {
413 } elseif ($action ==
'setmodelpdf' && $usercancreate) {
416 } elseif ($action ==
'disable' && $usercancreate) {
420 $object->context[
'actionmsg'] = $langs->trans(
"RecordDisabled");
422 $res =
$object->setValueFrom(
'suspended', 1,
'',
null,
'text',
'', $user,
'BILLREC_MODIFY');
433 } elseif ($action ==
'enable' && $usercancreate) {
437 $object->context[
'actionmsg'] = $langs->trans(
"RecordEnabled");
439 $res =
$object->setValueFrom(
'suspended', 0,
'',
null,
'text',
'', $user,
'BILLREC_MODIFY');
450 } elseif ($action ==
'setmulticurrencycode' && $usercancreate) {
452 $result =
$object->setMulticurrencyCode(
GETPOST(
'multicurrency_code',
'alpha'));
454 } elseif ($action ==
'setmulticurrencyrate' && $usercancreate) {
458 } elseif ($action ==
'setruleforlinesdates' && $usercancreate) {
459 $object->context[
'actionmsg'] = $langs->trans(
"FieldXModified", $langs->transnoentitiesnoconv(
"RuleForLinesDates"));
460 $ruleForLinesDates = GETPOSTISSET(
'rule_for_lines_dates') ?
GETPOST(
'rule_for_lines_dates',
'alpha') :
'prepaid';
461 $object->setValueFrom(
'rule_for_lines_dates', $ruleForLinesDates);
465 if ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $usercancreate) {
476 if ($line->delete($user) > 0) {
477 $result =
$object->update_price(1);
490 } elseif ($action ==
'confirm_delete_subtotalline' && $confirm ==
'yes' && $usercancreate) {
495 $result =
$object->deleteSubtotalLine($langs,
GETPOSTINT(
'lineid'), (
bool)
GETPOST(
'deletecorrespondingsubtotalline'), $user);
497 $result =
$object->update_price(1);
502 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
512 } elseif ($action ==
'update_extras' && $permissiontoeditextra) {
515 $attribute_name =
GETPOST(
'attribute',
'aZ09');
518 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
524 $result =
$object->updateExtraField($attribute_name,
'BILLREC_MODIFY');
532 $action =
'edit_extras';
537 if ($action ==
'addline' && $usercancreate) {
538 $langs->load(
'errors');
543 $product_desc = (GETPOSTISSET(
'dp_desc') ?
GETPOST(
'dp_desc',
'restricthtml') :
'');
546 $prod_entry_mode =
GETPOST(
'prod_entry_mode',
'alpha');
547 if ($prod_entry_mode ==
'free') {
553 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ProductOrService")),
null,
'errors');
558 $tva_tx = (
GETPOST(
'tva_tx',
'alpha') ?
GETPOST(
'tva_tx',
'alpha') : 0);
562 if (empty($remise_percent)) {
567 $extralabelsline = $extrafields->fetch_name_optionals_label(
$object->table_element_line);
568 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line, $predef);
570 if (is_array($extralabelsline)) {
572 foreach ($extralabelsline as $key => $value) {
573 unset($_POST[
"options_".$key.$predef]);
577 if ((empty($idprod) || $idprod < 0) && ($price_ht < 0) && ((
float) $qty < 0)) {
578 setEventMessages($langs->trans(
'ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv(
'UnitPriceHT'), $langs->transnoentitiesnoconv(
'Qty')),
null,
'errors');
581 if ($prod_entry_mode ==
'free' && (empty($idprod) || $idprod < 0) &&
GETPOST(
'type') < 0) {
582 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Type')),
null,
'errors');
585 if ($prod_entry_mode ==
'free' && (empty($idprod) || $idprod < 0) && (!($price_ht >= 0) || $price_ht ==
'')) {
586 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"UnitPriceHT")),
null,
'errors');
590 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Qty')),
null,
'errors');
593 if ($prod_entry_mode ==
'free' && (empty($idprod) || $idprod < 0) && empty($product_desc)) {
594 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Description')),
null,
'errors');
598 $langs->load(
"errors");
599 setEventMessages($langs->trans(
'ErrorQtyForCustomerInvoiceCantBeNegative'),
null,
'errors');
603 if (!$error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) {
609 $ret =
$object->fetch_thirdparty();
614 $price_base_type = (
GETPOST(
'price_base_type',
'alpha') ?
GETPOST(
'price_base_type',
'alpha') :
'HT');
625 if (!empty($idprod) && $idprod > 0) {
627 $prod->fetch($idprod);
629 $label = ((
GETPOST(
'product_label') &&
GETPOST(
'product_label') != $prod->label) ?
GETPOST(
'product_label') :
'');
641 $datapriceofproduct = $prod->getSellPrice(
$mysoc,
$object->thirdparty, $pqp);
643 $pu_ht = $datapriceofproduct[
'pu_ht'];
644 $pu_ttc = $datapriceofproduct[
'pu_ttc'];
645 $price_min = $datapriceofproduct[
'price_min'];
646 $price_base_type = empty($datapriceofproduct[
'price_base_type']) ?
'HT' : $datapriceofproduct[
'price_base_type'];
650 $tmpvat = (float)
price2num(preg_replace(
'/\s*\(.*\)/',
'', $tva_tx));
651 $tmpprodvat =
price2num(preg_replace(
'/\s*\(.*\)/',
'', (
string) $prod->tva_tx));
654 if (!empty($price_ht)) {
656 $pu_ttc =
price2num((
float) $pu_ht * (1 + ($tmpvat / 100)),
'MU');
657 } elseif ($tmpvat != $tmpprodvat) {
660 if ($price_base_type !=
'HT') {
661 $pu_ht =
price2num((
float) $pu_ttc / (1 + ($tmpvat / 100)),
'MU');
663 $pu_ttc =
price2num((
float) $pu_ht * (1 + ($tmpvat / 100)),
'MU');
667 $outputlangs = $langs;
673 if (
GETPOST(
'lang_id',
'aZ09')) {
674 $newlang =
GETPOST(
'lang_id',
'aZ09');
676 if (empty($newlang)) {
677 $newlang =
$object->thirdparty->default_lang;
679 if (!empty($newlang)) {
681 $outputlangs->setDefaultLang($newlang);
682 $outputlangs->load(
'products');
685 $desc = (!empty($prod->multilangs [$outputlangs->defaultlang] [
"description"])) ? $prod->multilangs [$outputlangs->defaultlang] [
"description"] : $prod->
description;
687 $desc = $prod->description;
693 if (!
getDolGlobalString(
'MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE') && (!empty($prod->customcode) || !empty($prod->country_code))) {
697 if (!empty($prod->customcode)) {
698 $tmptxt .= $outputlangs->transnoentitiesnoconv(
"CustomsCode").
': '.$prod->customcode;
700 if (!empty($prod->customcode) && !empty($prod->country_code)) {
703 if (!empty($prod->country_code)) {
704 $tmptxt .= $outputlangs->transnoentitiesnoconv(
"CountryOrigin").
': '.
getCountry($prod->country_code,
'', $db, $outputlangs, 0);
707 if (!empty($prod->customcode)) {
708 $tmptxt .= $langs->transnoentitiesnoconv(
"CustomsCode").
': '.$prod->customcode;
710 if (!empty($prod->customcode) && !empty($prod->country_code)) {
713 if (!empty($prod->country_code)) {
714 $tmptxt .= $langs->transnoentitiesnoconv(
"CountryOrigin").
': '.
getCountry($prod->country_code,
'', $db, $langs, 0);
722 $fk_unit = $prod->fk_unit;
726 $tva_npr = (preg_match(
'/\*/', $tva_tx) ? 1 : 0);
727 $tva_tx = str_replace(
'*',
'', $tva_tx);
728 if (empty($tva_tx)) {
731 $label = (
GETPOST(
'product_label') ?
GETPOST(
'product_label') :
'');
732 $desc = $product_desc;
737 $date_start_fill =
GETPOSTINT(
'date_start_fill');
741 $fournprice = (int) (
GETPOST(
'fournprice'.$predef) ?
GETPOST(
'fournprice'.$predef) :
'');
753 $fk_parent_line =
GETPOSTINT(
'fk_parent_line');
755 if ($usercanproductignorepricemin && (!empty($price_min) && ((
float)
price2num($pu_ht) * (1 - (
float)
price2num($remise_percent) / 100) < (
float)
price2num($price_min)))) {
756 $mesg = $langs->trans(
"CantBeLessThanMinPrice",
price(
price2num($price_min,
'MU'), 0, $langs, 0, 0, -1, $conf->currency));
760 $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, $buyingprice, $fk_parent_line);
765 if ($objectline->fetch($result)) {
766 $objectline->array_options = $array_options;
767 $result = $objectline->insertExtraFields();
793 unset($_POST[
'prod_entry_mode']);
795 unset($_POST[
'qty']);
796 unset($_POST[
'type']);
797 unset($_POST[
'remise_percent']);
798 unset($_POST[
'price_ht']);
799 unset($_POST[
'multicurrency_price_ht']);
800 unset($_POST[
'price_ttc']);
801 unset($_POST[
'tva_tx']);
802 unset($_POST[
'product_ref']);
803 unset($_POST[
'product_label']);
804 unset($_POST[
'product_desc']);
805 unset($_POST[
'fournprice']);
806 unset($_POST[
'buying_price']);
807 unset($_POST[
'np_marginRate']);
808 unset($_POST[
'np_markRate']);
809 unset($_POST[
'dp_desc']);
810 unset($_POST[
'idprod']);
811 unset($_POST[
'units']);
813 unset($_POST[
'date_starthour']);
814 unset($_POST[
'date_startmin']);
815 unset($_POST[
'date_startsec']);
816 unset($_POST[
'date_startday']);
817 unset($_POST[
'date_startmonth']);
818 unset($_POST[
'date_startyear']);
819 unset($_POST[
'date_endhour']);
820 unset($_POST[
'date_endmin']);
821 unset($_POST[
'date_endsec']);
822 unset($_POST[
'date_endday']);
823 unset($_POST[
'date_endmonth']);
824 unset($_POST[
'date_endyear']);
826 unset($_POST[
'date_start_fill']);
827 unset($_POST[
'date_end_fill']);
829 unset($_POST[
'situations']);
830 unset($_POST[
'progress']);
838 } elseif ($action ==
'confirm_addtitleline' && $usercancreate) {
841 $langs->load(
'subtotals');
843 $desc =
GETPOST(
'subtotallinedesc',
'alphanohtml');
844 $depth =
GETPOSTINT(
'subtotallinelevel') ?? 1;
846 $subtotal_options = array();
848 foreach (FactureRec::$TITLE_OPTIONS as $option) {
849 $value =
GETPOST($option,
'alphanohtml');
851 $subtotal_options[$option] = $value ==
'on' ? 1 : $value;
856 $result =
$object->addSubtotalLine($langs, $desc, (
int) $depth, $subtotal_options);
867 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
869 } elseif ($action ==
'confirm_addsubtotalline' && $usercancreate) {
872 $langs->load(
'subtotals');
874 $choosen_line =
GETPOST(
'subtotaltitleline',
'alphanohtml');
875 foreach (
$object->lines as $line) {
876 if ($line->desc == $choosen_line && $line->special_code == SUBTOTALS_SPECIAL_CODE) {
878 $depth = -$line->qty;
882 $subtotal_options = array();
884 foreach (FactureRec::$SUBTOTAL_OPTIONS as $option) {
885 $value =
GETPOST($option,
'alphanohtml');
887 $subtotal_options[$option] = $value ==
'on' ? 1 : $value;
892 if (isset($desc) && isset($depth)) {
893 $result =
$object->addSubtotalLine($langs, $desc, (
int) $depth, $subtotal_options);
895 $object->errors[] = $langs->trans(
"CorrespondingTitleNotFound");
898 if (isset($result) && $result >= 0) {
904 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
906 } elseif ($action ==
'updateline' && $usercancreate && !
GETPOST(
'cancel',
'alpha')) {
907 if (!
$object->fetch($id) > 0) {
930 if (preg_match(
'/\*/', $vat_rate)) {
935 $vat_rate = str_replace(
'*',
'', $vat_rate);
940 $fournprice = (int) (
GETPOST(
'fournprice') ?
GETPOST(
'fournprice') :
'');
944 $pu_equivalent = $pu_ht;
945 $pu_equivalent_ttc = $pu_ttc;
947 $currency_tx =
$object->multicurrency_tx;
951 if ($pu_ht ==
'' && $pu_ht_devise !=
'' && $currency_tx !=
'' && !empty((
float) $currency_tx)) {
952 $pu_equivalent = (float) $pu_ht_devise / (
float) $currency_tx;
954 if ($pu_ttc ==
'' && $pu_ttc_devise !=
'' && $currency_tx !=
'' && !empty((
float) $currency_tx)) {
955 $pu_equivalent_ttc = (float) $pu_ttc_devise / (
float) $currency_tx;
970 $extralabelsline = $extrafields->fetch_name_optionals_label(
$object->table_element_line);
971 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
974 if ($objectline->fetch(
GETPOSTINT(
'lineid'))) {
975 $objectline->array_options = $array_options;
976 $result = $objectline->insertExtraFields();
981 $position = ($objectline->rang >= 0 ? $objectline->rang : 0);
984 if (is_array($extralabelsline)) {
986 foreach ($extralabelsline as $key => $value) {
987 unset($_POST[
"options_".$key]);
993 if ($special_code == 3) {
1006 if (empty($remise_percent)) {
1007 $remise_percent = 0;
1010 $price_base_type =
'HT';
1012 if (empty($pu) && !empty($pu_ttc)) {
1014 $price_base_type =
'TTC';
1019 if (!empty($productid)) {
1021 $product->fetch($productid);
1023 $type = $product->type;
1025 $price_min = $product->price_min;
1027 $price_min = $product->multiprices_min[
$object->thirdparty->price_level];
1029 $price_min_ttc = $product->price_min_ttc;
1031 $price_min_ttc = $product->multiprices_min_ttc[
$object->thirdparty->price_level];
1040 if ($pu_equivalent && $price_min && (((
float)
price2num($pu_equivalent) * (1 - (
float) $remise_percent / 100)) < (float)
price2num($price_min)) && $price_base_type ==
'HT') {
1041 $mesg = $langs->trans(
"CantBeLessThanMinPrice",
price(
price2num($price_min,
'MU'), 0, $langs, 0, 0, -1, $conf->currency));
1044 $action =
'editline';
1045 } 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') {
1046 $mesg = $langs->trans(
"CantBeLessThanMinPriceInclTax",
price(
price2num($price_min_ttc,
'MU'), 0, $langs, 0, 0, -1, $conf->currency));
1049 $action =
'editline';
1054 $label = (
GETPOST(
'product_label') ?
GETPOST(
'product_label') :
'');
1058 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
1063 $langs->load(
"errors");
1064 setEventMessages($langs->trans(
'ErrorQtyForCustomerInvoiceCantBeNegative'),
null,
'errors');
1068 $date_start_fill =
GETPOSTINT(
'date_start_fill');
1069 $date_end_fill =
GETPOSTINT(
'date_end_fill');
1070 $fk_parent_line =
GETPOST(
'fk_parent_line',
'int');
1074 $result =
$object->updateline(
1093 (
float) $pu_ht_devise,
1098 (
float) $buyingprice,
1099 (
int) $fk_parent_line
1122 unset($_POST[
'qty']);
1123 unset($_POST[
'type']);
1124 unset($_POST[
'productid']);
1125 unset($_POST[
'remise_percent']);
1126 unset($_POST[
'price_ht']);
1127 unset($_POST[
'multicurrency_price_ht']);
1128 unset($_POST[
'price_ttc']);
1129 unset($_POST[
'tva_tx']);
1130 unset($_POST[
'product_ref']);
1131 unset($_POST[
'product_label']);
1132 unset($_POST[
'product_desc']);
1133 unset($_POST[
'fournprice']);
1134 unset($_POST[
'buying_price']);
1135 unset($_POST[
'np_marginRate']);
1136 unset($_POST[
'np_markRate']);
1138 unset($_POST[
'dp_desc']);
1139 unset($_POST[
'idprod']);
1140 unset($_POST[
'units']);
1142 unset($_POST[
'date_starthour']);
1143 unset($_POST[
'date_startmin']);
1144 unset($_POST[
'date_startsec']);
1145 unset($_POST[
'date_startday']);
1146 unset($_POST[
'date_startmonth']);
1147 unset($_POST[
'date_startyear']);
1148 unset($_POST[
'date_endhour']);
1149 unset($_POST[
'date_endmin']);
1150 unset($_POST[
'date_endsec']);
1151 unset($_POST[
'date_endday']);
1152 unset($_POST[
'date_endmonth']);
1153 unset($_POST[
'date_endyear']);
1155 unset($_POST[
'situations']);
1156 unset($_POST[
'progress']);
1161 } elseif ($action ==
'updatetitleline' && GETPOSTISSET(
"save") && $usercancreate && !
GETPOST(
'cancel',
'alpha')) {
1164 $langs->load(
'subtotals');
1166 $desc =
GETPOST(
'line_desc',
'alphanohtml') ?? $langs->trans(
"Title");
1169 $subtotal_options = array();
1171 foreach (Facture::$TITLE_OPTIONS as $option) {
1172 $value =
GETPOST($option,
'alphanohtml');
1174 $subtotal_options[$option] = $value ==
'on' ? 1 : $value;
1179 $result =
$object->updateSubtotalLine($langs,
GETPOSTINT(
'lineid'), $desc, $depth, $subtotal_options);
1190 } elseif ($action ==
'updatesubtotalline' && GETPOSTISSET(
"save") && $usercancreate && !
GETPOST(
'cancel',
'alpha')) {
1193 $langs->load(
'subtotals');
1195 $desc =
GETPOST(
'line_desc',
'alphanohtml');
1198 $subtotal_options = array();
1200 foreach (Facture::$SUBTOTAL_OPTIONS as $option) {
1201 $value =
GETPOST($option,
'alphanohtml');
1203 $subtotal_options[$option] = $value ==
'on' ? 1 : $value;
1208 $result =
$object->updateSubtotalLine($langs,
GETPOSTINT(
'lineid'), $desc, $depth, $subtotal_options);
1224$title =
$object->ref.
" - ".$langs->trans(
'Card');
1229$form =
new Form($db);
1234 $formproject =
null;
1236$companystatic =
new Societe($db);
1244if ($action ==
'create') {
1245 print
load_fiche_titre($langs->trans(
"CreateRepeatableInvoice"),
'',
'bill');
1247 $sourceInvoice =
new Facture($db);
1249 $product_static =
new Product($db);
1251 if ($sourceInvoice->fetch($id, $ref) > 0) {
1252 $result = $sourceInvoice->getLinesArray();
1254 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
1255 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1256 print
'<input type="hidden" name="action" value="add">';
1257 print
'<input type="hidden" name="facid" value="'.$sourceInvoice->id.
'">';
1266 if ($sourceInvoice->fk_account > 0) {
1270 print
'<table class="border centpercent">';
1272 $sourceInvoice->fetch_thirdparty();
1275 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Title").
'</td><td>';
1276 print
'<input class="flat quatrevingtpercent" type="text" name="title" value="'.dol_escape_htmltag(
GETPOST(
"title",
'alphanohtml')).
'" autofocus>';
1280 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Customer").
'</td><td>'.$sourceInvoice->thirdparty->getNomUrl(1,
'customer').
'</td>';
1285 print
"<tr><td>".$langs->trans(
"InvoiceSubtype").
"</td><td>";
1286 print $form->getSelectInvoiceSubtype(GETPOSTISSET(
'subtype') ?
GETPOSTINT(
'subtype') : $sourceInvoice->subtype,
'subtype', 0, 0,
'');
1290 $note_public = GETPOSTISSET(
'note_public') ?
GETPOST(
'note_public',
'restricthtml') : $sourceInvoice->note_public;
1291 $note_private = GETPOSTISSET(
'note_private') ?
GETPOST(
'note_private',
'restricthtml') : $sourceInvoice->note_private;
1294 $substitutionarray = getCommonSubstitutionArray($langs, 2,
null, $sourceInvoice);
1296 $substitutionarray[
'__INVOICE_PREVIOUS_MONTH__'] = $langs->trans(
"PreviousMonthOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
dol_time_plus_duree($sourceInvoice->date, -1,
'm'),
'%m').
')';
1297 $substitutionarray[
'__INVOICE_MONTH__'] = $langs->trans(
"MonthOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date($sourceInvoice->date,
'%m').
')';
1298 $substitutionarray[
'__INVOICE_NEXT_MONTH__'] = $langs->trans(
"NextMonthOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
dol_time_plus_duree($sourceInvoice->date, 1,
'm'),
'%m').
')';
1299 $substitutionarray[
'__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans(
"TextPreviousMonthOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
dol_time_plus_duree($sourceInvoice->date, -1,
'm'),
'%B').
')';
1300 $substitutionarray[
'__INVOICE_MONTH_TEXT__'] = $langs->trans(
"TextMonthOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date($sourceInvoice->date,
'%B').
')';
1301 $substitutionarray[
'__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans(
"TextNextMonthOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
dol_time_plus_duree($sourceInvoice->date, 1,
'm'),
'%B').
')';
1302 $substitutionarray[
'__INVOICE_PREVIOUS_YEAR__'] = $langs->trans(
"PreviousYearOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
dol_time_plus_duree($sourceInvoice->date, -1,
'y'),
'%Y').
')';
1303 $substitutionarray[
'__INVOICE_YEAR__'] = $langs->trans(
"YearOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date($sourceInvoice->date,
'%Y').
')';
1304 $substitutionarray[
'__INVOICE_NEXT_YEAR__'] = $langs->trans(
"NextYearOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
dol_time_plus_duree($sourceInvoice->date, 1,
'y'),
'%Y').
')';
1306 $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').
')';
1307 $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').
')';
1308 $substitutionarray[
'__INVOICE_COUNTER_CURRENT__'] = $langs->trans(
"Count");
1309 $substitutionarray[
'__INVOICE_COUNTER_MAX__'] = $langs->trans(
"MaxPeriodNumber");
1311 $htmltext =
'<i>'.$langs->trans(
"FollowingConstantsWillBeSubstituted").
':<br>';
1312 foreach ($substitutionarray as $key => $val) {
1313 $htmltext .= $key.
' = '.$langs->trans($val).
'<br>';
1315 $htmltext .=
'</i>';
1318 print
"<tr><td>".$langs->trans(
"Author").
"</td><td>".$user->getFullName($langs).
"</td></tr>";
1321 print
"<tr><td>".$langs->trans(
"PaymentConditions").
"</td><td>";
1322 print $form->getSelectConditionsPaiements(GETPOSTISSET(
'cond_reglement_id') ?
GETPOSTINT(
'cond_reglement_id') : $sourceInvoice->cond_reglement_id,
'cond_reglement_id', -1, 0, 0,
'');
1327 print
"<tr><td>".$langs->trans(
"PaymentMode").
"</td><td>";
1328 print
img_picto(
'',
'payment',
'class="pictofixedwidth"');
1329 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);
1334 print
"<tr><td>".$langs->trans(
'DebitBankAccount').
"</td><td>";
1335 $defaultRibId = $sourceInvoice->thirdparty->getDefaultRib();
1336 $form->selectRib(GETPOSTISSET(
'accountcustomerid') ?
GETPOSTINT(
'accountcustomerid') : $defaultRibId,
'accountcustomerid',
'fk_soc='.$sourceInvoice->socid, 1,
'', 1);
1340 $(document).ready(function() {
1341 if($("#selectmode_reglement_id option:selected").data("code") != "' . $factureRec::PAYMENTCODETOEDITSOCIETERIB .
'") {
1342 hideselectfksocieterib();
1344 $("#selectmode_reglement_id").change(function() {
1345 if($("#selectmode_reglement_id option:selected").data("code") != "'. $factureRec::PAYMENTCODETOEDITSOCIETERIB .
'") {
1346 hideselectfksocieterib(1);
1348 showselectfksocieterib();
1353 function hideselectfksocieterib(empty = 0){
1354 $("#selectaccountcustomerid").closest("tr").hide();
1356 $("#selectaccountcustomerid").val("-1").change();
1360 function showselectfksocieterib(){
1361 $("#selectaccountcustomerid").closest("tr").show();
1366 if ($sourceInvoice->fk_account > 0) {
1367 print
"<tr><td>".$langs->trans(
'BankAccount').
"</td><td>";
1368 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.$sourceInvoice->id, (
string) $sourceInvoice->fk_account,
'none');
1374 print
"<tr><td>".$langs->trans(
"RuleForLinesDates").
"</td><td>";
1375 print $form->getSelectRuleForLinesDates(GETPOSTISSET(
'rule_for_lines_dates') ?
GETPOST(
'rule_for_lines_dates',
'alpha') : $factureRec->rule_for_lines_dates);
1384 $extralabels = $extrafields->fetch_name_optionals_label($draft->table_element);
1385 if ($draft->fetch_optionals() > 0) {
1386 $sourceInvoice->array_options = array_merge($sourceInvoice->array_options, $draft->array_options);
1389 print $sourceInvoice->showOptionals($extrafields,
'create', $parameters);
1392 if (
isModEnabled(
'project') && is_object($sourceInvoice->thirdparty) && $sourceInvoice->thirdparty->id > 0 && is_object($formproject)) {
1393 $projectid =
GETPOST(
'projectid') ?
GETPOST(
'projectid') : $sourceInvoice->fk_project;
1394 $langs->load(
'projects');
1395 print
'<tr><td>'.$langs->trans(
'Project').
'</td><td>';
1396 print
img_picto(
'',
'project',
'class="pictofixedwidth"');
1397 $numprojet = $formproject->select_projects($sourceInvoice->thirdparty->id, $projectid,
'projectid', 0, 0, 1, 0, 0, 0, 0,
'', 0, 0,
'');
1398 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>';
1403 print
"<tr><td>".$langs->trans(
'Model').
"</td><td>";
1404 include_once DOL_DOCUMENT_ROOT.
'/core/modules/facture/modules_facture.php';
1406 print
img_picto(
'',
'generic',
'class="pictofixedwidth"');
1408 print $form->selectarray(
'modelpdf', $list, $conf->global->FACTURE_ADDON_PDF);
1413 print
'<td class="tdtop">';
1414 print $form->textwithpicto($langs->trans(
'NotePublic'), $htmltext, 1,
'help',
'', 0, 2,
'notepublic');
1417 $doleditor =
new DolEditor(
'note_public', $note_public,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1418 print $doleditor->Create(1);
1421 if (empty($user->socid)) {
1423 print
'<td class="tdtop">';
1424 print $form->textwithpicto($langs->trans(
'NotePrivate'), $htmltext, 1,
'help',
'', 0, 2,
'noteprivate');
1427 $doleditor =
new DolEditor(
'note_private', $note_private,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1428 print $doleditor->Create(1);
1438 $title = $langs->trans(
"Recurrence");
1441 print
'<span class="opacitymedium">'.$langs->trans(
"ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv(
'Module2300Name')).
'</span><br><br>';
1445 print
'<table class="border centpercent">';
1448 print
'<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans(
"Frequency"), $langs->transnoentitiesnoconv(
'toolTipFrequency')).
"</td><td>";
1449 print
'<input type="text" class="width50" name="frequency" value="'.GETPOST(
'frequency',
'int').
'"> ';
1450 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'));
1454 print
"<tr><td>".$langs->trans(
'NextDateToExecution').
"</td><td>";
1456 print $form->selectDate($date_next_execution,
'', 1, 1, 0,
"add", 1, 1);
1460 print
"<tr><td>".$langs->trans(
"MaxPeriodNumber").
"</td><td>";
1461 print
'<input type="text" class="width50" name="nb_gen_max" value="'.GETPOSTINT(
'nb_gen_max').
'">';
1465 print
"<tr><td>".$langs->trans(
"StatusOfAutoGeneratedInvoices").
"</td><td>";
1466 $select = array(
'0' => $langs->trans(
'BillStatusDraft'),
'1' => $langs->trans(
'BillStatusValidated'));
1467 print $form->selectarray(
'auto_validate', $select,
GETPOSTINT(
'auto_validate'));
1472 print
"<tr><td>".$langs->trans(
"StatusOfGeneratedDocuments").
"</td><td>";
1473 $select = array(
'0' => $langs->trans(
'DoNotGenerateDoc'),
'1' => $langs->trans(
'AutoGenerateDoc'));
1474 print $form->selectarray(
'generate_pdf', $select,
GETPOSTINT(
'generate_pdf'));
1477 print
'<input type="hidden" name="generate_pdf" value="1">';
1485 $title = $langs->trans(
"ProductsAndServices");
1487 $title = $langs->trans(
"Products");
1489 $title = $langs->trans(
"Services");
1497 print
'<div class="div-table-responsive-no-min">';
1498 print
'<table id="tablelines" class="noborder noshadow centpercent nomarginbottom">';
1501 if (!empty($sourceInvoice->lines)) {
1502 $sourceInvoice->printOriginLinesList(
'', $selectedLines);
1511 if (!empty($flag_price_may_change)) {
1512 print
'<tr><td colspan="3" class="left">';
1513 print
'<select name="usenewprice" class="flat">';
1514 print
'<option value="0">'.$langs->trans(
"AlwaysUseFixedPrice").
'</option>';
1515 print
'<option value="1" disabled>'.$langs->trans(
"AlwaysUseNewPrice").
'</option>';
1523 print $form->buttonsSaveCancel(
"Create");
1536 if ($action ==
'ask_deleteline') {
1537 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$lineid, $langs->trans(
'DeleteProductLine'), $langs->trans(
'ConfirmDeleteProductLine'),
'confirm_deleteline',
'',
'no', 1);
1540 if ($action ==
'delete') {
1541 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteRepeatableInvoice'), $langs->trans(
'ConfirmDeleteRepeatableInvoice'),
'confirm_delete',
'',
'no', 1);
1544 if ($action ==
'ask_subtotal_deleteline') {
1545 $langs->load(
"subtotals");
1546 $title =
"DeleteSubtotalLine";
1547 $question =
"ConfirmDeleteSubtotalLine";
1548 if (
GETPOST(
'type') ==
'title') {
1549 $formconfirm = array(array(
'type' =>
'checkbox',
'name' =>
'deletecorrespondingsubtotalline',
'label' => $langs->trans(
"DeleteCorrespondingSubtotalLine"),
'value' => 0));
1550 $title =
"DeleteTitleLine";
1551 $question =
"ConfirmDeleteTitleLine";
1553 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$lineid, $langs->trans($title), $langs->trans($question),
'confirm_delete_subtotalline', $formconfirm,
'no', 1);
1557 if ($action ==
'add_title_line') {
1558 $langs->load(
'subtotals');
1560 $depth_array =
$object->getPossibleLevels($langs);
1562 } elseif ($action ==
'add_subtotal_line') {
1563 $langs->load(
'subtotals');
1565 $titles =
$object->getPossibleTitles();
1570 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
1571 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
1572 if (empty($reshook)) {
1573 $formconfirm .= $hookmanager->resPrint;
1574 } elseif ($reshook > 0) {
1575 $formconfirm = $hookmanager->resPrint;
1580 $author =
new User($db);
1581 $author->fetch(
$object->user_creation_id);
1589 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/facture/invoicetemplate_list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1592 if ($action !=
'editref') {
1593 $morehtmlref .= $form->editfieldkey(
$object->ref,
'ref',
$object->ref, $object, $user->hasRight(
'facture',
'creer'),
'',
'', 0, 2);
1595 $morehtmlref .= $form->editfieldval(
'',
'ref',
$object->ref, $object, $user->hasRight(
'facture',
'creer'),
'string');
1598 $morehtmlref .=
'<div class="refidno">';
1603 $morehtmlref .=
$object->thirdparty->getNomUrl(1,
'customer');
1606 $langs->load(
"projects");
1607 $morehtmlref .=
'<br>';
1608 if ($user->hasRight(
'facture',
'creer')) {
1609 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1610 if ($action !=
'classify') {
1611 $morehtmlref .=
'<a class="editfielda" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'action' =>
'classify',
'id' =>
$object->id],
true).
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1613 $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');
1615 if (!empty(
$object->fk_project)) {
1617 $proj->fetch(
$object->fk_project);
1618 $morehtmlref .=
' : '.$proj->getNomUrl(1);
1620 $morehtmlref .=
' - '.$proj->title;
1627 $morehtmlref .=
'</div>';
1629 $morehtmlstatus =
'';
1631 dol_banner_tab($object,
'ref', $linkback, 1,
'title',
'none', $morehtmlref,
'', 0,
'', $morehtmlstatus);
1633 print
'<div class="fichecenter">';
1634 print
'<div class="fichehalfleft">';
1635 print
'<div class="underbanner clearboth"></div>';
1637 print
'<table class="border centpercent tableforfield">';
1641 print
"<tr><td>".$langs->trans(
"InvoiceSubtype").
"</td><td>";
1643 print
$object->getSubtypeLabel(
'facture_rec');
1649 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Author").
'</td><td>';
1650 print $author->getNomUrl(-1);
1655 print
'<table class="nobordernopadding centpercent"><tr><td>';
1656 print $langs->trans(
'PaymentConditionsShort');
1658 if ($action !=
'editconditions' && $user->hasRight(
'facture',
'creer')) {
1659 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>';
1661 print
'</tr></table>';
1663 if ($action ==
'editconditions') {
1664 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'].
'?facid='.
$object->id, (
string)
$object->cond_reglement_id,
'cond_reglement_id');
1666 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'].
'?facid='.
$object->id, (
string)
$object->cond_reglement_id,
'none');
1672 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1673 print $langs->trans(
'PaymentMode');
1675 if ($action !=
'editmode' && $user->hasRight(
'facture',
'creer')) {
1676 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>';
1678 print
'</tr></table>';
1680 if ($action ==
'editmode') {
1681 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?facid='.
$object->id, (
string)
$object->mode_reglement_id,
'mode_reglement_id',
'CRDT', 1, 1);
1683 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?facid='.
$object->id, (
string)
$object->mode_reglement_id,
'none');
1689 if (
$object->mode_reglement_code == $object::PAYMENTCODETOEDITSOCIETERIB) {
1690 print
'<tr><td class="nowrap">';
1691 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
1692 print $langs->trans(
'DebitBankAccount');
1696 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>';
1698 print
'</tr></table>';
1701 if ($action ==
'editbankaccountcustomer') {
1702 $form->formRib($_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id, (
string)
$object->fk_societe_rib,
'accountcustomerid',
'fk_soc='.$object->socid, 1, 1);
1704 $form->formRib($_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id, (
string)
$object->fk_societe_rib,
'none',
'', 0, 1);
1711 print
'<tr><td class="nowrap">';
1712 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
1713 print $langs->trans(
'BankAccount');
1716 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>';
1718 print
'</tr></table>';
1720 if ($action ==
'editbankaccount') {
1721 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
string)
$object->fk_account,
'fk_account', 1);
1723 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
string)
$object->fk_account,
'none');
1731 print
'<table class="nobordernopadding centpercent"><tr><td>';
1732 print $langs->trans(
'RuleForLinesDates');
1734 if ($action !=
'editruleforlinesdates' && $user->hasRight(
'facture',
'creer')) {
1735 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>';
1737 print
'</tr></table>';
1739 if ($action ==
'editruleforlinesdates') {
1740 $form->form_rule_for_lines_dates($_SERVER[
'PHP_SELF'].
'?facid='.
$object->id,
$object->rule_for_lines_dates,
'rule_for_lines_dates');
1742 $form->form_rule_for_lines_dates($_SERVER[
'PHP_SELF'].
'?facid='.
$object->id,
$object->rule_for_lines_dates,
'none');
1748 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1751 print
'<tr><td class="nowrap">';
1752 print
'<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
1753 print $langs->trans(
'Model');
1756 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>';
1758 print
'</tr></table>';
1760 if ($action ==
'editmodelpdf') {
1761 include_once DOL_DOCUMENT_ROOT.
'/core/modules/facture/modules_facture.php';
1764 foreach ($models as $k => $model) {
1765 $list[] = str_replace(
':',
'|', $k).
':'.$model;
1767 $select =
'select;'.implode(
',', $list);
1768 print $form->editfieldval($langs->trans(
"Model"),
'modelpdf',
$object->model_pdf, $object, $user->hasRight(
'facture',
'creer'), $select);
1782 print
'<div class="fichehalfright">';
1784 print
'<!-- amounts -->'.
"\n";
1785 print
'<div class="underbanner clearboth"></div>'.
"\n";
1788 $title = $langs->trans(
"Recurrence");
1790 print
'<table class="border tableforfield centpercent">';
1792 include DOL_DOCUMENT_ROOT.
'/core/tpl/object_currency_amount.tpl.php';
1800 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"AmountHT").
'</td>';
1801 print
'<td class="nowraponall amountcard right">'.price($sign *
$object->total_ht, 0, $langs, 1, -1, -1, $conf->currency).
'</td>';
1804 print
'<td class="nowraponall amountcard right">' .
price($sign *
$object->multicurrency_total_ht, 0, $langs, 0, -1, -1,
$object->multicurrency_code) .
'</td>';
1809 print
'<tr><td>'.$langs->trans(
"AmountVAT").
'</td>';
1810 print
'<td class="nowrap amountcard right">'.price($sign *
$object->total_tva, 0, $langs, 1, -1, -1, $conf->currency).
'</td>';
1813 print
'<td class="nowraponall amountcard right">' .
price($sign *
$object->multicurrency_total_tva, 0, $langs, 0, -1, -1,
$object->multicurrency_code) .
'</td>';
1818 if ((
$mysoc->localtax1_assuj ==
"1" &&
$mysoc->useLocalTax(1)) ||
$object->total_localtax1 != 0) {
1820 print
'<td class="titlefieldmiddle">'.$langs->transcountry(
"AmountLT1",
$mysoc->country_code).
'</td>';
1821 print
'<td class="nowraponall amountcard right">'.price($sign *
$object->total_localtax1, 1,
'', 1, - 1, - 1, $conf->currency).
'</td></tr>';
1825 print
'<td class="nowraponall amountcard right">' .
price($sign *
$object->multicurrency_total_localtax1, 0, $langs, 0, -1, -1,
$object->multicurrency_code) .
'</td>';
1830 if ((
$mysoc->localtax2_assuj ==
"1" &&
$mysoc->useLocalTax(2)) ||
$object->total_localtax2 != 0) {
1832 print
'<td>'.$langs->transcountry(
"AmountLT2",
$mysoc->country_code).
'</td>';
1833 print
'<td class=nowraponall amountcard right">'.price($sign *
$object->total_localtax2, 1,
'', 1, - 1, - 1, $conf->currency).
'</td></tr>';
1837 print
'<td class="nowraponall amountcard right">' .
price($sign *
$object->multicurrency_total_localtax2, 0, $langs, 0, -1, -1,
$object->multicurrency_code) .
'</td>';
1898 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>';
1901 print
'<td class="nowrap amountcard right">' .
price($sign *
$object->multicurrency_total_ttc, 0, $langs, 0, -1, -1,
$object->multicurrency_code) .
'</td>';
1906 print
'<tr class="liste_titre"><td class="liste_titre">'.img_picto(
'',
'recurring',
'class="pictofixedwidth"').$title.
'</td>';
1914 print
'<tr><td style="width: 50%">';
1915 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1916 print $langs->trans(
'Frequency');
1918 if ($action !=
'editfrequency' && $user->hasRight(
'facture',
'creer')) {
1919 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>';
1921 print
'</tr></table>';
1923 if ($action ==
'editfrequency') {
1924 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'?facid='.
$object->id.
'">';
1925 print
'<input type="hidden" name="action" value="setfrequency">';
1926 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1927 print
'<table class="nobordernopadding">';
1929 print
'<input type="text" name="frequency" class="width50 marginrightonly right" value="'.$object->frequency.
'">';
1930 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'));
1932 print
'<td class="left"><input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
"Modify").
'"></td>';
1933 print
'</tr></table></form>';
1936 print $langs->trans(
'FrequencyPer_'.
$object->unit_frequency,
$object->frequency);
1938 print
'<span class="opacitymedium">'.$langs->trans(
"NotARecurringInvoiceTemplate").
'</span>';
1950 if ($action ==
'date_when' ||
$object->frequency > 0) {
1951 print $form->editfieldkey($langs->trans(
"NextDateToExecution"),
'date_when',
$object->date_when, $object, $user->hasRight(
'facture',
'creer'),
'day');
1953 print $langs->trans(
"NextDateToExecution");
1956 if ($action ==
'date_when' ||
$object->frequency > 0) {
1957 print $form->editfieldval($langs->trans(
"NextDateToExecution"),
'date_when',
$object->date_when, $object, $user->hasRight(
'facture',
'creer'),
'day',
$object->date_when,
null,
'',
'', 0,
'strikeIfMaxNbGenReached');
1960 if (!
$object->isMaxNbGenReached()) {
1965 print
img_info($langs->trans(
"MaxNumberOfGenerationReached"));
1975 if ($action ==
'nb_gen_max' ||
$object->frequency > 0) {
1976 print $form->editfieldkey($langs->trans(
"MaxPeriodNumber"),
'nb_gen_max', (
string)
$object->nb_gen_max, $object, $user->hasRight(
'facture',
'creer'));
1978 print $langs->trans(
"MaxPeriodNumber");
1981 if ($action ==
'nb_gen_max' ||
$object->frequency > 0) {
1982 print $form->editfieldval($langs->trans(
"MaxPeriodNumber"),
'nb_gen_max',
$object->nb_gen_max ?
$object->nb_gen_max :
'',
$object, $user->hasRight(
'facture',
'creer'));
1994 if ($action ==
'auto_validate' ||
$object->frequency > 0) {
1995 print $form->editfieldkey($langs->trans(
"StatusOfAutoGeneratedInvoices"),
'auto_validate', (
string)
$object->auto_validate, $object, $user->hasRight(
'facture',
'creer'));
1997 print $langs->trans(
"StatusOfAutoGeneratedInvoices");
2000 $select =
'select;0:'.$langs->trans(
'BillStatusDraft').
',1:'.$langs->trans(
'BillStatusValidated');
2001 if ($action ==
'auto_validate' ||
$object->frequency > 0) {
2002 print $form->editfieldval($langs->trans(
"StatusOfAutoGeneratedInvoices"),
'auto_validate',
$object->auto_validate, $object, $user->hasRight(
'facture',
'creer'), $select);
2013 if ($action ==
'generate_pdf' ||
$object->frequency > 0) {
2014 print $form->editfieldkey($langs->trans(
"StatusOfGeneratedDocuments"),
'generate_pdf', (
string)
$object->generate_pdf, $object, $user->hasRight(
'facture',
'creer'));
2016 print $langs->trans(
"StatusOfGeneratedDocuments");
2020 $select =
'select;0:'.$langs->trans(
'DoNotGenerateDoc').
',1:'.$langs->trans(
'AutogenerateDoc');
2021 if ($action ==
'generate_pdf' ||
$object->frequency > 0) {
2022 print $form->editfieldval($langs->trans(
"StatusOfGeneratedDocuments"),
'generate_pdf',
$object->generate_pdf, $object, $user->hasRight(
'facture',
'creer'), $select);
2030 print
'<input type="hidden" name="generate_pdf" value="1">';
2041 print
info_admin($langs->trans(
"EnableAndSetupModuleCron", $langs->transnoentitiesnoconv(
"Module2300Name")));
2044 print
'<div class="underbanner clearboth"></div>';
2045 print
'<table class="border centpercent tableforfield">';
2048 print
'<tr><td style="width: 50%">'.$langs->trans(
"NbOfGenerationDone").
'</td>';
2056 print $langs->trans(
"DateLastGeneration");
2070 print
'<div class="clearboth"></div><br>';
2074 print
'<form name="addproduct" id="addproduct" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.(($action !=
'editline') ?
'#add' :
'#line_'.
GETPOSTINT(
'lineid')).
'" method="POST">';
2075 print
'<input type="hidden" name="token" value="' .
newToken().
'">';
2076 print
'<input type="hidden" name="action" value="' . (($action !=
'editline') ?
'addline' :
'updateline').
'">';
2077 print
'<input type="hidden" name="mode" value="">';
2078 print
'<input type="hidden" name="id" value="' .
$object->id.
'">';
2079 print
'<input type="hidden" name="page_y" value="">';
2081 if (!empty($conf->use_javascript_ajax) &&
$object->statut == 0) {
2083 include DOL_DOCUMENT_ROOT.
'/core/tpl/subtotal_ajaxrow.tpl.php';
2085 include DOL_DOCUMENT_ROOT .
'/core/tpl/ajaxrow.tpl.php';
2089 print
'<div class="div-table-responsive-no-min">';
2090 print
'<table id="tablelines" class="noborder noshadow centpercent nomarginbottom">';
2093 $canchangeproduct = 1;
2098 if (
$object->status == $object::STATUS_DRAFT && $user->hasRight(
'facture',
'creer') && $action !=
'valid' && $action !=
'editline') {
2099 if ($action !=
'editline') {
2102 $parameters = array();
2103 $reshook = $hookmanager->executeHooks(
'formAddObjectLine', $parameters, $object, $action);
2107 if (empty($reshook)) {
2124 print
'<div class="tabsAction">';
2126 $parameters = array();
2127 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
2128 if (empty($reshook)) {
2131 'class' =>
'classfortooltip',
2138 $langs->load(
"subtotals");
2140 $url_button = array();
2142 $url_button[] = array(
2143 'lang' =>
'subtotals',
2145 'perm' => (
bool) $usercancreate,
2146 'label' => $langs->trans(
'AddTitleLine'),
2147 'url' =>
'/compta/facture/card-rec.php?id='.$object->id.
'&action=add_title_line&token='.
newToken()
2150 $url_button[] = array(
2151 'lang' =>
'subtotals',
2153 'perm' => (
bool) $usercancreate,
2154 'label' => $langs->trans(
'AddSubtotalLine'),
2155 'url' =>
'/compta/facture/card-rec.php?id='.$object->id.
'&action=add_subtotal_line&token='.
newToken()
2157 print
dolGetButtonAction(
'', $langs->trans(
'Subtotal'),
'default', $url_button,
'',
true);
2160 if (empty(
$object->suspended)) {
2161 if ($user->hasRight(
'facture',
'creer')) {
2163 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' .
dol_escape_htmltag($langs->trans(
"MaxGenerationReached")) .
'">' . $langs->trans(
"CreateBill") .
'</a></div>';
2165 if (empty(
$object->frequency) ||
$object->date_when <= $nowlasthour) {
2166 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>';
2168 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' .
dol_escape_htmltag($langs->trans(
"DateIsNotEnough")) .
'">' . $langs->trans(
"CreateBill") .
'</a></div>';
2172 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans(
"CreateBill") .
'</a></div>';
2176 if ($user->hasRight(
'facture',
'creer')) {
2177 if (empty(
$object->suspended)) {
2178 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>';
2180 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>';
2185 print
dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id .
'&action=delete&token=' .
newToken(),
'delete', $user->hasRight(
'facture',
'supprimer'));
2191 print
'<div class="fichecenter"><div class="fichehalfleft">';
2192 print
'<a name="builddoc"></a>';
2196 $tmparray = $form->showLinkToObjectBlock($object, array(), array(
'invoice'), 1);
2197 $linktoelem = $tmparray[
'linktoelem'];
2198 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
2199 print $htmltoenteralink;
2201 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
2205 print
'<div class="fichehalfright">';
2209 $morehtmlcenter =
'<div class="nowraponall">';
2211 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullList'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/compta/facture/agenda-rec.php?id='.
$object->id);
2212 $morehtmlcenter .=
'</div>';
2215 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2217 $somethingshown = $formactions->showactions($object,
$object->element, (is_object(
$object->thirdparty) ?
$object->thirdparty->id : 0), 1,
'', $MAXEVENT,
'', $morehtmlcenter);
2222 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.
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.
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 '.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
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.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
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.
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.