36require
'../../main.inc.php';
37require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
40if (isModEnabled(
'project')) {
41 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/invoice.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
58$langs->loadLangs(array(
'bills',
'companies',
'compta',
'admin',
'other',
'products',
'banks'));
60$action =
GETPOST(
'action',
'alpha');
61$massaction =
GETPOST(
'massaction',
'alpha');
63$confirm =
GETPOST(
'confirm',
'alpha');
64$cancel =
GETPOST(
'cancel',
'alpha');
65$toselect =
GETPOST(
'toselect',
'array');
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');
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'));
121$extrafields->fetch_name_optionals_label(
$object->table_element);
123$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
125$permissiontoadd = $user->hasRight(
'facture',
'creer');
126$permissionnote = $user->hasRight(
'facture',
'creer');
127$permissiondellink = $user->hasRight(
'facture',
'creer');
128$permissiontoedit = $user->hasRight(
'facture',
'creer');
129$permissiontoeditextra = $permissiontoadd;
130if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
132 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
135$usercanread = $user->hasRight(
'facture',
'lire');
136$usercancreate = $user->hasRight(
'facture',
'creer');
137$usercanissuepayment = $user->hasRight(
'facture',
'paiement');
138$usercandelete = $user->hasRight(
'facture',
'supprimer');
141$usercanvalidate = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'facture',
'invoice_advance',
'validate')));
142$usercansend = (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'facture',
'invoice_advance',
'send'));
143$usercanreopen = (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'facture',
'invoice_advance',
'reopen'));
144$usercanunvalidate = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !empty($usercancreate)) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'facture',
'invoice_advance',
'unvalidate')));
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']);
305 $object->linked_objects[
'commande'] = $proposalid;
311 $oldinvoice =
new Facture($db);
314 $onlylines =
GETPOST(
'toselect',
'array');
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 ==
'setgenerate_pdf' && $usercancreate) {
414 } elseif ($action ==
'setmodelpdf' && $usercancreate) {
417 } elseif ($action ==
'disable' && $usercancreate) {
421 $object->context[
'actionmsg'] = $langs->trans(
"RecordDisabled");
423 $res =
$object->setValueFrom(
'suspended', 1,
'',
null,
'text',
'', $user,
'BILLREC_MODIFY');
434 } elseif ($action ==
'enable' && $usercancreate) {
438 $object->context[
'actionmsg'] = $langs->trans(
"RecordEnabled");
440 $res =
$object->setValueFrom(
'suspended', 0,
'',
null,
'text',
'', $user,
'BILLREC_MODIFY');
451 } elseif ($action ==
'setmulticurrencycode' && $usercancreate) {
453 $result =
$object->setMulticurrencyCode(
GETPOST(
'multicurrency_code',
'alpha'));
455 } elseif ($action ==
'setmulticurrencyrate' && $usercancreate) {
459 } elseif ($action ==
'setruleforlinesdates' && $usercancreate) {
460 $object->context[
'actionmsg'] = $langs->trans(
"FieldXModified", $langs->transnoentitiesnoconv(
"RuleForLinesDates"));
461 $ruleForLinesDates = GETPOSTISSET(
'rule_for_lines_dates') ?
GETPOST(
'rule_for_lines_dates',
'alpha') :
'prepaid';
462 $object->setValueFrom(
'rule_for_lines_dates', $ruleForLinesDates);
466 if ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $usercancreate) {
477 if ($line->delete($user) > 0) {
478 $result =
$object->update_price(1);
491 } elseif ($action ==
'confirm_delete_subtotalline' && $confirm ==
'yes' && $usercancreate) {
496 $result =
$object->deleteSubtotalLine($langs,
GETPOSTINT(
'lineid'), (
bool)
GETPOST(
'deletecorrespondingsubtotalline'), $user);
498 $result =
$object->update_price(1);
503 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
513 } elseif ($action ==
'update_extras' && $permissiontoeditextra) {
516 $attribute_name =
GETPOST(
'attribute',
'aZ09');
519 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
525 $result =
$object->updateExtraField($attribute_name,
'BILLREC_MODIFY');
533 $action =
'edit_extras';
538 if ($action ==
'addline' && $usercancreate) {
539 $langs->load(
'errors');
544 $product_desc = (GETPOSTISSET(
'dp_desc') ?
GETPOST(
'dp_desc',
'restricthtml') :
'');
547 $prod_entry_mode =
GETPOST(
'prod_entry_mode',
'alpha');
548 if ($prod_entry_mode ==
'free') {
554 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ProductOrService")),
null,
'errors');
559 $tva_tx = (
GETPOST(
'tva_tx',
'alpha') ?
GETPOST(
'tva_tx',
'alpha') : 0);
563 if (empty($remise_percent)) {
568 $extralabelsline = $extrafields->fetch_name_optionals_label(
$object->table_element_line);
569 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line, $predef);
571 if (is_array($extralabelsline)) {
573 foreach ($extralabelsline as $key => $value) {
574 unset($_POST[
"options_".$key.$predef]);
578 if ((empty($idprod) || $idprod < 0) && ($price_ht < 0) && ((
float) $qty < 0)) {
579 setEventMessages($langs->trans(
'ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv(
'UnitPriceHT'), $langs->transnoentitiesnoconv(
'Qty')),
null,
'errors');
582 if ($prod_entry_mode ==
'free' && (empty($idprod) || $idprod < 0) &&
GETPOST(
'type') < 0) {
583 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Type')),
null,
'errors');
586 if ($prod_entry_mode ==
'free' && (empty($idprod) || $idprod < 0) && (!($price_ht >= 0) || $price_ht ==
'')) {
587 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"UnitPriceHT")),
null,
'errors');
591 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Qty')),
null,
'errors');
594 if ($prod_entry_mode ==
'free' && (empty($idprod) || $idprod < 0) && empty($product_desc)) {
595 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Description')),
null,
'errors');
599 $langs->load(
"errors");
600 setEventMessages($langs->trans(
'ErrorQtyForCustomerInvoiceCantBeNegative'),
null,
'errors');
604 if (!$error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) {
610 $ret =
$object->fetch_thirdparty();
615 $price_base_type = (
GETPOST(
'price_base_type',
'alpha') ?
GETPOST(
'price_base_type',
'alpha') :
'HT');
626 if (!empty($idprod) && $idprod > 0) {
628 $prod->fetch($idprod);
630 $label = ((
GETPOST(
'product_label') &&
GETPOST(
'product_label') != $prod->label) ?
GETPOST(
'product_label') :
'');
642 $datapriceofproduct = $prod->getSellPrice($mysoc,
$object->thirdparty, $pqp);
644 $pu_ht = $datapriceofproduct[
'pu_ht'];
645 $pu_ttc = $datapriceofproduct[
'pu_ttc'];
646 $price_min = $datapriceofproduct[
'price_min'];
647 $price_base_type = empty($datapriceofproduct[
'price_base_type']) ?
'HT' : $datapriceofproduct[
'price_base_type'];
651 $tmpvat = (float)
price2num(preg_replace(
'/\s*\(.*\)/',
'', $tva_tx));
652 $tmpprodvat =
price2num(preg_replace(
'/\s*\(.*\)/',
'', (
string) $prod->tva_tx));
655 if (!empty($price_ht)) {
657 $pu_ttc =
price2num((
float) $pu_ht * (1 + ($tmpvat / 100)),
'MU');
658 } elseif ($tmpvat != $tmpprodvat) {
661 if ($price_base_type !=
'HT') {
662 $pu_ht =
price2num((
float) $pu_ttc / (1 + ($tmpvat / 100)),
'MU');
664 $pu_ttc =
price2num((
float) $pu_ht * (1 + ($tmpvat / 100)),
'MU');
668 $outputlangs = $langs;
674 if (
GETPOST(
'lang_id',
'aZ09')) {
675 $newlang =
GETPOST(
'lang_id',
'aZ09');
677 if (empty($newlang)) {
678 $newlang =
$object->thirdparty->default_lang;
680 if (!empty($newlang)) {
682 $outputlangs->setDefaultLang($newlang);
683 $outputlangs->load(
'products');
686 $desc = (!empty($prod->multilangs [$outputlangs->defaultlang] [
"description"])) ? $prod->multilangs [$outputlangs->defaultlang] [
"description"] : $prod->
description;
688 $desc = $prod->description;
694 if (!
getDolGlobalString(
'MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE') && (!empty($prod->customcode) || !empty($prod->country_code))) {
698 if (!empty($prod->customcode)) {
699 $tmptxt .= $outputlangs->transnoentitiesnoconv(
"CustomsCode").
': '.$prod->customcode;
701 if (!empty($prod->customcode) && !empty($prod->country_code)) {
704 if (!empty($prod->country_code)) {
705 $tmptxt .= $outputlangs->transnoentitiesnoconv(
"CountryOrigin").
': '.
getCountry($prod->country_code,
'', $db, $outputlangs, 0);
708 if (!empty($prod->customcode)) {
709 $tmptxt .= $langs->transnoentitiesnoconv(
"CustomsCode").
': '.$prod->customcode;
711 if (!empty($prod->customcode) && !empty($prod->country_code)) {
714 if (!empty($prod->country_code)) {
715 $tmptxt .= $langs->transnoentitiesnoconv(
"CountryOrigin").
': '.
getCountry($prod->country_code,
'', $db, $langs, 0);
723 $fk_unit = $prod->fk_unit;
727 $tva_npr = (preg_match(
'/\*/', $tva_tx) ? 1 : 0);
728 $tva_tx = str_replace(
'*',
'', $tva_tx);
729 if (empty($tva_tx)) {
732 $label = (
GETPOST(
'product_label') ?
GETPOST(
'product_label') :
'');
733 $desc = $product_desc;
738 $date_start_fill =
GETPOSTINT(
'date_start_fill');
742 $fournprice = (int) (
GETPOST(
'fournprice'.$predef) ?
GETPOST(
'fournprice'.$predef) :
'');
754 $fk_parent_line =
GETPOSTINT(
'fk_parent_line');
756 if ($usercanproductignorepricemin && (!empty($price_min) && ((
float)
price2num($pu_ht) * (1 - (
float)
price2num($remise_percent) / 100) < (
float)
price2num($price_min)))) {
757 $mesg = $langs->trans(
"CantBeLessThanMinPrice",
price(
price2num($price_min,
'MU'), 0, $langs, 0, 0, -1,
$conf->currency));
761 $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);
784 unset($_POST[
'prod_entry_mode']);
786 unset($_POST[
'qty']);
787 unset($_POST[
'type']);
788 unset($_POST[
'remise_percent']);
789 unset($_POST[
'price_ht']);
790 unset($_POST[
'multicurrency_price_ht']);
791 unset($_POST[
'price_ttc']);
792 unset($_POST[
'tva_tx']);
793 unset($_POST[
'product_ref']);
794 unset($_POST[
'product_label']);
795 unset($_POST[
'product_desc']);
796 unset($_POST[
'fournprice']);
797 unset($_POST[
'buying_price']);
798 unset($_POST[
'np_marginRate']);
799 unset($_POST[
'np_markRate']);
800 unset($_POST[
'dp_desc']);
801 unset($_POST[
'idprod']);
802 unset($_POST[
'units']);
804 unset($_POST[
'date_starthour']);
805 unset($_POST[
'date_startmin']);
806 unset($_POST[
'date_startsec']);
807 unset($_POST[
'date_startday']);
808 unset($_POST[
'date_startmonth']);
809 unset($_POST[
'date_startyear']);
810 unset($_POST[
'date_endhour']);
811 unset($_POST[
'date_endmin']);
812 unset($_POST[
'date_endsec']);
813 unset($_POST[
'date_endday']);
814 unset($_POST[
'date_endmonth']);
815 unset($_POST[
'date_endyear']);
817 unset($_POST[
'date_start_fill']);
818 unset($_POST[
'date_end_fill']);
820 unset($_POST[
'situations']);
821 unset($_POST[
'progress']);
829 } elseif ($action ==
'confirm_addtitleline' && $usercancreate) {
832 $langs->load(
'subtotals');
834 $desc =
GETPOST(
'subtotallinedesc',
'alphanohtml');
835 $depth =
GETPOSTINT(
'subtotallinelevel') ?? 1;
837 $subtotal_options = array();
839 foreach (FactureRec::$TITLE_OPTIONS as $option) {
840 $value =
GETPOST($option,
'alphanohtml');
842 $subtotal_options[$option] = $value ==
'on' ? 1 : $value;
847 $result =
$object->addSubtotalLine($langs, $desc, (
int) $depth, $subtotal_options);
858 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
860 } elseif ($action ==
'confirm_addsubtotalline' && $usercancreate) {
863 $langs->load(
'subtotals');
865 $choosen_line =
GETPOST(
'subtotaltitleline',
'alphanohtml');
866 foreach (
$object->lines as $line) {
867 if ($line->desc == $choosen_line && $line->special_code == SUBTOTALS_SPECIAL_CODE) {
869 $depth = -$line->qty;
873 $subtotal_options = array();
875 foreach (FactureRec::$SUBTOTAL_OPTIONS as $option) {
876 $value =
GETPOST($option,
'alphanohtml');
878 $subtotal_options[$option] = $value ==
'on' ? 1 : $value;
883 if (isset($desc) && isset($depth)) {
884 $result =
$object->addSubtotalLine($langs, $desc, (
int) $depth, $subtotal_options);
886 $object->errors[] = $langs->trans(
"CorrespondingTitleNotFound");
889 if (isset($result) && $result >= 0) {
895 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
897 } elseif ($action ==
'updateline' && $usercancreate && !
GETPOST(
'cancel',
'alpha')) {
898 if (!
$object->fetch($id) > 0) {
918 if (preg_match(
'/\*/', $vat_rate)) {
923 $vat_rate = str_replace(
'*',
'', $vat_rate);
928 $fournprice = (int) (
GETPOST(
'fournprice') ?
GETPOST(
'fournprice') :
'');
932 $extralabelsline = $extrafields->fetch_name_optionals_label(
$object->table_element_line);
933 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
936 if ($objectline->fetch(
GETPOSTINT(
'lineid'))) {
937 $objectline->array_options = $array_options;
938 $result = $objectline->insertExtraFields();
944 $position = ($objectline->rang >= 0 ? $objectline->rang : 0);
947 if (is_array($extralabelsline)) {
949 foreach ($extralabelsline as $key => $value) {
950 unset($_POST[
"options_".$key]);
956 if ($special_code == 3) {
973 if (empty($remise_percent)) {
979 if (!empty($productid)) {
981 $product->fetch($productid);
983 $type = $product->type;
985 $price_min = $product->price_min;
987 $price_min = $product->multiprices_min[
$object->thirdparty->price_level];
996 setEventMessages($langs->trans(
"CantBeLessThanMinPrice",
price(
price2num($price_min,
'MU'), 0, $langs, 0, 0, - 1,
$conf->currency)),
null,
'errors');
1001 $label = (
GETPOST(
'product_label') ?
GETPOST(
'product_label') :
'');
1005 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
1010 $langs->load(
"errors");
1011 setEventMessages($langs->trans(
'ErrorQtyForCustomerInvoiceCantBeNegative'),
null,
'errors');
1015 $date_start_fill =
GETPOSTINT(
'date_start_fill');
1016 $date_end_fill =
GETPOSTINT(
'date_end_fill');
1017 $fk_parent_line =
GETPOST(
'fk_parent_line',
'int');
1021 $result =
$object->updateline(
1040 (
float) $pu_ht_devise,
1045 (
float) $buyingprice,
1046 (
int) $fk_parent_line
1069 unset($_POST[
'qty']);
1070 unset($_POST[
'type']);
1071 unset($_POST[
'productid']);
1072 unset($_POST[
'remise_percent']);
1073 unset($_POST[
'price_ht']);
1074 unset($_POST[
'multicurrency_price_ht']);
1075 unset($_POST[
'price_ttc']);
1076 unset($_POST[
'tva_tx']);
1077 unset($_POST[
'product_ref']);
1078 unset($_POST[
'product_label']);
1079 unset($_POST[
'product_desc']);
1080 unset($_POST[
'fournprice']);
1081 unset($_POST[
'buying_price']);
1082 unset($_POST[
'np_marginRate']);
1083 unset($_POST[
'np_markRate']);
1085 unset($_POST[
'dp_desc']);
1086 unset($_POST[
'idprod']);
1087 unset($_POST[
'units']);
1089 unset($_POST[
'date_starthour']);
1090 unset($_POST[
'date_startmin']);
1091 unset($_POST[
'date_startsec']);
1092 unset($_POST[
'date_startday']);
1093 unset($_POST[
'date_startmonth']);
1094 unset($_POST[
'date_startyear']);
1095 unset($_POST[
'date_endhour']);
1096 unset($_POST[
'date_endmin']);
1097 unset($_POST[
'date_endsec']);
1098 unset($_POST[
'date_endday']);
1099 unset($_POST[
'date_endmonth']);
1100 unset($_POST[
'date_endyear']);
1102 unset($_POST[
'situations']);
1103 unset($_POST[
'progress']);
1108 } elseif ($action ==
'updatetitleline' && GETPOSTISSET(
"save") && $usercancreate && !
GETPOST(
'cancel',
'alpha')) {
1111 $langs->load(
'subtotals');
1113 $desc =
GETPOST(
'line_desc',
'alphanohtml') ?? $langs->trans(
"Title");
1116 $subtotal_options = array();
1118 foreach (Facture::$TITLE_OPTIONS as $option) {
1119 $value =
GETPOST($option,
'alphanohtml');
1121 $subtotal_options[$option] = $value ==
'on' ? 1 : $value;
1126 $result =
$object->updateSubtotalLine($langs,
GETPOSTINT(
'lineid'), $desc, $depth, $subtotal_options);
1137 } elseif ($action ==
'updatesubtotalline' && GETPOSTISSET(
"save") && $usercancreate && !
GETPOST(
'cancel',
'alpha')) {
1140 $langs->load(
'subtotals');
1142 $desc =
GETPOST(
'line_desc',
'alphanohtml');
1145 $subtotal_options = array();
1147 foreach (Facture::$SUBTOTAL_OPTIONS as $option) {
1148 $value =
GETPOST($option,
'alphanohtml');
1150 $subtotal_options[$option] = $value ==
'on' ? 1 : $value;
1155 $result =
$object->updateSubtotalLine($langs,
GETPOSTINT(
'lineid'), $desc, $depth, $subtotal_options);
1171$title =
$object->ref.
" - ".$langs->trans(
'Card');
1176$form =
new Form($db);
1178if (isModEnabled(
'project')) {
1181 $formproject =
null;
1183$companystatic =
new Societe($db);
1191if ($action ==
'create') {
1192 print
load_fiche_titre($langs->trans(
"CreateRepeatableInvoice"),
'',
'bill');
1194 $sourceInvoice =
new Facture($db);
1196 $product_static =
new Product($db);
1198 if ($sourceInvoice->fetch($id, $ref) > 0) {
1199 $result = $sourceInvoice->getLinesArray();
1201 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
1202 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1203 print
'<input type="hidden" name="action" value="add">';
1204 print
'<input type="hidden" name="facid" value="'.$sourceInvoice->id.
'">';
1210 if (isModEnabled(
'project')) {
1213 if ($sourceInvoice->fk_account > 0) {
1217 print
'<table class="border centpercent">';
1219 $sourceInvoice->fetch_thirdparty();
1222 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Title").
'</td><td>';
1223 print
'<input class="flat quatrevingtpercent" type="text" name="title" value="'.dol_escape_htmltag(
GETPOST(
"title",
'alphanohtml')).
'" autofocus>';
1227 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Customer").
'</td><td>'.$sourceInvoice->thirdparty->getNomUrl(1,
'customer').
'</td>';
1232 print
"<tr><td>".$langs->trans(
"InvoiceSubtype").
"</td><td>";
1233 print $form->getSelectInvoiceSubtype(GETPOSTISSET(
'subtype') ?
GETPOST(
'subtype') : $sourceInvoice->subtype,
'subtype', 0, 0,
'');
1237 $note_public = GETPOSTISSET(
'note_public') ?
GETPOST(
'note_public',
'restricthtml') : $sourceInvoice->note_public;
1238 $note_private = GETPOSTISSET(
'note_private') ?
GETPOST(
'note_private',
'restricthtml') : $sourceInvoice->note_private;
1241 $substitutionarray = getCommonSubstitutionArray($langs, 2,
null, $sourceInvoice);
1243 $substitutionarray[
'__INVOICE_PREVIOUS_MONTH__'] = $langs->trans(
"PreviousMonthOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
dol_time_plus_duree($sourceInvoice->date, -1,
'm'),
'%m').
')';
1244 $substitutionarray[
'__INVOICE_MONTH__'] = $langs->trans(
"MonthOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date($sourceInvoice->date,
'%m').
')';
1245 $substitutionarray[
'__INVOICE_NEXT_MONTH__'] = $langs->trans(
"NextMonthOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
dol_time_plus_duree($sourceInvoice->date, 1,
'm'),
'%m').
')';
1246 $substitutionarray[
'__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans(
"TextPreviousMonthOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
dol_time_plus_duree($sourceInvoice->date, -1,
'm'),
'%B').
')';
1247 $substitutionarray[
'__INVOICE_MONTH_TEXT__'] = $langs->trans(
"TextMonthOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date($sourceInvoice->date,
'%B').
')';
1248 $substitutionarray[
'__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans(
"TextNextMonthOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
dol_time_plus_duree($sourceInvoice->date, 1,
'm'),
'%B').
')';
1249 $substitutionarray[
'__INVOICE_PREVIOUS_YEAR__'] = $langs->trans(
"PreviousYearOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
dol_time_plus_duree($sourceInvoice->date, -1,
'y'),
'%Y').
')';
1250 $substitutionarray[
'__INVOICE_YEAR__'] = $langs->trans(
"YearOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date($sourceInvoice->date,
'%Y').
')';
1251 $substitutionarray[
'__INVOICE_NEXT_YEAR__'] = $langs->trans(
"NextYearOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
dol_time_plus_duree($sourceInvoice->date, 1,
'y'),
'%Y').
')';
1253 $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').
')';
1254 $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').
')';
1255 $substitutionarray[
'__INVOICE_COUNTER_CURRENT__'] = $langs->trans(
"Count");
1256 $substitutionarray[
'__INVOICE_COUNTER_MAX__'] = $langs->trans(
"MaxPeriodNumber");
1258 $htmltext =
'<i>'.$langs->trans(
"FollowingConstantsWillBeSubstituted").
':<br>';
1259 foreach ($substitutionarray as $key => $val) {
1260 $htmltext .= $key.
' = '.$langs->trans($val).
'<br>';
1262 $htmltext .=
'</i>';
1265 print
"<tr><td>".$langs->trans(
"Author").
"</td><td>".$user->getFullName($langs).
"</td></tr>";
1268 print
"<tr><td>".$langs->trans(
"PaymentConditions").
"</td><td>";
1269 print $form->getSelectConditionsPaiements(GETPOSTISSET(
'cond_reglement_id') ?
GETPOSTINT(
'cond_reglement_id') : $sourceInvoice->cond_reglement_id,
'cond_reglement_id', -1, 0, 0,
'');
1274 print
"<tr><td>".$langs->trans(
"PaymentMode").
"</td><td>";
1275 print
img_picto(
'',
'payment',
'class="pictofixedwidth"');
1276 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);
1281 print
"<tr><td>".$langs->trans(
'DebitBankAccount').
"</td><td>";
1282 $defaultRibId = $sourceInvoice->thirdparty->getDefaultRib();
1283 $form->selectRib(GETPOSTISSET(
'accountcustomerid') ?
GETPOSTINT(
'accountcustomerid') : $defaultRibId,
'accountcustomerid',
'fk_soc='.$sourceInvoice->socid, 1,
'', 1);
1287 $(document).ready(function() {
1288 if($("#selectmode_reglement_id option:selected").data("code") != "' . $factureRec::PAYMENTCODETOEDITSOCIETERIB .
'") {
1289 hideselectfksocieterib();
1291 $("#selectmode_reglement_id").change(function() {
1292 if($("#selectmode_reglement_id option:selected").data("code") != "'. $factureRec::PAYMENTCODETOEDITSOCIETERIB .
'") {
1293 hideselectfksocieterib(1);
1295 showselectfksocieterib();
1300 function hideselectfksocieterib(empty = 0){
1301 $("#selectaccountcustomerid").closest("tr").hide();
1303 $("#selectaccountcustomerid").val("-1").change();
1307 function showselectfksocieterib(){
1308 $("#selectaccountcustomerid").closest("tr").show();
1313 if ($sourceInvoice->fk_account > 0) {
1314 print
"<tr><td>".$langs->trans(
'BankAccount').
"</td><td>";
1315 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.$sourceInvoice->id, (
string) $sourceInvoice->fk_account,
'none');
1320 print
"<tr><td>".$langs->trans(
"RuleForLinesDates").
"</td><td>";
1321 print $form->getSelectRuleForLinesDates(GETPOSTISSET(
'rule_for_lines_dates') ?
GETPOST(
'rule_for_lines_dates',
'alpha') : $factureRec->rule_for_lines_dates);
1329 $extralabels = $extrafields->fetch_name_optionals_label($draft->table_element);
1330 if ($draft->fetch_optionals() > 0) {
1331 $sourceInvoice->array_options = array_merge($sourceInvoice->array_options, $draft->array_options);
1334 print $sourceInvoice->showOptionals($extrafields,
'create', $parameters);
1337 if (isModEnabled(
'project') && is_object($sourceInvoice->thirdparty) && $sourceInvoice->thirdparty->id > 0 && is_object($formproject)) {
1338 $projectid =
GETPOST(
'projectid') ?
GETPOST(
'projectid') : $sourceInvoice->fk_project;
1339 $langs->load(
'projects');
1340 print
'<tr><td>'.$langs->trans(
'Project').
'</td><td>';
1341 print
img_picto(
'',
'project',
'class="pictofixedwidth"');
1342 $numprojet = $formproject->select_projects($sourceInvoice->thirdparty->id, $projectid,
'projectid', 0, 0, 1, 0, 0, 0, 0,
'', 0, 0,
'');
1343 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>';
1348 print
"<tr><td>".$langs->trans(
'Model').
"</td><td>";
1349 include_once DOL_DOCUMENT_ROOT.
'/core/modules/facture/modules_facture.php';
1351 print
img_picto(
'',
'generic',
'class="pictofixedwidth"');
1353 print $form->selectarray(
'modelpdf', $list,
$conf->global->FACTURE_ADDON_PDF);
1358 print
'<td class="tdtop">';
1359 print $form->textwithpicto($langs->trans(
'NotePublic'), $htmltext, 1,
'help',
'', 0, 2,
'notepublic');
1362 $doleditor =
new DolEditor(
'note_public', $note_public,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1363 print $doleditor->Create(1);
1366 if (empty($user->socid)) {
1368 print
'<td class="tdtop">';
1369 print $form->textwithpicto($langs->trans(
'NotePrivate'), $htmltext, 1,
'help',
'', 0, 2,
'noteprivate');
1372 $doleditor =
new DolEditor(
'note_private', $note_private,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1373 print $doleditor->Create(1);
1383 $title = $langs->trans(
"Recurrence");
1386 print
'<span class="opacitymedium">'.$langs->trans(
"ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv(
'Module2300Name')).
'</span><br><br>';
1390 print
'<table class="border centpercent">';
1393 print
'<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans(
"Frequency"), $langs->transnoentitiesnoconv(
'toolTipFrequency')).
"</td><td>";
1394 print
'<input type="text" class="width50" name="frequency" value="'.GETPOST(
'frequency',
'int').
'"> ';
1395 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'));
1399 print
"<tr><td>".$langs->trans(
'NextDateToExecution').
"</td><td>";
1401 print $form->selectDate($date_next_execution,
'', 1, 1, 0,
"add", 1, 1);
1405 print
"<tr><td>".$langs->trans(
"MaxPeriodNumber").
"</td><td>";
1406 print
'<input type="text" class="width50" name="nb_gen_max" value="'.GETPOSTINT(
'nb_gen_max').
'">';
1410 print
"<tr><td>".$langs->trans(
"StatusOfAutoGeneratedInvoices").
"</td><td>";
1411 $select = array(
'0' => $langs->trans(
'BillStatusDraft'),
'1' => $langs->trans(
'BillStatusValidated'));
1412 print $form->selectarray(
'auto_validate', $select,
GETPOSTINT(
'auto_validate'));
1417 print
"<tr><td>".$langs->trans(
"StatusOfGeneratedDocuments").
"</td><td>";
1418 $select = array(
'0' => $langs->trans(
'DoNotGenerateDoc'),
'1' => $langs->trans(
'AutoGenerateDoc'));
1419 print $form->selectarray(
'generate_pdf', $select,
GETPOSTINT(
'generate_pdf'));
1422 print
'<input type="hidden" name="generate_pdf" value="1">';
1430 $title = $langs->trans(
"ProductsAndServices");
1431 if (!isModEnabled(
'service')) {
1432 $title = $langs->trans(
"Products");
1433 } elseif (!isModEnabled(
'product')) {
1434 $title = $langs->trans(
"Services");
1442 print
'<div class="div-table-responsive-no-min">';
1443 print
'<table id="tablelines" class="noborder noshadow centpercent nomarginbottom">';
1446 if (!empty($sourceInvoice->lines)) {
1447 $sourceInvoice->printOriginLinesList(
'', $selectedLines);
1456 if (!empty($flag_price_may_change)) {
1457 print
'<tr><td colspan="3" class="left">';
1458 print
'<select name="usenewprice" class="flat">';
1459 print
'<option value="0">'.$langs->trans(
"AlwaysUseFixedPrice").
'</option>';
1460 print
'<option value="1" disabled>'.$langs->trans(
"AlwaysUseNewPrice").
'</option>';
1468 print $form->buttonsSaveCancel(
"Create");
1481 if ($action ==
'ask_deleteline') {
1482 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$lineid, $langs->trans(
'DeleteProductLine'), $langs->trans(
'ConfirmDeleteProductLine'),
'confirm_deleteline',
'',
'no', 1);
1485 if ($action ==
'delete') {
1486 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteRepeatableInvoice'), $langs->trans(
'ConfirmDeleteRepeatableInvoice'),
'confirm_delete',
'',
'no', 1);
1489 if ($action ==
'ask_subtotal_deleteline') {
1490 $langs->load(
"subtotals");
1491 $title =
"DeleteSubtotalLine";
1492 $question =
"ConfirmDeleteSubtotalLine";
1493 if (
GETPOST(
'type') ==
'title') {
1494 $formconfirm = array(array(
'type' =>
'checkbox',
'name' =>
'deletecorrespondingsubtotalline',
'label' => $langs->trans(
"DeleteCorrespondingSubtotalLine"),
'value' => 0));
1495 $title =
"DeleteTitleLine";
1496 $question =
"ConfirmDeleteTitleLine";
1498 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$lineid, $langs->trans($title), $langs->trans($question),
'confirm_delete_subtotalline', $formconfirm,
'no', 1);
1502 if ($action ==
'add_title_line') {
1503 $langs->load(
'subtotals');
1505 $depth_array =
$object->getPossibleLevels($langs);
1507 } elseif ($action ==
'add_subtotal_line') {
1508 $langs->load(
'subtotals');
1510 $titles =
$object->getPossibleTitles();
1515 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
1516 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
1517 if (empty($reshook)) {
1518 $formconfirm .= $hookmanager->resPrint;
1519 } elseif ($reshook > 0) {
1520 $formconfirm = $hookmanager->resPrint;
1525 $author =
new User($db);
1526 $author->fetch(
$object->user_author);
1530 print
dol_get_fiche_head($head,
'card', $langs->trans(
"RepeatableInvoice"), -1,
'bill');
1534 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/facture/invoicetemplate_list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1537 if ($action !=
'editref') {
1538 $morehtmlref .= $form->editfieldkey(
$object->ref,
'ref',
$object->ref, $object, $user->hasRight(
'facture',
'creer'),
'',
'', 0, 2);
1540 $morehtmlref .= $form->editfieldval(
'',
'ref',
$object->ref, $object, $user->hasRight(
'facture',
'creer'),
'string');
1543 $morehtmlref .=
'<div class="refidno">';
1548 $morehtmlref .=
$object->thirdparty->getNomUrl(1,
'customer');
1550 if (isModEnabled(
'project')) {
1551 $langs->load(
"projects");
1552 $morehtmlref .=
'<br>';
1553 if ($user->hasRight(
'facture',
'creer')) {
1554 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1555 if ($action !=
'classify') {
1556 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1558 $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');
1560 if (!empty(
$object->fk_project)) {
1562 $proj->fetch(
$object->fk_project);
1563 $morehtmlref .=
' : '.$proj->getNomUrl(1);
1565 $morehtmlref .=
' - '.$proj->title;
1572 $morehtmlref .=
'</div>';
1574 $morehtmlstatus =
'';
1576 dol_banner_tab($object,
'ref', $linkback, 1,
'title',
'none', $morehtmlref,
'', 0,
'', $morehtmlstatus);
1578 print
'<div class="fichecenter">';
1579 print
'<div class="fichehalfleft">';
1580 print
'<div class="underbanner clearboth"></div>';
1582 print
'<table class="border centpercent tableforfield">';
1586 print
"<tr><td>".$langs->trans(
"InvoiceSubtype").
"</td><td>";
1588 print
$object->getSubtypeLabel(
'facture_rec');
1594 print
'<tr><td class="titlefield">'.$langs->trans(
"Author").
'</td><td>';
1595 print $author->getNomUrl(-1);
1600 print
'<table class="nobordernopadding centpercent"><tr><td>';
1601 print $langs->trans(
'PaymentConditionsShort');
1603 if ($action !=
'editconditions' && $user->hasRight(
'facture',
'creer')) {
1604 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>';
1606 print
'</tr></table>';
1608 if ($action ==
'editconditions') {
1609 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'].
'?facid='.
$object->id, (
string)
$object->cond_reglement_id,
'cond_reglement_id');
1611 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'].
'?facid='.
$object->id, (
string)
$object->cond_reglement_id,
'none');
1617 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1618 print $langs->trans(
'PaymentMode');
1620 if ($action !=
'editmode' && $user->hasRight(
'facture',
'creer')) {
1621 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>';
1623 print
'</tr></table>';
1625 if ($action ==
'editmode') {
1626 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?facid='.
$object->id, (
string)
$object->mode_reglement_id,
'mode_reglement_id',
'CRDT', 1, 1);
1628 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?facid='.
$object->id, (
string)
$object->mode_reglement_id,
'none');
1634 if (
$object->mode_reglement_code == $object::PAYMENTCODETOEDITSOCIETERIB) {
1635 print
'<tr><td class="nowrap">';
1636 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
1637 print $langs->trans(
'DebitBankAccount');
1641 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>';
1643 print
'</tr></table>';
1646 if ($action ==
'editbankaccountcustomer') {
1647 $form->formRib($_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id, (
string)
$object->fk_societe_rib,
'accountcustomerid',
'fk_soc='.$object->socid, 1, 1);
1649 $form->formRib($_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id, (
string)
$object->fk_societe_rib,
'none',
'', 0, 1);
1656 print
'<tr><td class="nowrap">';
1657 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
1658 print $langs->trans(
'BankAccount');
1661 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>';
1663 print
'</tr></table>';
1665 if ($action ==
'editbankaccount') {
1666 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
string)
$object->fk_account,
'fk_account', 1);
1668 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
string)
$object->fk_account,
'none');
1675 print
'<table class="nobordernopadding centpercent"><tr><td>';
1676 print $langs->trans(
'RuleForLinesDates');
1678 if ($action !=
'editruleforlinesdates' && $user->hasRight(
'facture',
'creer')) {
1679 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>';
1681 print
'</tr></table>';
1683 if ($action ==
'editruleforlinesdates') {
1684 $form->form_rule_for_lines_dates($_SERVER[
'PHP_SELF'].
'?facid='.
$object->id,
$object->rule_for_lines_dates,
'rule_for_lines_dates');
1686 $form->form_rule_for_lines_dates($_SERVER[
'PHP_SELF'].
'?facid='.
$object->id,
$object->rule_for_lines_dates,
'none');
1691 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1694 print
'<tr><td class="nowrap">';
1695 print
'<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
1696 print $langs->trans(
'Model');
1699 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>';
1701 print
'</tr></table>';
1703 if ($action ==
'editmodelpdf') {
1704 include_once DOL_DOCUMENT_ROOT.
'/core/modules/facture/modules_facture.php';
1707 foreach ($models as $k => $model) {
1708 $list[] = str_replace(
':',
'|', $k).
':'.$model;
1710 $select =
'select;'.implode(
',', $list);
1711 print $form->editfieldval($langs->trans(
"Model"),
'modelpdf',
$object->model_pdf, $object, $user->hasRight(
'facture',
'creer'), $select);
1725 print
'<div class="fichehalfright">';
1727 print
'<!-- amounts -->'.
"\n";
1728 print
'<div class="underbanner clearboth"></div>'.
"\n";
1731 $title = $langs->trans(
"Recurrence");
1733 print
'<table class="border tableforfield centpercent">';
1735 include DOL_DOCUMENT_ROOT.
'/core/tpl/object_currency_amount.tpl.php';
1743 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"AmountHT").
'</td>';
1744 print
'<td class="nowraponall amountcard right">'.price($sign *
$object->total_ht, 0, $langs, 1, -1, -1,
$conf->currency).
'</td>';
1745 if (isModEnabled(
"multicurrency") && (
$object->multicurrency_code &&
$object->multicurrency_code !=
$conf->currency)) {
1747 print
'<td class="nowraponall amountcard right">' .
price($sign *
$object->multicurrency_total_ht, 0, $langs, 0, -1, -1,
$object->multicurrency_code) .
'</td>';
1752 print
'<tr><td>'.$langs->trans(
"AmountVAT").
'</td>';
1753 print
'<td class="nowrap amountcard right">'.price($sign *
$object->total_tva, 0, $langs, 1, -1, -1,
$conf->currency).
'</td>';
1754 if (isModEnabled(
"multicurrency") && (
$object->multicurrency_code &&
$object->multicurrency_code !=
$conf->currency)) {
1756 print
'<td class="nowraponall amountcard right">' .
price($sign *
$object->multicurrency_total_tva, 0, $langs, 0, -1, -1,
$object->multicurrency_code) .
'</td>';
1761 if (($mysoc->localtax1_assuj ==
"1" && $mysoc->useLocalTax(1)) ||
$object->total_localtax1 != 0) {
1763 print
'<td class="titlefieldmiddle">'.$langs->transcountry(
"AmountLT1", $mysoc->country_code).
'</td>';
1764 print
'<td class="nowraponall amountcard right">'.price($sign *
$object->total_localtax1, 1,
'', 1, - 1, - 1,
$conf->currency).
'</td></tr>';
1765 if (isModEnabled(
"multicurrency") && (
$object->multicurrency_code &&
$object->multicurrency_code !=
$conf->currency)) {
1768 print
'<td class="nowraponall amountcard right">' .
price($sign *
$object->multicurrency_total_localtax1, 0, $langs, 0, -1, -1,
$object->multicurrency_code) .
'</td>';
1773 if (($mysoc->localtax2_assuj ==
"1" && $mysoc->useLocalTax(2)) ||
$object->total_localtax2 != 0) {
1775 print
'<td>'.$langs->transcountry(
"AmountLT2", $mysoc->country_code).
'</td>';
1776 print
'<td class=nowraponall amountcard right">'.price($sign *
$object->total_localtax2, 1,
'', 1, - 1, - 1,
$conf->currency).
'</td></tr>';
1777 if (isModEnabled(
"multicurrency") && (
$object->multicurrency_code &&
$object->multicurrency_code !=
$conf->currency)) {
1780 print
'<td class="nowraponall amountcard right">' .
price($sign *
$object->multicurrency_total_localtax2, 0, $langs, 0, -1, -1,
$object->multicurrency_code) .
'</td>';
1841 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>';
1842 if (isModEnabled(
"multicurrency") && (
$object->multicurrency_code &&
$object->multicurrency_code !=
$conf->currency)) {
1844 print
'<td class="nowrap amountcard right">' .
price($sign *
$object->multicurrency_total_ttc, 0, $langs, 0, -1, -1,
$object->multicurrency_code) .
'</td>';
1849 print
'<tr class="liste_titre"><td class="liste_titre">'.img_picto(
'',
'recurring',
'class="pictofixedwidth"').$title.
'</td>';
1851 if (isModEnabled(
"multicurrency") && (
$object->multicurrency_code &&
$object->multicurrency_code !=
$conf->currency)) {
1857 print
'<tr><td style="width: 50%">';
1858 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1859 print $langs->trans(
'Frequency');
1861 if ($action !=
'editfrequency' && $user->hasRight(
'facture',
'creer')) {
1862 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>';
1864 print
'</tr></table>';
1866 if ($action ==
'editfrequency') {
1867 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'?facid='.
$object->id.
'">';
1868 print
'<input type="hidden" name="action" value="setfrequency">';
1869 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1870 print
'<table class="nobordernopadding">';
1872 print
'<input type="text" name="frequency" class="width50 marginrightonly right" value="'.$object->frequency.
'">';
1873 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'));
1875 print
'<td class="left"><input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
"Modify").
'"></td>';
1876 print
'</tr></table></form>';
1879 print $langs->trans(
'FrequencyPer_'.
$object->unit_frequency,
$object->frequency);
1881 print
'<span class="opacitymedium">'.$langs->trans(
"NotARecurringInvoiceTemplate").
'</span>';
1885 if (isModEnabled(
"multicurrency") && (
$object->multicurrency_code &&
$object->multicurrency_code !=
$conf->currency)) {
1893 if ($action ==
'date_when' ||
$object->frequency > 0) {
1894 print $form->editfieldkey($langs->trans(
"NextDateToExecution"),
'date_when',
$object->date_when, $object, $user->hasRight(
'facture',
'creer'),
'day');
1896 print $langs->trans(
"NextDateToExecution");
1899 if ($action ==
'date_when' ||
$object->frequency > 0) {
1900 print $form->editfieldval($langs->trans(
"NextDateToExecution"),
'date_when',
$object->date_when, $object, $user->hasRight(
'facture',
'creer'),
'day',
$object->date_when,
null,
'',
'', 0,
'strikeIfMaxNbGenReached');
1903 if (!
$object->isMaxNbGenReached()) {
1908 print
img_info($langs->trans(
"MaxNumberOfGenerationReached"));
1911 if (isModEnabled(
"multicurrency") && (
$object->multicurrency_code &&
$object->multicurrency_code !=
$conf->currency)) {
1918 if ($action ==
'nb_gen_max' ||
$object->frequency > 0) {
1919 print $form->editfieldkey($langs->trans(
"MaxPeriodNumber"),
'nb_gen_max', (
string)
$object->nb_gen_max, $object, $user->hasRight(
'facture',
'creer'));
1921 print $langs->trans(
"MaxPeriodNumber");
1924 if ($action ==
'nb_gen_max' ||
$object->frequency > 0) {
1925 print $form->editfieldval($langs->trans(
"MaxPeriodNumber"),
'nb_gen_max',
$object->nb_gen_max ?
$object->nb_gen_max :
'',
$object, $user->hasRight(
'facture',
'creer'));
1930 if (isModEnabled(
"multicurrency") && (
$object->multicurrency_code &&
$object->multicurrency_code !=
$conf->currency)) {
1937 if ($action ==
'auto_validate' ||
$object->frequency > 0) {
1938 print $form->editfieldkey($langs->trans(
"StatusOfAutoGeneratedInvoices"),
'auto_validate', (
string)
$object->auto_validate, $object, $user->hasRight(
'facture',
'creer'));
1940 print $langs->trans(
"StatusOfAutoGeneratedInvoices");
1943 $select =
'select;0:'.$langs->trans(
'BillStatusDraft').
',1:'.$langs->trans(
'BillStatusValidated');
1944 if ($action ==
'auto_validate' ||
$object->frequency > 0) {
1945 print $form->editfieldval($langs->trans(
"StatusOfAutoGeneratedInvoices"),
'auto_validate',
$object->auto_validate, $object, $user->hasRight(
'facture',
'creer'), $select);
1948 if (isModEnabled(
"multicurrency") && (
$object->multicurrency_code &&
$object->multicurrency_code !=
$conf->currency)) {
1956 if ($action ==
'generate_pdf' ||
$object->frequency > 0) {
1957 print $form->editfieldkey($langs->trans(
"StatusOfGeneratedDocuments"),
'generate_pdf', (
string)
$object->generate_pdf, $object, $user->hasRight(
'facture',
'creer'));
1959 print $langs->trans(
"StatusOfGeneratedDocuments");
1963 $select =
'select;0:'.$langs->trans(
'DoNotGenerateDoc').
',1:'.$langs->trans(
'AutogenerateDoc');
1964 if ($action ==
'generate_pdf' ||
$object->frequency > 0) {
1965 print $form->editfieldval($langs->trans(
"StatusOfGeneratedDocuments"),
'generate_pdf',
$object->generate_pdf, $object, $user->hasRight(
'facture',
'creer'), $select);
1968 if (isModEnabled(
"multicurrency") && (
$object->multicurrency_code &&
$object->multicurrency_code !=
$conf->currency)) {
1973 print
'<input type="hidden" name="generate_pdf" value="1">';
1983 if (!isModEnabled(
'cron')) {
1984 print
info_admin($langs->trans(
"EnableAndSetupModuleCron", $langs->transnoentitiesnoconv(
"Module2300Name")));
1987 print
'<div class="underbanner clearboth"></div>';
1988 print
'<table class="border centpercent tableforfield">';
1991 print
'<tr><td style="width: 50%">'.$langs->trans(
"NbOfGenerationDone").
'</td>';
1999 print $langs->trans(
"DateLastGeneration");
2013 print
'<div class="clearboth"></div><br>';
2017 print
'<form name="addproduct" id="addproduct" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.(($action !=
'editline') ?
'#add' :
'#line_'.
GETPOSTINT(
'lineid')).
'" method="POST">';
2018 print
'<input type="hidden" name="token" value="' .
newToken().
'">';
2019 print
'<input type="hidden" name="action" value="' . (($action !=
'editline') ?
'addline' :
'updateline').
'">';
2020 print
'<input type="hidden" name="mode" value="">';
2021 print
'<input type="hidden" name="id" value="' .
$object->id.
'">';
2022 print
'<input type="hidden" name="page_y" value="">';
2024 if (!empty(
$conf->use_javascript_ajax) &&
$object->statut == 0) {
2025 if (isModEnabled(
'subtotals')) {
2026 include DOL_DOCUMENT_ROOT.
'/core/tpl/subtotal_ajaxrow.tpl.php';
2028 include DOL_DOCUMENT_ROOT .
'/core/tpl/ajaxrow.tpl.php';
2032 print
'<div class="div-table-responsive-no-min">';
2033 print
'<table id="tablelines" class="noborder noshadow centpercent nomarginbottom">';
2036 $canchangeproduct = 1;
2037 $object->printObjectLines($action, $mysoc,
$object->thirdparty, $lineid, 0);
2041 if (
$object->status == $object::STATUS_DRAFT && $user->hasRight(
'facture',
'creer') && $action !=
'valid' && $action !=
'editline') {
2042 if ($action !=
'editline') {
2045 $parameters = array();
2046 $reshook = $hookmanager->executeHooks(
'formAddObjectLine', $parameters, $object, $action);
2050 if (empty($reshook)) {
2067 print
'<div class="tabsAction">';
2069 $parameters = array();
2070 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
2071 if (empty($reshook)) {
2074 'class' =>
'classfortooltip',
2079 if (empty(
$object->suspended) && isModEnabled(
'subtotals')
2081 $langs->load(
"subtotals");
2083 $url_button = array();
2085 $url_button[] = array(
2086 'lang' =>
'subtotals',
2088 'perm' => (
bool) $usercancreate,
2089 'label' => $langs->trans(
'AddTitleLine'),
2090 'url' =>
'/compta/facture/card-rec.php?id='.$object->id.
'&action=add_title_line&token='.
newToken()
2093 $url_button[] = array(
2094 'lang' =>
'subtotals',
2096 'perm' => (
bool) $usercancreate,
2097 'label' => $langs->trans(
'AddSubtotalLine'),
2098 'url' =>
'/compta/facture/card-rec.php?id='.$object->id.
'&action=add_subtotal_line&token='.
newToken()
2100 print
dolGetButtonAction(
'', $langs->trans(
'Subtotal'),
'default', $url_button,
'',
true);
2103 if (empty(
$object->suspended)) {
2104 if ($user->hasRight(
'facture',
'creer')) {
2106 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' .
dol_escape_htmltag($langs->trans(
"MaxGenerationReached")) .
'">' . $langs->trans(
"CreateBill") .
'</a></div>';
2108 if (empty(
$object->frequency) ||
$object->date_when <= $nowlasthour) {
2109 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>';
2111 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' .
dol_escape_htmltag($langs->trans(
"DateIsNotEnough")) .
'">' . $langs->trans(
"CreateBill") .
'</a></div>';
2115 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans(
"CreateBill") .
'</a></div>';
2119 if ($user->hasRight(
'facture',
'creer')) {
2120 if (empty(
$object->suspended)) {
2121 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>';
2123 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>';
2128 print
dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id .
'&action=delete&token=' .
newToken(),
'delete', $user->hasRight(
'facture',
'supprimer'));
2134 print
'<div class="fichecenter"><div class="fichehalfleft">';
2135 print
'<a name="builddoc"></a>';
2139 $tmparray = $form->showLinkToObjectBlock($object, array(), array(
'invoice'), 1);
2140 $linktoelem = $tmparray[
'linktoelem'];
2141 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
2142 print $htmltoenteralink;
2144 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
2148 print
'<div class="fichehalfright">';
2153 $morehtmlcenter =
'';
2156 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2158 $morehtmlcenter =
'';
2159 $somethingshown = $formactions->showactions($object,
$object->element, (is_object(
$object->thirdparty) ?
$object->thirdparty->id : 0), 1,
'', $MAXEVENT,
'', $morehtmlcenter);
2164 print $langs->trans(
"NoRecordFound");
$id
Support class for third parties, contacts, members, users or resources.
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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_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...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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 '.
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.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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.
GETPOSTFLOAT($paramname, $rounding='')
Return the value of a $_GET or $_POST supervariable, converted into float.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_clone($object, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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, 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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.