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';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/invoice.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
50$langs->loadLangs(array(
'bills',
'companies',
'compta',
'admin',
'other',
'products',
'banks'));
52$action =
GETPOST(
'action',
'alpha');
53$massaction =
GETPOST(
'massaction',
'alpha');
55$confirm =
GETPOST(
'confirm',
'alpha');
56$cancel =
GETPOST(
'cancel',
'alpha');
57$toselect =
GETPOST(
'toselect',
'array');
58$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'invoicetemplatelist';
59$backtopage =
GETPOST(
'backtopage',
'alpha');
60$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
67 $socid = $user->socid;
69$objecttype =
'facture_rec';
70if ($action ==
"create" || $action ==
"add") {
75$year_date_when =
GETPOST(
'year_date_when');
76$month_date_when =
GETPOST(
'month_date_when');
77$selectedLines =
GETPOST(
'toselect',
'array');
80$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
81$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
83if (empty($page) || $page == -1) {
86$offset = $limit * $page;
91 $sortfield =
'f.titre';
97if (($id > 0 || $ref) && $action !=
'create' && $action !=
'add') {
98 $ret =
$object->fetch($id, $ref);
105$hookmanager->initHooks(array(
'invoicereccard',
'globalcard'));
109$extrafields->fetch_name_optionals_label(
$object->table_element);
111$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
113$permissionnote = $user->hasRight(
'facture',
'creer');
114$permissiondellink = $user->hasRight(
'facture',
'creer');
115$permissiontoedit = $user->hasRight(
'facture',
'creer');
117$usercanread = $user->hasRight(
'facture',
'lire');
118$usercancreate = $user->hasRight(
'facture',
'creer');
119$usercanissuepayment = $user->hasRight(
'facture',
'paiement');
120$usercandelete = $user->hasRight(
'facture',
'supprimer');
123$usercanvalidate = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'facture',
'invoice_advance',
'validate')));
124$usercansend = (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->rights->facture->invoice_advance->send);
125$usercanreopen = (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->rights->facture->invoice_advance->reopen);
126$usercanunvalidate = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !empty($usercancreate)) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'facture',
'invoice_advance',
'unvalidate')));
129$usercanproductignorepricemin = ((
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !$user->hasRight(
'produit',
'ignore_price_min_advance')) || !
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS'));
130$usercancreatemargin = $user->hasRight(
"margins",
"creer");
131$usercanreadallmargin = $user->hasRight(
"margins",
"liretous");
132$usercancreatewithdrarequest = $user->hasRight(
"prelevement",
"bons",
"creer");
146if (
GETPOST(
'cancel',
'alpha')) {
150if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
154$parameters = array();
155$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
160if (empty($reshook)) {
161 $backurlforlist = DOL_URL_ROOT.
'/compta/facture/invoicetemplate_list.php';
163 if (empty($backtopage) || ($cancel && empty($id))) {
164 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
165 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
166 $backtopage = $backurlforlist;
168 $backtopage = DOL_URL_ROOT.
'/compta/facture/invoicetemplate_list.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
176 if (!empty($backtopageforcancel)) {
177 header(
"Location: ".$backtopageforcancel);
179 } elseif (!empty($backtopage)) {
180 header(
"Location: ".$backtopage);
187 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
190 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
192 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
194 include DOL_DOCUMENT_ROOT.
'/core/actions_lineupdown.inc.php';
203 if ($action ==
'add' && $usercancreate) {
204 if (!
GETPOST(
'title',
'alphanohtml')) {
205 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->trans(
"Title")),
null,
'errors');
220 if (empty($reyear) || empty($remonth) || empty($reday)) {
221 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->trans(
"Date")),
null,
'errors');
243 $object->frequency = $frequency;
245 $object->nb_gen_max = $nb_gen_max;
248 $object->fk_project = $projectid;
250 $date_next_execution =
dol_mktime($rehour, $remin, 0, $remonth, $reday, $reyear);
251 $object->date_when = $date_next_execution;
253 $ret = $extrafields->setOptionalsFromPost(
null, $object);
263 $srcObject->fetchObjectLinked();
265 if (!empty($srcObject->linkedObjectsIds[
'contrat'])) {
266 $contractidid = reset($srcObject->linkedObjectsIds[
'contrat']);
269 $object->origin_id = $contractidid;
276 $oldinvoice =
new Facture($db);
279 $onlylines =
GETPOST(
'toselect',
'array');
281 $result =
$object->create($user, $oldinvoice->id, 0, $onlylines);
283 $result = $oldinvoice->delete($user, 1);
298 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?facid='.
$object->id);
309 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'facture',
'supprimer')) {
312 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/invoicetemplate_list.php');
318 if ($action ==
'setconditions' && $usercancreate) {
320 $object->context[
'actionmsg'] = $langs->trans(
"FieldXModified", $langs->transnoentitiesnoconv(
"PaymentTerm"));
322 } elseif ($action ==
'setmode' && $usercancreate) {
324 $object->context[
'actionmsg'] = $langs->trans(
"FieldXModified", $langs->transnoentitiesnoconv(
"PaymentMode"));
326 } elseif ($action ==
'classin' && $usercancreate) {
328 $object->context[
'actionmsg'] = $langs->trans(
"FieldXModified", $langs->transnoentitiesnoconv(
"Project"));
330 } elseif ($action ==
'setref' && $usercancreate) {
332 $object->context[
'actionmsg'] = $langs->trans(
"FieldXModifiedFromYToZ", $langs->transnoentitiesnoconv(
"Title"),
$object->title, $ref);
333 $result =
$object->setValueFrom(
'titre', $ref,
'',
null,
'text',
'', $user,
'BILLREC_MODIFY');
339 if (
$object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
340 $langs->load(
"errors");
341 setEventMessages($langs->trans(
'ErrorRefAlreadyExists', $ref),
null,
'errors');
346 } elseif ($action ==
'setbankaccount' && $usercancreate) {
348 $object->context[
'actionmsg'] = $langs->trans(
"FieldXModified", $langs->transnoentitiesnoconv(
"Bank"));
350 } elseif ($action ==
'setfrequency' && $usercancreate) {
352 $object->context[
'actionmsg'] = $langs->trans(
"FieldXModified", $langs->transnoentitiesnoconv(
"Frequency"));
354 } elseif ($action ==
'setdate_when' && $usercancreate) {
360 } elseif ($action ==
'setnb_gen_max' && $usercancreate) {
363 } elseif ($action ==
'setauto_validate' && $usercancreate) {
366 } elseif ($action ==
'setgenerate_pdf' && $usercancreate) {
369 } elseif ($action ==
'setmodelpdf' && $usercancreate) {
372 } elseif ($action ==
'disable' && $usercancreate) {
376 $object->context[
'actionmsg'] = $langs->trans(
"RecordDisabled");
378 $res =
$object->setValueFrom(
'suspended', 1,
'',
null,
'text',
'', $user,
'BILLREC_MODIFY');
389 } elseif ($action ==
'enable' && $usercancreate) {
393 $object->context[
'actionmsg'] = $langs->trans(
"RecordEnabled");
395 $res =
$object->setValueFrom(
'suspended', 0,
'',
null,
'text',
'', $user,
'BILLREC_MODIFY');
406 } elseif ($action ==
'setmulticurrencycode' && $usercancreate) {
408 $result =
$object->setMulticurrencyCode(
GETPOST(
'multicurrency_code',
'alpha'));
409 } elseif ($action ==
'setmulticurrencyrate' && $usercancreate) {
415 if ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $usercancreate) {
426 if ($line->delete($user) > 0) {
427 $result =
$object->update_price(1);
440 } elseif ($action ==
'update_extras' && $usercancreate) {
444 $ret = $extrafields->setOptionalsFromPost(
null, $object,
GETPOST(
'attribute',
'restricthtml'));
450 $result =
$object->insertExtraFields(
'BILLREC_MODIFY');
459 if ($action ==
'addline' && $usercancreate) {
460 $langs->load(
'errors');
465 $product_desc = (GETPOSTISSET(
'dp_desc') ?
GETPOST(
'dp_desc',
'restricthtml') :
'');
468 $prod_entry_mode =
GETPOST(
'prod_entry_mode',
'alpha');
469 if ($prod_entry_mode ==
'free') {
475 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ProductOrService")),
null,
'errors');
480 $tva_tx = (
GETPOST(
'tva_tx',
'alpha') ?
GETPOST(
'tva_tx',
'alpha') : 0);
484 if (empty($remise_percent)) {
489 $extralabelsline = $extrafields->fetch_name_optionals_label(
$object->table_element_line);
490 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line, $predef);
492 if (is_array($extralabelsline)) {
494 foreach ($extralabelsline as $key => $value) {
495 unset($_POST[
"options_".$key.$predef]);
499 if ((empty($idprod) || $idprod < 0) && ($price_ht < 0) && ($qty < 0)) {
500 setEventMessages($langs->trans(
'ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv(
'UnitPriceHT'), $langs->transnoentitiesnoconv(
'Qty')),
null,
'errors');
503 if ($prod_entry_mode ==
'free' && (empty($idprod) || $idprod < 0) &&
GETPOST(
'type') < 0) {
504 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Type')),
null,
'errors');
507 if ($prod_entry_mode ==
'free' && (empty($idprod) || $idprod < 0) && (!($price_ht >= 0) || $price_ht ==
'')) {
508 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"UnitPriceHT")),
null,
'errors');
512 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Qty')),
null,
'errors');
515 if ($prod_entry_mode ==
'free' && (empty($idprod) || $idprod < 0) && empty($product_desc)) {
516 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Description')),
null,
'errors');
520 $langs->load(
"errors");
521 setEventMessages($langs->trans(
'ErrorQtyForCustomerInvoiceCantBeNegative'),
null,
'errors');
525 if (!$error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) {
531 $ret =
$object->fetch_thirdparty();
536 $price_base_type = (
GETPOST(
'price_base_type',
'alpha') ?
GETPOST(
'price_base_type',
'alpha') :
'HT');
547 if (!empty($idprod) && $idprod > 0) {
549 $prod->fetch($idprod);
551 $label = ((
GETPOST(
'product_label') &&
GETPOST(
'product_label') != $prod->label) ?
GETPOST(
'product_label') :
'');
563 $datapriceofproduct = $prod->getSellPrice($mysoc,
$object->thirdparty, $pqp);
565 $pu_ht = $datapriceofproduct[
'pu_ht'];
566 $pu_ttc = $datapriceofproduct[
'pu_ttc'];
567 $price_min = $datapriceofproduct[
'price_min'];
568 $price_base_type = empty($datapriceofproduct[
'price_base_type']) ?
'HT' : $datapriceofproduct[
'price_base_type'];
572 $tmpvat = (float)
price2num(preg_replace(
'/\s*\(.*\)/',
'', $tva_tx));
573 $tmpprodvat =
price2num(preg_replace(
'/\s*\(.*\)/',
'', (
string) $prod->tva_tx));
576 if (!empty($price_ht)) {
578 $pu_ttc =
price2num((
float) $pu_ht * (1 + ($tmpvat / 100)),
'MU');
579 } elseif ($tmpvat != $tmpprodvat) {
582 if ($price_base_type !=
'HT') {
583 $pu_ht =
price2num((
float) $pu_ttc / (1 + ($tmpvat / 100)),
'MU');
585 $pu_ttc =
price2num((
float) $pu_ht * (1 + ($tmpvat / 100)),
'MU');
593 $outputlangs = $langs;
595 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
596 $newlang =
GETPOST(
'lang_id',
'aZ09');
598 if (empty($newlang)) {
599 $newlang =
$object->thirdparty->default_lang;
601 if (!empty($newlang)) {
603 $outputlangs->setDefaultLang($newlang);
606 $desc = (!empty($prod->multilangs [$outputlangs->defaultlang] [
"description"])) ? $prod->multilangs [$outputlangs->defaultlang] [
"description"] : $prod->
description;
608 $desc = $prod->description;
614 if (!
getDolGlobalString(
'MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE') && (!empty($prod->customcode) || !empty($prod->country_code))) {
618 $outputlangs = $langs;
620 if (empty($newlang) &&
GETPOST(
'lang_id',
'alpha')) {
621 $newlang =
GETPOST(
'lang_id',
'alpha');
623 if (empty($newlang)) {
624 $newlang =
$object->thirdparty->default_lang;
626 if (!empty($newlang)) {
628 $outputlangs->setDefaultLang($newlang);
629 $outputlangs->load(
'products');
631 if (!empty($prod->customcode)) {
632 $tmptxt .= $outputlangs->transnoentitiesnoconv(
"CustomCode").
': '.$prod->customcode;
634 if (!empty($prod->customcode) && !empty($prod->country_code)) {
637 if (!empty($prod->country_code)) {
638 $tmptxt .= $outputlangs->transnoentitiesnoconv(
"CountryOrigin").
': '.
getCountry($prod->country_code,
'', $db, $outputlangs, 0);
641 if (!empty($prod->customcode)) {
642 $tmptxt .= $langs->transnoentitiesnoconv(
"CustomCode").
': '.$prod->customcode;
644 if (!empty($prod->customcode) && !empty($prod->country_code)) {
647 if (!empty($prod->country_code)) {
648 $tmptxt .= $langs->transnoentitiesnoconv(
"CountryOrigin").
': '.
getCountry($prod->country_code,
'', $db, $langs, 0);
656 $fk_unit = $prod->fk_unit;
660 $tva_npr = (preg_match(
'/\*/', $tva_tx) ? 1 : 0);
661 $tva_tx = str_replace(
'*',
'', $tva_tx);
662 if (empty($tva_tx)) {
665 $label = (
GETPOST(
'product_label') ?
GETPOST(
'product_label') :
'');
666 $desc = $product_desc;
668 $fk_unit =
GETPOST(
'units',
'alpha');
671 $date_start_fill =
GETPOSTINT(
'date_start_fill');
687 $fk_parent_line =
GETPOST(
'fk_parent_line',
'int');
689 if ($usercanproductignorepricemin && (!empty($price_min) && ((
float)
price2num($pu_ht) * (1 - (
float)
price2num($remise_percent) / 100) < (
float)
price2num($price_min)))) {
690 $mesg = $langs->trans(
"CantBeLessThanMinPrice",
price(
price2num($price_min,
'MU'), 0, $langs, 0, 0, -1, $conf->currency));
694 $result =
$object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, 0, $pu_ttc, $type, -1, $special_code, $label, $fk_unit, 0, $date_start_fill, $date_end_fill, $fournprice, $buyingprice, $fk_parent_line);
717 unset($_POST[
'prod_entry_mode']);
719 unset($_POST[
'qty']);
720 unset($_POST[
'type']);
721 unset($_POST[
'remise_percent']);
722 unset($_POST[
'price_ht']);
723 unset($_POST[
'multicurrency_price_ht']);
724 unset($_POST[
'price_ttc']);
725 unset($_POST[
'tva_tx']);
726 unset($_POST[
'product_ref']);
727 unset($_POST[
'product_label']);
728 unset($_POST[
'product_desc']);
729 unset($_POST[
'fournprice']);
730 unset($_POST[
'buying_price']);
731 unset($_POST[
'np_marginRate']);
732 unset($_POST[
'np_markRate']);
733 unset($_POST[
'dp_desc']);
734 unset($_POST[
'idprod']);
735 unset($_POST[
'units']);
737 unset($_POST[
'date_starthour']);
738 unset($_POST[
'date_startmin']);
739 unset($_POST[
'date_startsec']);
740 unset($_POST[
'date_startday']);
741 unset($_POST[
'date_startmonth']);
742 unset($_POST[
'date_startyear']);
743 unset($_POST[
'date_endhour']);
744 unset($_POST[
'date_endmin']);
745 unset($_POST[
'date_endsec']);
746 unset($_POST[
'date_endday']);
747 unset($_POST[
'date_endmonth']);
748 unset($_POST[
'date_endyear']);
750 unset($_POST[
'date_start_fill']);
751 unset($_POST[
'date_end_fill']);
753 unset($_POST[
'situations']);
754 unset($_POST[
'progress']);
762 } elseif ($action ==
'updateline' && $usercancreate && !
GETPOST(
'cancel',
'alpha')) {
763 if (!
$object->fetch($id) > 0) {
781 if (preg_match(
'/\*/', $vat_rate)) {
786 $vat_rate = str_replace(
'*',
'', $vat_rate);
795 $extralabelsline = $extrafields->fetch_name_optionals_label(
$object->table_element_line);
796 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
799 if ($objectline->fetch(
GETPOSTINT(
'lineid'))) {
800 $objectline->array_options = $array_options;
801 $result = $objectline->insertExtraFields();
807 $position = ($objectline->rang >= 0 ? $objectline->rang : 0);
810 if (is_array($extralabelsline)) {
812 foreach ($extralabelsline as $key => $value) {
813 unset($_POST[
"options_".$key]);
819 if ($special_code == 3) {
836 if (empty($remise_percent)) {
842 if (!empty($productid)) {
844 $product->fetch($productid);
846 $type = $product->type;
848 $price_min = $product->price_min;
850 $price_min = $product->multiprices_min[
$object->thirdparty->price_level];
859 setEventMessages($langs->trans(
"CantBeLessThanMinPrice",
price(
price2num($price_min,
'MU'), 0, $langs, 0, 0, - 1, $conf->currency)),
null,
'errors');
864 $label = (
GETPOST(
'product_label') ?
GETPOST(
'product_label') :
'');
868 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
873 $langs->load(
"errors");
874 setEventMessages($langs->trans(
'ErrorQtyForCustomerInvoiceCantBeNegative'),
null,
'errors');
878 $date_start_fill =
GETPOSTINT(
'date_start_fill');
880 $fk_parent_line =
GETPOST(
'fk_parent_line',
'int');
932 unset($_POST[
'qty']);
933 unset($_POST[
'type']);
934 unset($_POST[
'productid']);
935 unset($_POST[
'remise_percent']);
936 unset($_POST[
'price_ht']);
937 unset($_POST[
'multicurrency_price_ht']);
938 unset($_POST[
'price_ttc']);
939 unset($_POST[
'tva_tx']);
940 unset($_POST[
'product_ref']);
941 unset($_POST[
'product_label']);
942 unset($_POST[
'product_desc']);
943 unset($_POST[
'fournprice']);
944 unset($_POST[
'buying_price']);
945 unset($_POST[
'np_marginRate']);
946 unset($_POST[
'np_markRate']);
948 unset($_POST[
'dp_desc']);
949 unset($_POST[
'idprod']);
950 unset($_POST[
'units']);
952 unset($_POST[
'date_starthour']);
953 unset($_POST[
'date_startmin']);
954 unset($_POST[
'date_startsec']);
955 unset($_POST[
'date_startday']);
956 unset($_POST[
'date_startmonth']);
957 unset($_POST[
'date_startyear']);
958 unset($_POST[
'date_endhour']);
959 unset($_POST[
'date_endmin']);
960 unset($_POST[
'date_endsec']);
961 unset($_POST[
'date_endday']);
962 unset($_POST[
'date_endmonth']);
963 unset($_POST[
'date_endyear']);
965 unset($_POST[
'situations']);
966 unset($_POST[
'progress']);
979$title =
$object->ref.
" - ".$langs->trans(
'Card');
984$form =
new Form($db);
986if (isModEnabled(
'project')) {
991$companystatic =
new Societe($db);
999if ($action ==
'create') {
1000 print
load_fiche_titre($langs->trans(
"CreateRepeatableInvoice"),
'',
'bill');
1003 $product_static =
new Product($db);
1005 if (
$object->fetch($id, $ref) > 0) {
1006 $result =
$object->getLinesArray();
1008 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
1009 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1010 print
'<input type="hidden" name="action" value="add">';
1011 print
'<input type="hidden" name="facid" value="'.$object->id.
'">';
1016 if (isModEnabled(
'project')) {
1019 if (
$object->fk_account > 0) {
1023 print
'<table class="border centpercent">';
1028 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Title").
'</td><td>';
1029 print
'<input class="flat quatrevingtpercent" type="text" name="title" value="'.dol_escape_htmltag(
GETPOST(
"title",
'alphanohtml')).
'" autofocus>';
1033 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Customer").
'</td><td>'.
$object->thirdparty->getNomUrl(1,
'customer').
'</td>';
1038 print
"<tr><td>".$langs->trans(
"InvoiceSubtype").
"</td><td>";
1039 print $form->getSelectInvoiceSubtype(GETPOSTISSET(
'subtype') ?
GETPOST(
'subtype') :
$object->subtype,
'subtype', 0, 0,
'');
1043 $note_public = GETPOSTISSET(
'note_public') ?
GETPOST(
'note_public',
'restricthtml') :
$object->note_public;
1044 $note_private = GETPOSTISSET(
'note_private') ?
GETPOST(
'note_private',
'restricthtml') :
$object->note_private;
1049 $substitutionarray[
'__INVOICE_PREVIOUS_MONTH__'] = $langs->trans(
"PreviousMonthOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
dol_time_plus_duree(
$object->date, -1,
'm'),
'%m').
')';
1050 $substitutionarray[
'__INVOICE_MONTH__'] = $langs->trans(
"MonthOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
$object->date,
'%m').
')';
1052 $substitutionarray[
'__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans(
"TextPreviousMonthOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
dol_time_plus_duree(
$object->date, -1,
'm'),
'%B').
')';
1053 $substitutionarray[
'__INVOICE_MONTH_TEXT__'] = $langs->trans(
"TextMonthOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
$object->date,
'%B').
')';
1054 $substitutionarray[
'__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans(
"TextNextMonthOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
dol_time_plus_duree(
$object->date, 1,
'm'),
'%B').
')';
1056 $substitutionarray[
'__INVOICE_YEAR__'] = $langs->trans(
"YearOfInvoice").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
$object->date,
'%Y').
')';
1059 $substitutionarray[
'__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans(
"DateNextInvoiceBeforeGen").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
dol_time_plus_duree(
$object->date, 1,
'm'),
'dayhour').
')';
1060 $substitutionarray[
'__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans(
"DateNextInvoiceAfterGen").
' ('.$langs->trans(
"Example").
': '.
dol_print_date(
dol_time_plus_duree(
$object->date, 2,
'm'),
'dayhour').
')';
1061 $substitutionarray[
'__INVOICE_COUNTER_CURRENT__'] = $langs->trans(
"Count");
1062 $substitutionarray[
'__INVOICE_COUNTER_MAX__'] = $langs->trans(
"MaxPeriodNumber");
1064 $htmltext =
'<i>'.$langs->trans(
"FollowingConstantsWillBeSubstituted").
':<br>';
1065 foreach ($substitutionarray as $key => $val) {
1066 $htmltext .= $key.
' = '.$langs->trans($val).
'<br>';
1068 $htmltext .=
'</i>';
1071 print
"<tr><td>".$langs->trans(
"Author").
"</td><td>".$user->getFullName($langs).
"</td></tr>";
1074 print
"<tr><td>".$langs->trans(
"PaymentConditions").
"</td><td>";
1075 print $form->getSelectConditionsPaiements(GETPOSTISSET(
'cond_reglement_id') ?
GETPOSTINT(
'cond_reglement_id') :
$object->cond_reglement_id,
'cond_reglement_id', -1, 0, 0,
'');
1080 print
"<tr><td>".$langs->trans(
"PaymentMode").
"</td><td>";
1081 print
img_picto(
'',
'payment',
'class="pictofixedwidth"');
1082 print $form->select_types_paiements(GETPOSTISSET(
'mode_reglement_id') ?
GETPOSTINT(
'mode_reglement_id') :
$object->mode_reglement_id,
'mode_reglement_id',
'', 0, 1, 0, 0, 1,
'', 1);
1087 if (
$object->fk_account > 0) {
1088 print
"<tr><td>".$langs->trans(
'BankAccount').
"</td><td>";
1089 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->fk_account,
'none');
1098 $extralabels = $extrafields->fetch_name_optionals_label($draft->table_element);
1099 if ($draft->fetch_optionals() > 0) {
1100 $object->array_options = array_merge(
$object->array_options, $draft->array_options);
1103 print
$object->showOptionals($extrafields,
'create', $parameters);
1106 if (isModEnabled(
'project') && is_object(
$object->thirdparty) &&
$object->thirdparty->id > 0 && is_object($formproject)) {
1108 $langs->load(
'projects');
1109 print
'<tr><td>'.$langs->trans(
'Project').
'</td><td>';
1110 print
img_picto(
'',
'project',
'class="pictofixedwidth"');
1111 $numprojet = $formproject->select_projects(
$object->thirdparty->id, $projectid,
'projectid', 0, 0, 1, 0, 0, 0, 0,
'', 0, 0,
'');
1112 print
' <a href="'.DOL_URL_ROOT.
'/projet/card.php?socid='.
$object->thirdparty->id.
'&action=create&status=1&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?action=create&socid='.
$object->thirdparty->id.(!empty($id) ?
'&id='.$id :
'')).
'">'.
img_object($langs->trans(
"AddProject"),
'add').
'</a>';
1117 print
"<tr><td>".$langs->trans(
'Model').
"</td><td>";
1118 include_once DOL_DOCUMENT_ROOT.
'/core/modules/facture/modules_facture.php';
1120 print
img_picto(
'',
'generic',
'class="pictofixedwidth"');
1122 print $form->selectarray(
'modelpdf', $list, $conf->global->FACTURE_ADDON_PDF);
1127 print
'<td class="tdtop">';
1128 print $form->textwithpicto($langs->trans(
'NotePublic'), $htmltext, 1,
'help',
'', 0, 2,
'notepublic');
1131 $doleditor =
new DolEditor(
'note_public', $note_public,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3,
'90%');
1132 print $doleditor->Create(1);
1135 if (empty($user->socid)) {
1137 print
'<td class="tdtop">';
1138 print $form->textwithpicto($langs->trans(
'NotePrivate'), $htmltext, 1,
'help',
'', 0, 2,
'noteprivate');
1141 $doleditor =
new DolEditor(
'note_private', $note_private,
'', 80,
'dolibarr_notes',
'In',
false,
false, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3,
'90%');
1142 print $doleditor->Create(1);
1152 $title = $langs->trans(
"Recurrence");
1155 print
'<span class="opacitymedium">'.$langs->trans(
"ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv(
'Module2300Name')).
'</span><br><br>';
1159 print
'<table class="border centpercent">';
1162 print
'<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans(
"Frequency"), $langs->transnoentitiesnoconv(
'toolTipFrequency')).
"</td><td>";
1163 print
'<input type="text" class="width50" name="frequency" value="'.GETPOST(
'frequency',
'int').
'"> ';
1164 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'));
1168 print
"<tr><td>".$langs->trans(
'NextDateToExecution').
"</td><td>";
1170 print $form->selectDate($date_next_execution,
'', 1, 1, 0,
"add", 1, 1);
1174 print
"<tr><td>".$langs->trans(
"MaxPeriodNumber").
"</td><td>";
1175 print
'<input type="text" class="width50" name="nb_gen_max" value="'.GETPOSTINT(
'nb_gen_max').
'">';
1179 print
"<tr><td>".$langs->trans(
"StatusOfAutoGeneratedInvoices").
"</td><td>";
1180 $select = array(
'0' => $langs->trans(
'BillStatusDraft'),
'1' => $langs->trans(
'BillStatusValidated'));
1181 print $form->selectarray(
'auto_validate', $select,
GETPOSTINT(
'auto_validate'));
1186 print
"<tr><td>".$langs->trans(
"StatusOfGeneratedDocuments").
"</td><td>";
1187 $select = array(
'0' => $langs->trans(
'DoNotGenerateDoc'),
'1' => $langs->trans(
'AutoGenerateDoc'));
1188 print $form->selectarray(
'generate_pdf', $select,
GETPOSTINT(
'generate_pdf'));
1191 print
'<input type="hidden" name="generate_pdf" value="1">';
1199 $title = $langs->trans(
"ProductsAndServices");
1200 if (!isModEnabled(
'service')) {
1201 $title = $langs->trans(
"Products");
1202 } elseif (!isModEnabled(
'product')) {
1203 $title = $langs->trans(
"Services");
1211 print
'<div class="div-table-responsive-no-min">';
1212 print
'<table id="tablelines" class="noborder noshadow centpercent">';
1216 $object->printOriginLinesList(
'', $selectedLines);
1225 if (!empty($flag_price_may_change)) {
1226 print
'<tr><td colspan="3" class="left">';
1227 print
'<select name="usenewprice" class="flat">';
1228 print
'<option value="0">'.$langs->trans(
"AlwaysUseFixedPrice").
'</option>';
1229 print
'<option value="1" disabled>'.$langs->trans(
"AlwaysUseNewPrice").
'</option>';
1235 print $form->buttonsSaveCancel(
"Create");
1248 if ($action ==
'ask_deleteline') {
1249 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$lineid, $langs->trans(
'DeleteProductLine'), $langs->trans(
'ConfirmDeleteProductLine'),
'confirm_deleteline',
'',
'no', 1);
1252 if ($action ==
'delete') {
1253 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteRepeatableInvoice'), $langs->trans(
'ConfirmDeleteRepeatableInvoice'),
'confirm_delete',
'',
'no', 1);
1257 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
1258 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
1259 if (empty($reshook)) {
1260 $formconfirm .= $hookmanager->resPrint;
1261 } elseif ($reshook > 0) {
1262 $formconfirm = $hookmanager->resPrint;
1267 $author =
new User($db);
1268 $author->fetch(
$object->user_author);
1272 print
dol_get_fiche_head($head,
'card', $langs->trans(
"RepeatableInvoice"), -1,
'bill');
1276 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/facture/invoicetemplate_list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1279 if ($action !=
'editref') {
1280 $morehtmlref .= $form->editfieldkey(
$object->ref,
'ref',
$object->ref, $object, $user->hasRight(
'facture',
'creer'),
'',
'', 0, 2);
1282 $morehtmlref .= $form->editfieldval(
'',
'ref',
$object->ref, $object, $user->hasRight(
'facture',
'creer'),
'string');
1285 $morehtmlref .=
'<div class="refidno">';
1290 $morehtmlref .=
$object->thirdparty->getNomUrl(1,
'customer');
1292 if (isModEnabled(
'project')) {
1293 $langs->load(
"projects");
1294 $morehtmlref .=
'<br>';
1295 if ($user->hasRight(
'facture',
'creer')) {
1296 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1297 if ($action !=
'classify') {
1298 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1300 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->socid,
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
1302 if (!empty(
$object->fk_project)) {
1304 $proj->fetch(
$object->fk_project);
1305 $morehtmlref .=
' : '.$proj->getNomUrl(1);
1307 $morehtmlref .=
' - '.$proj->title;
1314 $morehtmlref .=
'</div>';
1316 $morehtmlstatus =
'';
1318 dol_banner_tab($object,
'ref', $linkback, 1,
'title',
'none', $morehtmlref,
'', 0,
'', $morehtmlstatus);
1320 print
'<div class="fichecenter">';
1321 print
'<div class="fichehalfleft">';
1322 print
'<div class="underbanner clearboth"></div>';
1324 print
'<table class="border centpercent tableforfield">';
1328 print
"<tr><td>".$langs->trans(
"InvoiceSubtype").
"</td><td>";
1330 print
$object->getSubtypeLabel(
'facture_rec');
1336 print
'<tr><td class="titlefield">'.$langs->trans(
"Author").
'</td><td>';
1337 print $author->getNomUrl(-1);
1341 print
'<tr><td>'.$langs->trans(
"AmountHT").
'</td>';
1342 print
'<td>'.price(
$object->total_ht, 0, $langs, 1, -1, -1, $conf->currency).
'</td>';
1346 print
'<tr><td>'.$langs->trans(
"AmountVAT").
'</td><td>'.
price(
$object->total_tva, 0, $langs, 1, -1, -1, $conf->currency).
'</td>';
1350 if (($mysoc->localtax1_assuj ==
"1" && $mysoc->useLocalTax(1)) ||
$object->total_localtax1 != 0) {
1351 print
'<tr><td>'.$langs->transcountry(
"AmountLT1", $mysoc->country_code).
'</td>';
1352 print
'<td class="nowrap">'.price(
$object->total_localtax1, 1,
'', 1, - 1, - 1, $conf->currency).
'</td></tr>';
1354 if (($mysoc->localtax2_assuj ==
"1" && $mysoc->useLocalTax(2)) ||
$object->total_localtax2 != 0) {
1355 print
'<tr><td>'.$langs->transcountry(
"AmountLT2", $mysoc->country_code).
'</td>';
1356 print
'<td class=nowrap">'.price(
$object->total_localtax2, 1,
'', 1, - 1, - 1, $conf->currency).
'</td></tr>';
1359 print
'<tr><td>'.$langs->trans(
"AmountTTC").
'</td><td colspan="3">'.
price(
$object->total_ttc, 0, $langs, 1, -1, -1, $conf->currency).
'</td>';
1365 print
'<table class="nobordernopadding centpercent"><tr><td>';
1366 print $langs->trans(
'PaymentConditionsShort');
1368 if ($action !=
'editconditions' && $user->hasRight(
'facture',
'creer')) {
1369 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>';
1371 print
'</tr></table>';
1374 if ($action ==
'editconditions') {
1375 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'].
'?facid='.
$object->id,
$object->cond_reglement_id,
'cond_reglement_id');
1377 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'].
'?facid='.
$object->id,
$object->cond_reglement_id,
'none');
1386 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1387 print $langs->trans(
'PaymentMode');
1389 if ($action !=
'editmode' && $user->hasRight(
'facture',
'creer')) {
1390 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>';
1392 print
'</tr></table>';
1394 if ($action ==
'editmode') {
1395 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?facid='.
$object->id,
$object->mode_reglement_id,
'mode_reglement_id',
'CRDT', 1, 1);
1397 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?facid='.
$object->id,
$object->mode_reglement_id,
'none');
1403 print
'<tr><td class="nowrap">';
1404 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
1405 print $langs->trans(
'BankAccount');
1408 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>';
1410 print
'</tr></table>';
1412 if ($action ==
'editbankaccount') {
1413 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->fk_account,
'fk_account', 1);
1415 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->fk_account,
'none');
1421 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1427 print
'<tr><td class="nowrap">';
1428 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
1429 print $langs->trans(
'Model');
1432 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>';
1434 print
'</tr></table>';
1436 if ($action ==
'editmodelpdf') {
1437 include_once DOL_DOCUMENT_ROOT.
'/core/modules/facture/modules_facture.php';
1440 foreach ($models as $k => $model) {
1441 $list[] = str_replace(
':',
'|', $k).
':'.$model;
1443 $select =
'select;'.implode(
',', $list);
1444 print $form->editfieldval($langs->trans(
"Model"),
'modelpdf',
$object->model_pdf, $object, $user->hasRight(
'facture',
'creer'), $select);
1458 print
'<div class="fichehalfright">';
1459 print
'<div class="underbanner clearboth"></div>';
1465 $title = $langs->trans(
"Recurrence");
1467 print
'<table class="border centpercent tableforfield">';
1469 include DOL_DOCUMENT_ROOT.
'/core/tpl/object_currency_amount.tpl.php';
1471 print
'<tr><td colspan="2">'.img_picto(
'',
'recurring',
'class="pictofixedwidth"').$title.
'</td></tr>';
1474 print
'<tr><td style="width: 50%">';
1475 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1476 print $langs->trans(
'Frequency');
1478 if ($action !=
'editfrequency' && $user->hasRight(
'facture',
'creer')) {
1479 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>';
1481 print
'</tr></table>';
1483 if ($action ==
'editfrequency') {
1484 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'?facid='.
$object->id.
'">';
1485 print
'<input type="hidden" name="action" value="setfrequency">';
1486 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1487 print
'<table class="nobordernopadding">';
1489 print
'<input type="text" name="frequency" class="width50 marginrightonly right" value="'.$object->frequency.
'">';
1490 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'));
1492 print
'<td class="left"><input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
"Modify").
'"></td>';
1493 print
'</tr></table></form>';
1496 print $langs->trans(
'FrequencyPer_'.
$object->unit_frequency,
$object->frequency);
1498 print
'<span class="opacitymedium">'.$langs->trans(
"NotARecurringInvoiceTemplate").
'</span>';
1505 if ($action ==
'date_when' ||
$object->frequency > 0) {
1506 print $form->editfieldkey($langs->trans(
"NextDateToExecution"),
'date_when',
$object->date_when, $object, $user->hasRight(
'facture',
'creer'),
'day');
1508 print $langs->trans(
"NextDateToExecution");
1511 if ($action ==
'date_when' ||
$object->frequency > 0) {
1512 print $form->editfieldval($langs->trans(
"NextDateToExecution"),
'date_when',
$object->date_when, $object, $user->hasRight(
'facture',
'creer'),
'day',
$object->date_when,
null,
'',
'', 0,
'strikeIfMaxNbGenReached');
1515 if (!
$object->isMaxNbGenReached()) {
1520 print
img_info($langs->trans(
"MaxNumberOfGenerationReached"));
1527 if ($action ==
'nb_gen_max' ||
$object->frequency > 0) {
1528 print $form->editfieldkey($langs->trans(
"MaxPeriodNumber"),
'nb_gen_max',
$object->nb_gen_max, $object, $user->hasRight(
'facture',
'creer'));
1530 print $langs->trans(
"MaxPeriodNumber");
1533 if ($action ==
'nb_gen_max' ||
$object->frequency > 0) {
1534 print $form->editfieldval($langs->trans(
"MaxPeriodNumber"),
'nb_gen_max',
$object->nb_gen_max ?
$object->nb_gen_max :
'',
$object, $user->hasRight(
'facture',
'creer'));
1543 if ($action ==
'auto_validate' ||
$object->frequency > 0) {
1544 print $form->editfieldkey($langs->trans(
"StatusOfAutoGeneratedInvoices"),
'auto_validate',
$object->auto_validate, $object, $user->hasRight(
'facture',
'creer'));
1546 print $langs->trans(
"StatusOfAutoGeneratedInvoices");
1549 $select =
'select;0:'.$langs->trans(
'BillStatusDraft').
',1:'.$langs->trans(
'BillStatusValidated');
1550 if ($action ==
'auto_validate' ||
$object->frequency > 0) {
1551 print $form->editfieldval($langs->trans(
"StatusOfAutoGeneratedInvoices"),
'auto_validate',
$object->auto_validate, $object, $user->hasRight(
'facture',
'creer'), $select);
1558 if ($action ==
'generate_pdf' ||
$object->frequency > 0) {
1559 print $form->editfieldkey($langs->trans(
"StatusOfGeneratedDocuments"),
'generate_pdf',
$object->generate_pdf, $object, $user->hasRight(
'facture',
'creer'));
1561 print $langs->trans(
"StatusOfGeneratedDocuments");
1565 $select =
'select;0:'.$langs->trans(
'DoNotGenerateDoc').
',1:'.$langs->trans(
'AutogenerateDoc');
1566 if ($action ==
'generate_pdf' ||
$object->frequency > 0) {
1567 print $form->editfieldval($langs->trans(
"StatusOfGeneratedDocuments"),
'generate_pdf',
$object->generate_pdf, $object, $user->hasRight(
'facture',
'creer'), $select);
1572 print
'<input type="hidden" name="generate_pdf" value="1">';
1581 if (!isModEnabled(
'cron')) {
1582 print
info_admin($langs->trans(
"EnableAndSetupModuleCron", $langs->transnoentitiesnoconv(
"Module2300Name")));
1585 print
'<div class="underbanner clearboth"></div>';
1586 print
'<table class="border centpercent tableforfield">';
1589 print
'<tr><td style="width: 50%">'.$langs->trans(
"NbOfGenerationDone").
'</td>';
1597 print $langs->trans(
"DateLastGeneration");
1611 print
'<div class="clearboth"></div><br>';
1615 print
'<form name="addproduct" id="addproduct" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.(($action !=
'editline') ?
'#add' :
'#line_'.
GETPOSTINT(
'lineid')).
'" method="POST">';
1616 print
'<input type="hidden" name="token" value="' .
newToken().
'">';
1617 print
'<input type="hidden" name="action" value="' . (($action !=
'editline') ?
'addline' :
'updateline').
'">';
1618 print
'<input type="hidden" name="mode" value="">';
1619 print
'<input type="hidden" name="id" value="' .
$object->id.
'">';
1620 print
'<input type="hidden" name="page_y" value="">';
1622 if (!empty($conf->use_javascript_ajax) &&
$object->statut == 0) {
1623 include DOL_DOCUMENT_ROOT.
'/core/tpl/ajaxrow.tpl.php';
1626 print
'<div class="div-table-responsive-no-min">';
1627 print
'<table id="tablelines" class="noborder noshadow centpercent">';
1630 $canchangeproduct = 1;
1631 $object->printObjectLines($action, $mysoc,
$object->thirdparty, $lineid, 0);
1635 if (
$object->status == $object::STATUS_DRAFT && $user->hasRight(
'facture',
'creer') && $action !=
'valid' && $action !=
'editline') {
1636 if ($action !=
'editline') {
1639 $parameters = array();
1640 $reshook = $hookmanager->executeHooks(
'formAddObjectLine', $parameters, $object, $action);
1644 if (empty($reshook)) {
1661 print
'<div class="tabsAction">';
1663 $parameters = array();
1664 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1665 if (empty($reshook)) {
1668 'class' =>
'classfortooltip',
1671 if (empty(
$object->suspended)) {
1672 if ($user->hasRight(
'facture',
'creer')) {
1674 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' .
dol_escape_htmltag($langs->trans(
"MaxGenerationReached")) .
'">' . $langs->trans(
"CreateBill") .
'</a></div>';
1676 if (empty(
$object->frequency) ||
$object->date_when <= $nowlasthour) {
1677 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>';
1679 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' .
dol_escape_htmltag($langs->trans(
"DateIsNotEnough")) .
'">' . $langs->trans(
"CreateBill") .
'</a></div>';
1683 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans(
"CreateBill") .
'</a></div>';
1687 if ($user->hasRight(
'facture',
'creer')) {
1688 if (empty(
$object->suspended)) {
1689 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>';
1691 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>';
1696 print
dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id .
'&action=delete&token=' .
newToken(),
'delete', $user->hasRight(
'facture',
'supprimer'));
1702 print
'<div class="fichecenter"><div class="fichehalfleft">';
1703 print
'<a name="builddoc"></a>';
1707 $tmparray = $form->showLinkToObjectBlock($object, array(), array(
'invoice'), 1);
1708 $linktoelem = $tmparray[
'linktoelem'];
1709 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
1710 print $htmltoenteralink;
1712 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
1716 print
'<div class="fichehalfright">';
1721 $morehtmlcenter =
'';
1724 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1726 $somethingshown = $formactions->showactions($object,
$object->element, (is_object(
$object->thirdparty) ?
$object->thirdparty->id : 0), 1,
'', $MAXEVENT,
'', $morehtmlcenter);
1731 print $langs->trans(
"NoRecordFound");
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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 TYPE_STANDARD
Standard invoice.
const TYPE_CREDIT_NOTE
Credit note 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.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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)
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.
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'.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
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_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null, $include=null)
Return array of possible common substitutions.
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.
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.