34require
'../../main.inc.php';
35require_once DOL_DOCUMENT_ROOT .
'/fourn/class/fournisseur.facture-rec.class.php';
36require_once DOL_DOCUMENT_ROOT .
'/fourn/class/fournisseur.product.class.php';
37require_once DOL_DOCUMENT_ROOT .
'/product/class/product.class.php';
38require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formother.class.php';
39if (isModEnabled(
'project')) {
40 include_once DOL_DOCUMENT_ROOT .
'/projet/class/project.class.php';
42require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formprojet.class.php';
43require_once DOL_DOCUMENT_ROOT .
'/core/class/doleditor.class.php';
44require_once DOL_DOCUMENT_ROOT .
'/core/lib/invoice.lib.php';
45require_once DOL_DOCUMENT_ROOT .
'/core/class/extrafields.class.php';
48$langs->loadLangs(array(
'bills',
'companies',
'compta',
'admin',
'other',
'products',
'banks',
'suppliers'));
50$action =
GETPOST(
'action',
'alpha');
51$massaction =
GETPOST(
'massaction',
'alpha');
52$show_files =
GETPOST(
'show_files',
'int');
53$confirm =
GETPOST(
'confirm',
'alpha');
54$cancel =
GETPOST(
'cancel',
'alpha');
55$toselect =
GETPOST(
'toselect',
'array');
56$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'supplierinvoicetemplatelist';
58$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
59$sortfield =
GETPOST(
"sortfield",
'alpha');
60$sortorder =
GETPOST(
"sortorder",
'alpha');
61$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
65$lineid =
GETPOST(
'lineid',
'int');
66$title =
GETPOST(
'title',
'alpha');
67$libelle =
GETPOST(
'libelle',
'alpha');
68$ref_supplier =
GETPOST(
'ref_supplier',
'alpha');
69$projectid =
GETPOST(
'projectid',
'int');
70$year_date_when =
GETPOST(
'year_date_when');
71$month_date_when =
GETPOST(
'month_date_when');
73 $socid = $user->socid;
75$objecttype =
'facture_fourn_rec';
76if ($action ==
"create" || $action ==
"add") {
80if (empty($page) || $page == -1) {
83$offset = $limit * $page;
88 $sortfield =
'f.titre';
94if (($id > 0 || $title) && $action !=
'create' && $action !=
'add') {
95 $ret = $object->fetch($id, $title);
102$hookmanager->initHooks(array(
'supplierinvoicereccard',
'globalcard'));
106$extrafields->fetch_name_optionals_label($object->table_element);
108$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
110$permissionnote = $user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer");
111$permissiondellink = $user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer");
112$permissiontoedit = $user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer");
114$usercanread = $user->hasRight(
"fournisseur",
"facture",
"lire") || $user->hasRight(
"supplier_invoice",
"lire");
115$usercancreate = $user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer");
116$usercandelete = $user->hasRight(
"fournisseur",
"facture",
"supprimer") || $user->hasRight(
"supplier_invoice",
"supprimer");
117$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($usercancreate)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight(
"fournisseur",
"supplier_invoice_advance",
"validate")));
118$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->hasRight(
"fournisseur",
"supplier_invoice_advance",
"send"));
120$usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->hasRight(
"produit",
"ignore_price_min_advance")) || empty($conf->global->MAIN_USE_ADVANCED_PERMS));
121$usercancreatemargin = $user->hasRight(
"margins",
"creer");
122$usercanreadallmargin = $user->hasRight(
"margins",
"liretous");
123$usercancreatewithdrarequest = $user->hasRight(
"prelevement",
"bons",
"creer");
129$result =
restrictedArea($user,
'supplier_invoicerec', $object->id, $objecttype);
137if (
GETPOST(
'cancel',
'alpha')) {
141if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
145$parameters = array(
'socid' => $socid);
146$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
151if (empty($reshook)) {
152 if (
GETPOST(
'cancel',
'alpha')) {
157 include DOL_DOCUMENT_ROOT .
'/core/actions_changeselectedfields.inc.php';
160 include DOL_DOCUMENT_ROOT .
'/core/actions_setnotes.inc.php';
162 include DOL_DOCUMENT_ROOT .
'/core/actions_dellink.inc.php';
164 include DOL_DOCUMENT_ROOT .
'/core/actions_lineupdown.inc.php';
167 if ($action ==
'add') {
168 if (!
GETPOST(
'title',
'alphanohtml')) {
169 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->trans(
"Title")),
null,
'errors');
174 $frequency =
GETPOST(
'frequency',
'int');
175 $reyear =
GETPOST(
'reyear',
'int');
176 $remonth =
GETPOST(
'remonth',
'int');
177 $reday =
GETPOST(
'reday',
'int');
178 $rehour =
GETPOST(
'rehour',
'int');
179 $remin =
GETPOST(
'remin',
'int');
180 $nb_gen_max =
GETPOST(
'nb_gen_max',
'int');
183 if (
GETPOST(
'frequency',
'int')) {
184 if (empty($reyear) || empty($remonth) || empty($reday)) {
185 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->trans(
"Date")),
null,
'errors');
192 $object->titre =
GETPOST(
'title',
'alphanohtml');
193 $object->title =
GETPOST(
'title',
'alphanohtml');
194 $object->libelle =
GETPOST(
'libelle',
'alpha');
195 $object->fk_project =
GETPOST(
'projectid',
'int');
196 $object->ref_supplier =
GETPOST(
'ref_supplier',
'alphanohtml');
198 $object->note_private =
GETPOST(
'note_private',
'restricthtml');
199 $object->note_public =
GETPOST(
'note_public',
'restricthtml');
200 $object->model_pdf =
GETPOST(
'modelpdf',
'alpha');
201 $object->usenewprice =
GETPOST(
'usenewprice',
'alpha');
203 $object->frequency = $frequency;
204 $object->unit_frequency =
GETPOST(
'unit_frequency',
'alpha');
205 $object->nb_gen_max = $nb_gen_max;
206 $object->auto_validate =
GETPOST(
'auto_validate',
'int');
207 $object->generate_pdf =
GETPOST(
'generate_pdf',
'int');
209 $date_next_execution =
dol_mktime($rehour, $remin, 0, $remonth, $reday, $reyear);
210 $object->date_when = $date_next_execution;
215 $oldinvoice->fetch(
GETPOST(
'facid',
'int'));
217 $object->cond_reglement_id = $oldinvoice->cond_reglement_id;
218 $object->cond_reglement_code = $oldinvoice->cond_reglement_code;
219 $object->cond_reglement_label = $oldinvoice->cond_reglement_label;
220 $object->cond_reglement_doc = $oldinvoice->cond_reglement_doc;
221 $object->mode_reglement_id = $oldinvoice->mode_reglement_id;
222 $object->mode_reglement_code = $oldinvoice->mode_reglement_code;
224 $result = $object->create($user, $oldinvoice->id);
227 $result = $oldinvoice->delete($user, 1);
242 header(
"Location: " . $_SERVER[
'PHP_SELF'] .
'?facid=' . $object->id);
256 if ($action ==
'confirm_deleteinvoice' && $confirm ==
'yes' && ($user->hasRight(
"fournisseur",
"facture",
"supprimer") || $user->hasRight(
"supplier_invoice",
"supprimer"))) {
257 $object->delete($user);
259 header(
'Location: ' . DOL_URL_ROOT .
'/fourn/facture/list-rec.php');
265 if ($action ==
'setconditions' && $usercancreate) {
266 $result = $object->setPaymentTerms(
GETPOST(
'cond_reglement_id',
'int'));
267 } elseif ($action ==
'setmode' && $usercancreate) {
269 $result = $object->setPaymentMethods(
GETPOST(
'mode_reglement_id',
'int'));
270 } elseif ($action ==
'classin' && $usercancreate) {
272 $object->setProject(
GETPOST(
'projectid',
'int'));
273 } elseif ($action ==
'setref_supplier' && $usercancreate) {
274 $result = $object->setValueFrom(
'ref_supplier', $ref_supplier,
'',
null,
'text',
'', $user);
278 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
279 $langs->load(
"errors");
280 setEventMessages($langs->trans(
'ErrorRefAlreadyExists', $ref_supplier),
null,
'errors');
285 } elseif ($action ==
'settitle' && $usercancreate) {
286 $result = $object->setValueFrom(
'titre', $title,
'',
null,
'text',
'', $user);
289 $object->titre = $title;
290 $object->title = $title;
291 $object->ref = $object->title;
294 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
295 $langs->load(
"errors");
296 setEventMessages($langs->trans(
'ErrorTitreAlreadyExists', $title),
null,
'errors');
301 } elseif ($action ==
'setbankaccount' && $usercancreate) {
303 $result = $object->setBankAccount(
GETPOST(
'fk_account',
'int'));
304 } elseif ($action ==
'setfrequency' && $usercancreate) {
306 $object->setFrequencyAndUnit(
GETPOST(
'frequency',
'int'),
GETPOST(
'unit_frequency',
'alpha'));
307 } elseif ($action ==
'setdate_when' && $usercancreate) {
311 $object->setNextDate($date);
313 } elseif ($action ==
'setnb_gen_max' && $usercancreate) {
315 $object->setMaxPeriod(
GETPOST(
'nb_gen_max',
'int'));
316 } elseif ($action ==
'setauto_validate' && $usercancreate) {
318 $object->setAutoValidate(
GETPOST(
'auto_validate',
'int'));
319 } elseif ($action ==
'setgenerate_pdf' && $usercancreate) {
321 $object->setGeneratepdf(
GETPOST(
'generate_pdf',
'int'));
322 } elseif ($action ==
'setmodelpdf' && $usercancreate) {
324 $object->setModelpdf(
GETPOST(
'modelpdf',
'alpha'));
325 } elseif ($action ==
'disable' && $usercancreate) {
331 $res = $object->setValueFrom(
'suspended', 1);
342 } elseif ($action ==
'enable' && $usercancreate) {
348 $res = $object->setValueFrom(
'suspended', 0);
359 } elseif ($action ==
'setmulticurrencycode' && $usercancreate) {
361 $result = $object->setMulticurrencyCode(
GETPOST(
'multicurrency_code',
'alpha'));
362 } elseif ($action ==
'setmulticurrencyrate' && $usercancreate) {
364 $result = $object->setMulticurrencyRate(
price2num(
GETPOST(
'multicurrency_tx')),
GETPOST(
'calculation_mode',
'int'));
365 } elseif ($action ==
'setlibelle' && $usercancreate) {
368 $object->libelle =
GETPOST(
'libelle');
369 $result = $object->update($user);
377 if ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $usercancreate) {
379 $object->fetch_thirdparty();
388 if ($line->delete($user) > 0) {
389 $result = $object->update_price(1);
393 $object->fetch($object->id);
402 } elseif ($action ==
'update_extras') {
406 $ret = $extrafields->setOptionalsFromPost(
null, $object,
GETPOST(
'attribute',
'restricthtml'));
412 $result = $object->insertExtraFields(
'BILLREC_MODIFY');
421 if ($action ==
'addline' && $usercancreate) {
422 $langs->load(
'errors');
427 $product_desc = (GETPOSTISSET(
'dp_desc') ?
GETPOST(
'dp_desc',
'restricthtml') :
'');
430 $prod_entry_mode =
GETPOST(
'prod_entry_mode',
'alpha');
431 if ($prod_entry_mode ==
'free') {
433 $tva_tx = (
GETPOST(
'tva_tx',
'alpha') ?
GETPOST(
'tva_tx',
'alpha') : 0);
434 $ref_fournisseur = (GETPOSTISSET(
'fourn_ref') ?
GETPOST(
'fourn_ref',
'restricthtml') :
'');
436 $idprod =
GETPOST(
'idprod',
'int');
444 $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
445 $array_options = $extrafields->getOptionalsFromPost($object->table_element_line, $predef);
447 if (is_array($extralabelsline)) {
449 foreach ($extralabelsline as $key => $value) {
450 unset($_POST[
"options_" . $key . $predef]);
454 if ((empty($idprod) || $idprod < 0) && ($price_ht < 0) && ($qty < 0)) {
455 setEventMessages($langs->trans(
'ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv(
'UnitPriceHT'), $langs->transnoentitiesnoconv(
'Qty')),
null,
'errors');
458 if ($prod_entry_mode ==
'free' && (empty($idprod) || $idprod < 0) &&
GETPOST(
'type') < 0) {
459 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Type')),
null,
'errors');
462 if ($prod_entry_mode ==
'free' && (empty($idprod) || $idprod < 0) && (! ($price_ht >= 0) || $price_ht ==
'')) {
463 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"UnitPriceHT")),
null,
'errors');
467 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Qty')),
null,
'errors');
470 if ($prod_entry_mode ==
'free' && (empty($idprod) || $idprod < 0) && empty($product_desc)) {
471 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Description')),
null,
'errors');
475 $langs->load(
"errors");
476 setEventMessages($langs->trans(
'ErrorQtyForCustomerInvoiceCantBeNegative'),
null,
'errors');
480 if ($prod_entry_mode !=
'free' && empty($error)) {
484 if (
GETPOST(
'idprodfournprice',
'alpha') == -1 ||
GETPOST(
'idprodfournprice',
'alpha') ==
'') {
488 if (preg_match(
'/^idprod_([0-9]+)$/',
GETPOST(
'idprodfournprice',
'alpha'), $reg)) {
489 $idprod = (int) $reg[1];
490 $res = $productsupplier->fetch($idprod);
493 if (!empty($conf->global->SUPPLIER_TAKE_FIRST_PRICE_IF_NO_PRICE_FOR_CURRENT_SUPPLIER)) {
495 $productsupplier->get_buyprice(0, -1, $idprod,
'none', $fksoctosearch);
496 if ($productsupplier->fourn_socid != $socid) {
497 $productsupplier->ref_supplier =
'';
500 $fksoctosearch = $object->thirdparty->id;
501 $productsupplier->get_buyprice(0, -1, $idprod,
'none', $fksoctosearch);
503 } elseif (
GETPOST(
'idprodfournprice',
'alpha') > 0) {
505 $idprod = $productsupplier->get_buyprice(
GETPOST(
'idprodfournprice',
'alpha'), $qtytosearch);
506 $res = $productsupplier->fetch($idprod);
507 $ref_fournisseur = $productsupplier->ref_supplier;
511 if (! $error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) {
512 $ret = $object->fetch($id);
517 $ret = $object->fetch_thirdparty();
520 $date_start =
dol_mktime(
GETPOST(
'date_start' . $predef .
'hour'),
GETPOST(
'date_start' . $predef .
'min'),
GETPOST(
'date_start' . $predef .
'sec'),
GETPOST(
'date_start' . $predef .
'month'),
GETPOST(
'date_start' . $predef .
'day'),
GETPOST(
'date_start' . $predef .
'year'));
521 $date_end =
dol_mktime(
GETPOST(
'date_end' . $predef .
'hour'),
GETPOST(
'date_end' . $predef .
'min'),
GETPOST(
'date_end' . $predef .
'sec'),
GETPOST(
'date_end' . $predef .
'month'),
GETPOST(
'date_end' . $predef .
'day'),
GETPOST(
'date_end' . $predef .
'year'));
522 $price_base_type = (
GETPOST(
'price_base_type',
'alpha') ?
GETPOST(
'price_base_type',
'alpha') :
'HT');
533 if (!empty($idprod) && $idprod > 0) {
535 $prod->fetch($idprod);
537 $label = ((
GETPOST(
'product_label') &&
GETPOST(
'product_label') != $prod->label) ?
GETPOST(
'product_label') :
'');
542 if (empty($tva_tx)) {
549 $datapriceofproduct = $prod->getSellPrice($object->thirdparty, $mysoc, $pqp);
551 $pu_ht = $datapriceofproduct[
'pu_ht'];
552 $pu_ttc = $datapriceofproduct[
'pu_ttc'];
553 $price_min = $datapriceofproduct[
'price_min'];
554 $price_base_type = empty($datapriceofproduct[
'price_base_type']) ?
'HT' : $datapriceofproduct[
'price_base_type'];
555 $tva_tx = $datapriceofproduct[
'tva_tx'];
556 $tva_npr = $datapriceofproduct[
'tva_npr'];
558 $tmpvat =
price2num(preg_replace(
'/\s*\(.*\)/',
'', $tva_tx));
559 $tmpprodvat =
price2num(preg_replace(
'/\s*\(.*\)/',
'', $prod->tva_tx));
562 if (!empty($price_ht)) {
564 $pu_ttc =
price2num($pu_ht * (1 + ($tmpvat / 100)),
'MU');
565 } elseif ($tmpvat != $tmpprodvat) {
568 if ($price_base_type !=
'HT') {
569 $pu_ht =
price2num($pu_ttc / (1 + ($tmpvat / 100)),
'MU');
571 $pu_ttc =
price2num($pu_ht * (1 + ($tmpvat / 100)),
'MU');
578 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
579 $outputlangs = $langs;
581 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
582 $newlang =
GETPOST(
'lang_id',
'aZ09');
584 if (empty($newlang)) {
585 $newlang = $object->thirdparty->default_lang;
587 if (!empty($newlang)) {
589 $outputlangs->setDefaultLang($newlang);
592 $desc = (!empty($prod->multilangs [$outputlangs->defaultlang] [
"description"])) ? $prod->multilangs [$outputlangs->defaultlang] [
"description"] : $prod->
description;
594 $desc = $prod->description;
600 if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (!empty($prod->customcode) || !empty($prod->country_code))) {
603 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
604 $outputlangs = $langs;
606 if (empty($newlang) &&
GETPOST(
'lang_id',
'alpha')) {
607 $newlang =
GETPOST(
'lang_id',
'alpha');
609 if (empty($newlang)) {
610 $newlang = $object->thirdparty->default_lang;
612 if (!empty($newlang)) {
614 $outputlangs->setDefaultLang($newlang);
615 $outputlangs->load(
'products');
617 if (!empty($prod->customcode)) {
618 $tmptxt .= $outputlangs->transnoentitiesnoconv(
"CustomCode") .
': ' . $prod->customcode;
620 if (!empty($prod->customcode) && !empty($prod->country_code)) {
623 if (!empty($prod->country_code)) {
624 $tmptxt .= $outputlangs->transnoentitiesnoconv(
"CountryOrigin") .
': ' .
getCountry($prod->country_code, 0, $db, $outputlangs, 0);
627 if (!empty($prod->customcode)) {
628 $tmptxt .= $langs->transnoentitiesnoconv(
"CustomCode") .
': ' . $prod->customcode;
630 if (!empty($prod->customcode) && !empty($prod->country_code)) {
633 if (!empty($prod->country_code)) {
634 $tmptxt .= $langs->transnoentitiesnoconv(
"CountryOrigin") .
': ' .
getCountry($prod->country_code, 0, $db, $langs, 0);
642 $fk_unit = $prod->fk_unit;
646 $tva_npr = (preg_match(
'/\*/', $tva_tx) ? 1 : 0);
647 $tva_tx = str_replace(
'*',
'', $tva_tx);
648 if (empty($tva_tx)) {
651 $desc = $product_desc;
653 $fk_unit =
GETPOST(
'units',
'alpha');
656 $date_start_fill = !empty(
GETPOST(
'date_start_fill',
'int')) ?
GETPOST(
'date_start_fill',
'int') : null;
657 $date_end_fill = !empty(
GETPOST(
'date_end_fill',
'int')) ?
GETPOST(
'date_end_fill',
'int') : null;
664 $localtax1_tx =
get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr);
665 $localtax2_tx =
get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr);
673 $remise_percent = (float)
price2num($remise_percent);
675 $price_min = (float)
price2num($price_min);
676 if ($usercanproductignorepricemin && (!empty($price_min) && ($pu_ht * (1 - $remise_percent / 100) < $price_min))) {
677 $mesg = $langs->trans(
"CantBeLessThanMinPrice",
price(
price2num($price_min,
'MU'), 0, $langs, 0, 0, -1, $conf->currency));
681 $result = $object->addline($idprod, $ref_fournisseur, $label, $desc, $pu_ht, $pu_ttc, $qty, $remise_percent, $tva_tx, $localtax1_tx, $localtax2_tx, $price_base_type, $type, $date_start_fill, $date_end_fill, $info_bits, $special_code, -1, $fk_unit);
684 $object->fetch($object->id);
686 unset($_POST[
'prod_entry_mode']);
687 unset($_POST[
'qty']);
688 unset($_POST[
'type']);
689 unset($_POST[
'remise_percent']);
690 unset($_POST[
'price_ht']);
691 unset($_POST[
'multicurrency_price_ht']);
692 unset($_POST[
'price_ttc']);
693 unset($_POST[
'tva_tx']);
694 unset($_POST[
'product_ref']);
695 unset($_POST[
'product_label']);
696 unset($_POST[
'product_desc']);
697 unset($_POST[
'fournprice']);
698 unset($_POST[
'buying_price']);
699 unset($_POST[
'np_marginRate']);
700 unset($_POST[
'np_markRate']);
701 unset($_POST[
'dp_desc']);
702 unset($_POST[
'idprod']);
703 unset($_POST[
'units']);
704 unset($_POST[
'date_starthour']);
705 unset($_POST[
'date_startmin']);
706 unset($_POST[
'date_startsec']);
707 unset($_POST[
'date_startday']);
708 unset($_POST[
'date_startmonth']);
709 unset($_POST[
'date_startyear']);
710 unset($_POST[
'date_endhour']);
711 unset($_POST[
'date_endmin']);
712 unset($_POST[
'date_endsec']);
713 unset($_POST[
'date_endday']);
714 unset($_POST[
'date_endmonth']);
715 unset($_POST[
'date_endyear']);
716 unset($_POST[
'date_start_fill']);
717 unset($_POST[
'date_end_fill']);
718 unset($_POST[
'situations']);
719 unset($_POST[
'progress']);
720 unset($_POST[
'fourn_ref']);
728 } elseif ($action ==
'updateline' && $usercancreate && !
GETPOST(
'cancel',
'alpha')) {
729 if (! $object->fetch($id) > 0) {
732 $object->fetch_thirdparty();
738 $ref_fourn =
GETPOST(
'fourn_ref',
'alpha');
746 if (preg_match(
'/\*/', $vat_rate)) {
751 $vat_rate = str_replace(
'*',
'', $vat_rate);
752 $localtax1_rate =
get_localtax($vat_rate, 1, $object->thirdparty);
753 $localtax2_rate =
get_localtax($vat_rate, 2, $object->thirdparty);
756 $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
757 $array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
760 if ($objectline->fetch(
GETPOST(
'lineid',
'int'))) {
761 $objectline->array_options = $array_options;
762 $result = $objectline->insertExtraFields();
768 $position = ($objectline->rang >= 0 ? $objectline->rang : 0);
771 if (is_array($extralabelsline)) {
773 foreach ($extralabelsline as $key => $value) {
774 unset($_POST[
"options_" . $key]);
779 $special_code =
GETPOST(
'special_code',
'int');
780 if (!
GETPOST(
'qty',
'alpha')) {
787 $productid =
GETPOST(
'productid',
'int');
788 if (!empty($productid)) {
790 $product->fetch($productid);
792 $type = $product->type;
794 $price_min = $product->price_min;
795 if (!empty($conf->global->PRODUIT_MULTIPRICES) && !empty($object->thirdparty->price_level)) {
796 $price_min = $product->multiprices_min[$object->thirdparty->price_level];
799 $label = $product->label;
802 if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->hasRight(
"produit",
"ignore_price_min_advance")) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && $price_min && (
price2num($pu_ht) * (1 - $remise_percent / 100) <
price2num($price_min))) {
803 setEventMessages($langs->trans(
"CantBeLessThanMinPrice",
price(
price2num($price_min,
'MU'), 0, $langs, 0, 0, -1, $conf->currency)),
null,
'errors');
807 $type =
GETPOST(
'type',
'int');
808 $label = (
GETPOST(
'product_label') ?
GETPOST(
'product_label') :
'');
811 if (
GETPOST(
'type',
'int') < 0) {
812 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
817 $langs->load(
"errors");
818 setEventMessages($langs->trans(
'ErrorQtyForCustomerInvoiceCantBeNegative'),
null,
'errors');
822 $date_start_fill = !empty(
GETPOST(
'date_start_fill',
'int')) ?
GETPOST(
'date_start_fill',
'int') :
'NULL';
823 $date_end_fill = !empty(
GETPOST(
'date_end_fill',
'int')) ?
GETPOST(
'date_end_fill',
'int') :
'NULL';
827 $result = $object->updateline(
GETPOST(
'lineid',
'int'),
GETPOST(
'productid',
'int'), $ref_fourn, $label, $description, $pu_ht, $qty, $remise_percent, $vat_rate, $localtax1_rate, $localtax1_rate,
'HT', $type, $date_start_fill, $date_end_fill, $info_bits, $special_code, -1);
829 $object->fetch($object->id);
831 unset($_POST[
'qty']);
832 unset($_POST[
'type']);
833 unset($_POST[
'productid']);
834 unset($_POST[
'remise_percent']);
835 unset($_POST[
'price_ht']);
836 unset($_POST[
'multicurrency_price_ht']);
837 unset($_POST[
'price_ttc']);
838 unset($_POST[
'tva_tx']);
839 unset($_POST[
'product_ref']);
840 unset($_POST[
'product_label']);
841 unset($_POST[
'product_desc']);
842 unset($_POST[
'fournprice']);
843 unset($_POST[
'buying_price']);
844 unset($_POST[
'np_marginRate']);
845 unset($_POST[
'np_markRate']);
846 unset($_POST[
'dp_desc']);
847 unset($_POST[
'idprod']);
848 unset($_POST[
'units']);
849 unset($_POST[
'date_starthour']);
850 unset($_POST[
'date_startmin']);
851 unset($_POST[
'date_startsec']);
852 unset($_POST[
'date_startday']);
853 unset($_POST[
'date_startmonth']);
854 unset($_POST[
'date_startyear']);
855 unset($_POST[
'date_endhour']);
856 unset($_POST[
'date_endmin']);
857 unset($_POST[
'date_endsec']);
858 unset($_POST[
'date_endday']);
859 unset($_POST[
'date_endmonth']);
860 unset($_POST[
'date_endyear']);
861 unset($_POST[
'situations']);
862 unset($_POST[
'progress']);
863 unset($_POST[
'fourn_ref']);
876llxHeader(
'', $langs->trans(
"RepeatableSupplierInvoice"), $help_url);
878$form =
new Form($db);
880if (isModEnabled(
'project')) {
883$companystatic =
new Societe($db);
892if ($action ==
'create') {
893 print
load_fiche_titre($langs->trans(
"CreateRepeatableInvoice"),
'',
'bill');
896 $product_static =
new Product($db);
898 if ($object->fetch($id) > 0) {
899 $result = $object->fetch_lines();
901 print
'<form action="' . $_SERVER[
"PHP_SELF"] .
'" method="POST">';
902 print
'<input type="hidden" name="token" value="' . newToken() .
'">';
903 print
'<input type="hidden" name="action" value="add">';
904 print
'<input type="hidden" name="facid" value="' . $object->id .
'">';
909 if (isModEnabled(
'project')) $rowspan++;
910 if ($object->fk_account > 0) $rowspan++;
912 print
'<table class="border centpercent">';
914 $object->fetch_thirdparty();
917 print
'<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans(
"Title") .
'</td><td>';
918 print
'<input class="flat quatrevingtpercent" type="text" name="title" value="' .
dol_escape_htmltag(
GETPOST(
"title",
'alphanohtml')) .
'" autofocus>';
922 print
'<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans(
"RefSupplier") .
'</td><td>';
923 print
'<input class="flat maxwidth500" type="text" name="ref_supplier" value="' . $object->ref_supplier .
'">';
927 print
'<tr><td class="titlefieldcreate">' . $langs->trans(
"Customer") .
'</td><td>' . $object->thirdparty->getNomUrl(1,
'customer') .
'</td>';
930 $note_public = GETPOSTISSET(
'note_public') ?
GETPOST(
'note_public',
'restricthtml') : $object->note_public;
931 $note_private = GETPOSTISSET(
'note_private') ?
GETPOST(
'note_private',
'restricthtml') : $object->note_private;
936 $substitutionarray[
'__INVOICE_PREVIOUS_MONTH__'] = $langs->trans(
"PreviousMonthOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date(
dol_time_plus_duree($object->date, -1,
'm'),
'%m') .
')';
937 $substitutionarray[
'__INVOICE_MONTH__'] = $langs->trans(
"MonthOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date($object->date,
'%m') .
')';
938 $substitutionarray[
'__INVOICE_NEXT_MONTH__'] = $langs->trans(
"NextMonthOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date(
dol_time_plus_duree($object->date, 1,
'm'),
'%m') .
')';
939 $substitutionarray[
'__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans(
"TextPreviousMonthOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date(
dol_time_plus_duree($object->date, -1,
'm'),
'%B') .
')';
940 $substitutionarray[
'__INVOICE_MONTH_TEXT__'] = $langs->trans(
"TextMonthOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date($object->date,
'%B') .
')';
941 $substitutionarray[
'__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans(
"TextNextMonthOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date(
dol_time_plus_duree($object->date, 1,
'm'),
'%B') .
')';
942 $substitutionarray[
'__INVOICE_PREVIOUS_YEAR__'] = $langs->trans(
"PreviousYearOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date(
dol_time_plus_duree($object->date, -1,
'y'),
'%Y') .
')';
943 $substitutionarray[
'__INVOICE_YEAR__'] = $langs->trans(
"YearOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date($object->date,
'%Y') .
')';
944 $substitutionarray[
'__INVOICE_NEXT_YEAR__'] = $langs->trans(
"NextYearOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date(
dol_time_plus_duree($object->date, 1,
'y'),
'%Y') .
')';
946 $substitutionarray[
'__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans(
"DateNextInvoiceBeforeGen") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date($object->date_when,
'dayhour') .
')';
947 $substitutionarray[
'__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans(
"DateNextInvoiceAfterGen") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date(
dol_time_plus_duree($object->date_when, $object->frequency, $object->unit_frequency),
'dayhour') .
')';
948 $substitutionarray[
'__INVOICE_COUNTER_CURRENT__'] = $langs->trans(
"Count");
949 $substitutionarray[
'__INVOICE_COUNTER_MAX__'] = $langs->trans(
"MaxPeriodNumber");
951 $htmltext =
'<i>' . $langs->trans(
"FollowingConstantsWillBeSubstituted") .
':<br>';
952 foreach ($substitutionarray as $key => $val) {
953 $htmltext .= $key .
' = ' . $langs->trans($val) .
'<br>';
958 print
'<tr><td class="titlefieldcreate">' . $langs->trans(
"Label") .
'</td><td>';
959 print
'<input class="flat quatrevingtpercent" type="text" name="libelle" value="' . $object->label .
'">';
964 print
'<td class="tdtop">';
965 print $form->textwithpicto($langs->trans(
'NotePublic'), $htmltext, 1,
'help',
'', 0, 2,
'notepublic');
968 $doleditor =
new DolEditor(
'note_public', $note_public,
'', 80,
'dolibarr_notes',
'In', 0,
false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3,
'90%');
969 print $doleditor->Create(1);
972 if (empty($user->socid)) {
974 print
'<td class="tdtop">';
975 print $form->textwithpicto($langs->trans(
'NotePrivate'), $htmltext, 1,
'help',
'', 0, 2,
'noteprivate');
978 $doleditor =
new DolEditor(
'note_private', $note_private,
'', 80,
'dolibarr_notes',
'In', 0,
false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3,
'90%');
979 print $doleditor->Create(1);
984 print
"<tr><td>" . $langs->trans(
"Author") .
"</td><td>" . $user->getFullName($langs) .
"</td></tr>";
987 print
"<tr><td>" . $langs->trans(
"PaymentConditions") .
"</td><td>";
988 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'] .
'?id=' . $object->id, $object->cond_reglement_id,
'none');
992 print
"<tr><td>" . $langs->trans(
"PaymentMode") .
"</td><td>";
993 $form->form_modes_reglement($_SERVER[
'PHP_SELF'] .
'?id=' . $object->id, $object->mode_reglement_id,
'none',
'', 1);
997 if (isModEnabled(
'project') && is_object($object->thirdparty) && $object->thirdparty->id > 0) {
998 $projectid =
GETPOST(
'projectid') ?
GETPOST(
'projectid') : $object->fk_project;
999 $langs->load(
'projects');
1000 print
'<tr><td>' . $langs->trans(
'Project') .
'</td><td>';
1001 $numprojet = $formproject->select_projects($object->thirdparty->id, $projectid,
'projectid', 0, 0, 1, 0, 0, 0, 0,
'', 0, 0,
'');
1002 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 :
'')) .
'">' . $langs->trans(
"AddProject") .
'</a>';
1007 if ($object->fk_account > 0) {
1008 print
"<tr><td>" . $langs->trans(
'BankAccount') .
"</td><td>";
1009 $form->formSelectAccount($_SERVER[
'PHP_SELF'] .
'?id=' . $object->id, $object->fk_account,
'none');
1014 print
"<tr><td>" . $langs->trans(
'Model') .
"</td><td>";
1015 include_once DOL_DOCUMENT_ROOT .
'/core/modules/supplier_invoice/modules_facturefournisseur.php';
1017 print $form->selectarray(
'modelpdf', $list, $conf->global->INVOICE_SUPPLIER_ADDON_PDF);
1025 $title = $langs->trans(
"Recurrence");
1030 print
'<table class="border centpercent">';
1033 print
'<tr><td class="titlefieldcreate">' . $form->textwithpicto($langs->trans(
"Frequency"), $langs->transnoentitiesnoconv(
'toolTipFrequency')) .
"</td><td>";
1034 print
"<input type='text' name='frequency' value='" .
GETPOST(
'frequency',
'int') .
"' size='4' /> " . $form->selectarray(
'unit_frequency', array(
'd' => $langs->trans(
'Day'),
'm' => $langs->trans(
'Month'),
'y' => $langs->trans(
'Year')), (
GETPOST(
'unit_frequency') ?
GETPOST(
'unit_frequency') :
'm'));
1038 print
"<tr><td>" . $langs->trans(
'NextDateToExecution') .
"</td><td>";
1040 print $form->selectDate($date_next_execution,
'', 1, 1,
'',
"add", 1, 1);
1044 print
"<tr><td>" . $langs->trans(
"MaxPeriodNumber") .
"</td><td>";
1045 print
'<input type="text" name="nb_gen_max" value="' .
GETPOST(
'nb_gen_max') .
'" size="5" />';
1049 print
"<tr><td>" . $langs->trans(
"StatusOfGeneratedInvoices") .
"</td><td>";
1050 $select = array(
'0' => $langs->trans(
'BillStatusDraft'),
'1' => $langs->trans(
'BillStatusValidated'));
1051 print $form->selectarray(
'auto_validate', $select,
GETPOST(
'auto_validate'));
1055 if (!empty($conf->global->INVOICE_REC_CAN_DISABLE_DOCUMENT_FILE_GENERATION)) {
1056 print
"<tr><td>" . $langs->trans(
"StatusOfGeneratedDocuments") .
"</td><td>";
1057 $select = array(
'0' => $langs->trans(
'DoNotGenerateDoc'),
'1' => $langs->trans(
'AutoGenerateDoc'));
1058 print $form->selectarray(
'generate_pdf', $select,
GETPOST(
'generate_pdf'));
1061 print
'<input type="hidden" name="generate_pdf" value="1">';
1068 $title = $langs->trans(
"ProductsAndServices");
1069 if (!isModEnabled(
"service")) {
1070 $title = $langs->trans(
"Products");
1071 } elseif (!isModEnabled(
"product")) {
1072 $title = $langs->trans(
"Services");
1080 print
'<div class="div-table-responsive-no-min">';
1081 print
'<table id="tablelines" class="noborder noshadow" width="100%">';
1083 if (!empty($object->lines)) {
1087 $object->printObjectLines(
'', $object->thirdparty, $mysoc, $lineid, 0);
1095 print $form->buttonsSaveCancel(
"Create");
1105 if ($object->id > 0) {
1106 $object->fetch($object->id);
1107 $object->fetch_thirdparty();
1110 if ($action ==
'ask_deleteline') {
1111 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"] .
'?id=' . $object->id .
'&lineid=' . $lineid, $langs->trans(
'DeleteProductLine'), $langs->trans(
'ConfirmDeleteProductLine'),
'confirm_deleteline',
'',
'no', 1);
1115 if ($action ==
'ask_deleteinvoice') {
1116 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"] .
'?id=' . $object->id, $langs->trans(
'DeleteRepeatableInvoice'), $langs->trans(
'ConfirmDeleteRepeatableInvoice'),
'confirm_deleteinvoice',
'',
'no', 1);
1121 $author =
new User($db);
1122 $author->fetch($object->user_author);
1126 print
dol_get_fiche_head($head,
'card', $langs->trans(
'RepeatableInvoice'), -1,
'bill');
1130 $linkback =
'<a href="' . DOL_URL_ROOT .
'/fourn/facture/list-rec.php?restore_lastsearch_values=1' . (!empty($socid) ?
'&socid=' . $socid :
'') .
'">' . $langs->trans(
'BackToList') .
'</a>';
1133 if ($action !=
'edittitle') {
1134 $morehtmlref .= $form->editfieldkey($object->titre,
'title', $object->titre, $object, $usercancreate,
'',
'', 0, 2);
1136 $morehtmlref .= $form->editfieldval(
'',
'title', $object->titre, $object, $usercancreate,
'string');
1138 $morehtmlref .=
'<div class="refidno">';
1140 $morehtmlref .= $form->editfieldkey(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, $usercancreate,
'string',
'', 0, 1);
1141 $morehtmlref .= $form->editfieldval(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, $usercancreate,
'string',
'',
null,
null,
'', 1);
1143 $morehtmlref .=
'<br>' . $langs->trans(
'ThirdParty') .
' : ' . $object->thirdparty->getNomUrl(1);
1146 if (isModEnabled(
'project')) {
1147 $langs->load(
'projects');
1148 $morehtmlref .=
'<br>' . $langs->trans(
'Project') .
' ';
1149 if ($usercancreate) {
1150 if ($action !=
'classify') {
1151 $morehtmlref .=
'<a class="editfielda" href="' . $_SERVER[
'PHP_SELF'] .
'?action=classify&token=' . newToken() .
'&id=' . $object->id .
'">' .
img_edit($langs->transnoentitiesnoconv(
'SetProject')) .
'</a> : ';
1153 if ($action ==
'classify') {
1154 $morehtmlref .=
'<form method="post" action="' . $_SERVER[
'PHP_SELF'] .
'?id=' . $object->id .
'">';
1155 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
1156 $morehtmlref .=
'<input type="hidden" name="token" value="' . newToken() .
'">';
1157 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
1158 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="' . $langs->trans(
"Modify") .
'">';
1159 $morehtmlref .=
'</form>';
1161 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'] .
'?id=' . $object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1,
'',
'maxwidth300');
1164 if (!empty($object->fk_project)) {
1166 $project->fetch($object->fk_project);
1167 $morehtmlref .=
' : ' . $project->getNomUrl(1);
1168 if ($project->title) {
1169 $morehtmlref .=
' - ' . $project->title;
1176 $morehtmlref .=
'</div>';
1178 $morehtmlright =
'';
1180 dol_banner_tab($object,
'ref', $linkback, 1,
'title',
'none', $morehtmlref,
'', 0,
'', $morehtmlright);
1182 print
'<div class="fichecenter">';
1183 print
'<div class="fichehalfleft">';
1184 print
'<div class="underbanner clearboth"></div>';
1186 print
'<table class="border centpercent tableforfield">';
1188 print
'<tr><td class="titlefield">' . $langs->trans(
'Author') .
'</td><td>';
1189 print $author->getNomUrl(-1);
1194 print
'<td>' . $form->editfieldkey(
"Label",
'libelle', $object->libelle, $object, $usercancreate) .
'</td>';
1195 print
'<td>' . $form->editfieldval(
"Label",
'libelle', $object->libelle, $object, $usercancreate) .
'</td>';
1198 print
'<tr><td>' . $langs->trans(
'AmountHT') .
'</td>';
1199 print
'<td>' .
price($object->total_ht,
'', $langs, 1, -1, -1, $conf->currency) .
'</td>';
1202 print
'<tr><td>' . $langs->trans(
"AmountVAT") .
'</td><td>' .
price($object->total_tva,
'', $langs, 1, -1, -1, $conf->currency) .
'</td>';
1206 if (($mysoc->localtax1_assuj ==
"1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) {
1207 print
'<tr><td>' . $langs->transcountry(
"AmountLT1", $mysoc->country_code) .
'</td>';
1208 print
'<td class="nowrap">' .
price($object->total_localtax1, 1,
'', 1, -1, -1, $conf->currency) .
'</td></tr>';
1210 if (($mysoc->localtax2_assuj ==
"1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) {
1211 print
'<tr><td>' . $langs->transcountry(
"AmountLT2", $mysoc->country_code) .
'</td>';
1212 print
'<td class=nowrap">' .
price($object->total_localtax2, 1,
'', 1, -1, -1, $conf->currency) .
'</td></tr>';
1215 print
'<tr><td>' . $langs->trans(
"AmountTTC") .
'</td><td colspan="3">' .
price($object->total_ttc,
'', $langs, 1, -1, -1, $conf->currency) .
'</td>';
1220 print
'<table class="nobordernopadding centpercent"><tr><td>';
1221 print $langs->trans(
'PaymentConditionsShort');
1223 if ($action !=
'editconditions' && $usercancreate) {
1224 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>';
1226 print
'</tr></table>';
1228 if ($action ==
'editconditions') {
1229 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'] .
'?facid=' . $object->id, $object->cond_reglement_id,
'cond_reglement_id');
1231 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'] .
'?facid=' . $object->id, $object->cond_reglement_id,
'none');
1238 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1239 print $langs->trans(
'PaymentMode');
1241 if ($action !=
'editmode' && $usercancreate) {
1242 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>';
1244 print
'</tr></table>';
1246 if ($action ==
'editmode') {
1247 $form->form_modes_reglement($_SERVER[
'PHP_SELF'] .
'?facid=' . $object->id, $object->mode_reglement_id,
'mode_reglement_id',
'CRDT', 1, 1);
1249 $form->form_modes_reglement($_SERVER[
'PHP_SELF'] .
'?facid=' . $object->id, $object->mode_reglement_id,
'none');
1254 if (isModEnabled(
"multicurrency")) {
1258 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1259 print $form->editfieldkey(
'Currency',
'multicurrency_code',
'', $object, 0);
1261 if ($usercancreate && $action !=
'editmulticurrencycode' && !empty($object->brouillon)) {
1262 print
'<td class="right"><a class="editfielda" href="' . $_SERVER[
"PHP_SELF"] .
'?action=editmulticurrencycode&token=' . newToken() .
'&id=' . $object->id .
'">' .
img_edit($langs->transnoentitiesnoconv(
'SetMultiCurrencyCode'), 1) .
'</a></td>';
1264 print
'</tr></table>';
1266 $htmlname = (($usercancreate && $action ==
'editmulticurrencycode') ?
'multicurrency_code' :
'none');
1267 $form->form_multicurrency_code($_SERVER[
'PHP_SELF'] .
'?id=' . $object->id, $object->multicurrency_code, $htmlname);
1271 if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) {
1274 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1275 print $form->editfieldkey(
'CurrencyRate',
'multicurrency_tx',
'', $object, 0);
1277 if ($usercancreate && $action !=
'editmulticurrencyrate' && !empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
1278 print
'<td class="right"><a class="editfielda" href="' . $_SERVER[
"PHP_SELF"] .
'?action=editmulticurrencyrate&token=' . newToken() .
'&id=' . $object->id .
'">' .
img_edit($langs->transnoentitiesnoconv(
'SetMultiCurrencyCode'), 1) .
'</a></td>';
1280 print
'</tr></table>';
1282 if ($action ==
'editmulticurrencyrate' || $action ==
'actualizemulticurrencyrate') {
1283 if ($action ==
'actualizemulticurrencyrate') {
1286 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'] .
'?id=' . $object->id, $object->multicurrency_tx, ($usercancreate ?
'multicurrency_tx' :
'none'), $object->multicurrency_code);
1288 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'] .
'?id=' . $object->id, $object->multicurrency_tx,
'none', $object->multicurrency_code);
1289 if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
1290 print
'<div class="inline-block"> ';
1291 print
'<a href="' . $_SERVER[
"PHP_SELF"] .
'?id=' . $object->id .
'&action=actualizemulticurrencyrate">' . $langs->trans(
"ActualizeCurrency") .
'</a>';
1301 if (!empty($object->frequency) && !empty($object->date_when)) {
1302 $dateexample = $object->date_when;
1307 $substitutionarray[
'__INVOICE_PREVIOUS_MONTH__'] = $langs->trans(
"PreviousMonthOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date(
dol_time_plus_duree($dateexample, -1,
'm'),
'%m') .
')';
1308 $substitutionarray[
'__INVOICE_MONTH__'] = $langs->trans(
"MonthOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date($dateexample,
'%m') .
')';
1309 $substitutionarray[
'__INVOICE_NEXT_MONTH__'] = $langs->trans(
"NextMonthOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date(
dol_time_plus_duree($dateexample, 1,
'm'),
'%m') .
')';
1310 $substitutionarray[
'__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans(
"TextPreviousMonthOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date(
dol_time_plus_duree($dateexample, -1,
'm'),
'%B') .
')';
1311 $substitutionarray[
'__INVOICE_MONTH_TEXT__'] = $langs->trans(
"TextMonthOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date($dateexample,
'%B') .
')';
1312 $substitutionarray[
'__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans(
"TextNextMonthOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date(
dol_time_plus_duree($dateexample, 1,
'm'),
'%B') .
')';
1313 $substitutionarray[
'__INVOICE_PREVIOUS_YEAR__'] = $langs->trans(
"PreviousYearOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date(
dol_time_plus_duree($dateexample, -1,
'y'),
'%Y') .
')';
1314 $substitutionarray[
'__INVOICE_YEAR__'] = $langs->trans(
"YearOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date($dateexample,
'%Y') .
')';
1315 $substitutionarray[
'__INVOICE_NEXT_YEAR__'] = $langs->trans(
"NextYearOfInvoice") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date(
dol_time_plus_duree($dateexample, 1,
'y'),
'%Y') .
')';
1317 $substitutionarray[
'__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans(
"DateNextInvoiceBeforeGen") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date(($object->date_when ? $object->date_when :
dol_now()),
'dayhour') .
')';
1318 $substitutionarray[
'__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans(
"DateNextInvoiceAfterGen") .
' (' . $langs->trans(
"Example") .
': ' .
dol_print_date(
dol_time_plus_duree(($object->date_when ? $object->date_when :
dol_now()), $object->frequency, $object->unit_frequency),
'dayhour') .
')';
1319 $substitutionarray[
'__INVOICE_COUNTER_CURRENT__'] = $object->nb_gen_done;
1320 $substitutionarray[
'__INVOICE_COUNTER_MAX__'] = $object->nb_gen_max;
1322 $htmltext =
'<i>' . $langs->trans(
"FollowingConstantsWillBeSubstituted") .
':<br>';
1323 foreach ($substitutionarray as $key => $val) {
1324 $htmltext .= $key .
' = ' . $langs->trans($val) .
'<br>';
1326 $htmltext .=
'</i>';
1330 print $form->editfieldkey($form->textwithpicto($langs->trans(
'NotePublic'), $htmltext, 1,
'help',
'', 0, 2,
'notepublic'),
'note_public', $object->note_public, $object, $usercancreate);
1331 print
'</td><td class="wordbreak">';
1332 print $form->editfieldval($langs->trans(
"NotePublic"),
'note_public', $object->note_public, $object, $usercancreate,
'textarea:' . ROWS_4 .
':90%',
'',
null,
null,
'', 1);
1338 print $form->editfieldkey($form->textwithpicto($langs->trans(
"NotePrivate"), $htmltext, 1,
'help',
'', 0, 2,
'noteprivate'),
'note_private', $object->note_private, $object, $usercancreate);
1339 print
'</td><td class="wordbreak">';
1340 print $form->editfieldval($langs->trans(
"NotePrivate"),
'note_private', $object->note_private, $object, $usercancreate,
'textarea:' . ROWS_4 .
':90%',
'',
null,
null,
'', 1);
1345 print
'<tr><td class="nowrap">';
1346 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
1347 print $langs->trans(
'BankAccount');
1349 if ($action !=
'editbankaccount' && $usercancreate && $object->statut == FactureFournisseurRec::STATUS_NOTSUSPENDED) {
1350 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>';
1352 print
'</tr></table>';
1354 if ($action ==
'editbankaccount') {
1355 $form->formSelectAccount($_SERVER[
'PHP_SELF'] .
'?id=' . $object->id, $object->fk_account,
'fk_account', 1);
1357 $form->formSelectAccount($_SERVER[
'PHP_SELF'] .
'?id=' . $object->id, $object->fk_account,
'none');
1363 print
'<tr><td class="nowrap">';
1364 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
1365 print $langs->trans(
'Model');
1367 if ($action !=
'editmodelpdf' && $usercancreate && $object->statut == FactureFournisseurRec::STATUS_NOTSUSPENDED) {
1368 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>';
1370 print
'</tr></table>';
1372 if ($action ==
'editmodelpdf') {
1373 include_once DOL_DOCUMENT_ROOT .
'/core/modules/supplier_invoice/modules_facturefournisseur.php';
1376 foreach ($models as $k => $model) {
1377 $list[] = str_replace(
':',
'|', $k) .
':' . $model;
1379 $select =
'select;' . implode(
',', $list);
1381 print $form->editfieldval($langs->trans(
'Model'),
'modelpdf', $object->model_pdf, $object, $usercancreate, $select);
1383 print $object->model_pdf;
1390 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_view.tpl.php';
1395 print
'<div class="fichehalfright">';
1396 print
'<div class="underbanner clearboth"></div>';
1401 $title = $langs->trans(
"Recurrence");
1404 print
'<table class="border centpercent tableforfield">';
1406 print
'<tr><td colspan="2">' .
img_picto(
'',
'recurring',
'class="pictofixedwidth"') . $title .
'</td></tr>';
1409 print
'<tr><td style="width: 50%">';
1410 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1411 print $langs->trans(
'Frequency');
1413 if ($action !=
'editfrequency' && $usercancreate) {
1414 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>';
1416 print
'</tr></table>';
1418 if ($action ==
'editfrequency') {
1419 print
'<form method="post" action="' . $_SERVER[
"PHP_SELF"] .
'?facid=' . $object->id .
'">';
1420 print
'<input type="hidden" name="action" value="setfrequency">';
1421 print
'<input type="hidden" name="token" value="' . newToken() .
'">';
1422 print
'<table class="nobordernopadding">';
1424 print
"<input type='text' name='frequency' value='" . $object->frequency .
"' size='5' /> " . $form->selectarray(
'unit_frequency', array(
'd' => $langs->trans(
'Day'),
'm' => $langs->trans(
'Month'),
'y' => $langs->trans(
'Year')), ($object->unit_frequency ? $object->unit_frequency :
'm'));
1426 print
'<td class="left"><input type="submit" class="button button-edit" value="' . $langs->trans(
"Modify") .
'"></td>';
1427 print
'</tr></table></form>';
1429 if ($object->frequency > 0) {
1430 print $langs->trans(
'FrequencyPer_' . $object->unit_frequency, $object->frequency);
1432 print $langs->trans(
"NotARecurringInvoiceTemplate");
1439 if ($action ==
'date_when' || $object->frequency > 0) {
1440 print $form->editfieldkey($langs->trans(
"NextDateToExecution"),
'date_when', $object->date_when, $object, $usercancreate,
'day');
1442 print $langs->trans(
"NextDateToExecution");
1445 if ($action ==
'date_when' || $object->frequency > 0) {
1446 print $form->editfieldval($langs->trans(
"NextDateToExecution"),
'date_when', $object->date_when, $object, $usercancreate,
'day', $object->date_when,
null,
'',
'', 0,
'strikeIfMaxNbGenReached');
1449 if (! $object->isMaxNbGenReached()) {
1450 if (! $object->suspended && $action !=
'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) {
1454 print
img_info($langs->trans(
"MaxNumberOfGenerationReached"));
1461 if ($action ==
'nb_gen_max' || $object->frequency > 0) {
1462 print $form->editfieldkey($langs->trans(
"MaxPeriodNumber"),
'nb_gen_max', $object->nb_gen_max, $object, $usercancreate);
1464 print $langs->trans(
"MaxPeriodNumber");
1467 if ($action ==
'nb_gen_max' || $object->frequency > 0) {
1468 print $form->editfieldval($langs->trans(
"MaxPeriodNumber"),
'nb_gen_max', $object->nb_gen_max ? $object->nb_gen_max :
'', $object, $usercancreate);
1477 if ($action ==
'auto_validate' || $object->frequency > 0) {
1478 print $form->editfieldkey($langs->trans(
"StatusOfGeneratedInvoices"),
'auto_validate', $object->auto_validate, $object, $usercancreate);
1480 print $langs->trans(
"StatusOfGeneratedInvoices");
1483 $select =
'select;0:' . $langs->trans(
'BillStatusDraft') .
',1:' . $langs->trans(
'BillStatusValidated');
1484 if ($action ==
'auto_validate' || $object->frequency > 0) {
1485 print $form->editfieldval($langs->trans(
"StatusOfGeneratedInvoices"),
'auto_validate', $object->auto_validate, $object, $usercancreate, $select);
1489 if (!empty($conf->global->INVOICE_REC_CAN_DISABLE_DOCUMENT_FILE_GENERATION)) {
1492 if ($action ==
'generate_pdf' || $object->frequency > 0) {
1493 print $form->editfieldkey($langs->trans(
"StatusOfGeneratedDocuments"),
'generate_pdf', $object->generate_pdf, $object, $usercancreate);
1495 print $langs->trans(
"StatusOfGeneratedDocuments");
1499 $select =
'select;0:' . $langs->trans(
'DoNotGenerateDoc') .
',1:' . $langs->trans(
'AutogenerateDoc');
1500 if ($action ==
'generate_pdf' || $object->frequency > 0) {
1501 print $form->editfieldval($langs->trans(
"StatusOfGeneratedDocuments"),
'generate_pdf', $object->generate_pdf, $object, $usercancreate, $select);
1506 print
'<input type="hidden" name="generate_pdf" value="1">';
1512 if ($object->frequency > 0) {
1515 if (empty($conf->cron->enabled)) {
1516 print
info_admin($langs->trans(
"EnableAndSetupModuleCron", $langs->transnoentitiesnoconv(
"Module2300Name")));
1519 print
'<div class="underbanner clearboth"></div>';
1520 print
'<table class="border centpercent tableforfield">';
1523 print
'<tr><td style="width: 50%">' . $langs->trans(
"NbOfGenerationDone") .
'</td>';
1525 print $object->nb_gen_done ? $object->nb_gen_done :
'0';
1531 print $langs->trans(
"DateLastGeneration");
1545 print
'<div class="clearboth"></div><br>';
1548 print
' <form name="addproduct" id="addproduct" action="' . $_SERVER[
"PHP_SELF"] .
'?id=' . $object->id . (($action !=
'editline') ?
'#add' :
'#line_' .
GETPOST(
'lineid',
'int')) .
'" method="POST">
1549 <input type="hidden" name="token" value="' . newToken() .
'">
1550 <input type="hidden" name="action" value="' . (($action !=
'editline') ?
'addline' :
'updateline') .
'">
1551 <input type="hidden" name="mode" value="">
1552 <input type="hidden" name="id" value="' . $object->id .
'">
1555 if (!empty($conf->use_javascript_ajax) && $object->statut == 0) {
1556 include DOL_DOCUMENT_ROOT .
'/core/tpl/ajaxrow.tpl.php';
1559 print
'<div class="div-table-responsive-no-min">';
1560 print
'<table id="tablelines" class="noborder noshadow" width="100%">';
1561 $object->fetch_lines();
1563 if (!empty($object->lines)) {
1564 $canchangeproduct = 1;
1566 foreach ($object->lines as $line) {
1567 $line->ref = $line->label;
1568 $line->product_label = $line->label;
1569 $line->subprice = $line->pu_ht;
1572 global $canchangeproduct;
1573 $canchangeproduct = 0;
1575 $object->statut = $object->suspended;
1576 $object->printObjectLines($action, $object->thirdparty, $mysoc, $lineid, 0);
1581 if ($object->statut == $object::STATUS_DRAFT && $usercancreate && $action !=
'valid' && $action !=
'editline') {
1582 if ($action !=
'editline') {
1585 $parameters = array();
1586 $reshook = $hookmanager->executeHooks(
'formAddObjectLine', $parameters, $object, $action);
1587 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
1588 if (empty($reshook))
1589 global $senderissupplier;
1590 $senderissupplier = 2;
1591 $object->formAddObjectLine(0, $object->thirdparty, $mysoc);
1605 print
'<div class="tabsAction">';
1607 if (empty($object->suspended)) {
1608 if ($usercancreate) {
1609 if (!empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max)) {
1610 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' .
dol_escape_htmltag($langs->trans(
"MaxGenerationReached")) .
'">' . $langs->trans(
"CreateBill") .
'</a></div>';
1612 if (empty($object->frequency) || $object->date_when <= $nowlasthour) {
1613 print
'<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT .
'/fourn/facture/card.php?action=create&socid=' . $object->thirdparty->id .
'&fac_rec=' . $object->id .
'">' . $langs->trans(
"CreateBill") .
'</a></div>';
1615 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' .
dol_escape_htmltag($langs->trans(
"DateIsNotEnough")) .
'">' . $langs->trans(
"CreateBill") .
'</a></div>';
1619 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans(
"CreateBill") .
'</a></div>';
1623 if ($usercancreate) {
1624 if (empty($object->suspended)) {
1625 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>';
1627 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>';
1632 print
dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=ask_deleteinvoice&token='.newToken(),
'delete', ($user->hasRight(
"fournisseur",
"facture",
"supprimer") || $user->hasRight(
"supplier_invoice",
"supprimer")));
1636 print
'<div class="fichecenter"><div class="fichehalfleft">';
1637 print
'<a name="builddoc"></a>';
1640 $linktoelem = $form->showLinkToObjectBlock($object,
null, array(
'invoice'));
1642 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
1644 print
'</div></div>';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage a WYSIWYG editor.
Class to manage suppliers invoices.
Class to manage supplier invoice lines of templates.
Class to manage invoice templates.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation models.
static getIdAndTxFromCode($dbs, $code, $date_document='')
Get id and rate of currency from code.
Class to manage predefined suppliers products.
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=0, $outputlangs='', $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_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
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_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
get_default_npr(Societe $thirdparty_seller, Societe $thirdparty_buyer, $idprod=0, $idprodfournprice=0)
Function that returns whether VAT must be recoverable collected VAT (e.g.: VAT NPR in France)
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.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller="", $vatnpr=0)
Return localtax rate for a particular vat, when selling a product with vat $vatrate,...
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null, $include=null)
Return array of possible common substitutions.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, $idprod=0, $idprodfournprice=0)
Function that return vat rate of a product line (according to seller, buyer and product vat rate) VAT...
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...
supplier_invoice_rec_prepare_head($object)
Return array head with list of tabs to view object informations.
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.