36 require
'../main.inc.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_proposal/modules_supplier_proposal.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/lib/supplier_proposal.lib.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
45 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
46 if (!empty($conf->projet->enabled)) {
47 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
48 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
52 $langs->loadLangs(array(
'companies',
'supplier_proposal',
'compta',
'bills',
'propal',
'orders',
'products',
'deliveries',
'sendings'));
53 if (!empty($conf->margin->enabled))
54 $langs->load(
'margins');
60 $socid =
GETPOST(
'socid',
'int');
61 $action =
GETPOST(
'action',
'aZ09');
62 $origin =
GETPOST(
'origin',
'alpha');
63 $originid =
GETPOST(
'originid',
'int');
64 $confirm =
GETPOST(
'confirm',
'alpha');
65 $projectid =
GETPOST(
'projectid',
'int');
66 $lineid =
GETPOST(
'lineid',
'int');
67 $contactid =
GETPOST(
'contactid',
'int');
70 $hidedetails = (
GETPOST(
'hidedetails',
'int') ?
GETPOST(
'hidedetails',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
71 $hidedesc = (
GETPOST(
'hidedesc',
'int') ?
GETPOST(
'hidedesc',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
72 $hideref = (
GETPOST(
'hideref',
'int') ?
GETPOST(
'hideref',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
78 if (!empty($user->socid)) $socid = $user->socid;
82 $hookmanager->initHooks(array(
'supplier_proposalcard',
'globalcard'));
88 $extrafields->fetch_name_optionals_label($object->table_element);
91 if ($id > 0 || !empty($ref)) {
92 $ret = $object->fetch($id, $ref);
94 $ret = $object->fetch_thirdparty();
100 $usercanread = $user->rights->supplier_proposal->lire;
101 $usercancreate = $user->rights->supplier_proposal->creer;
102 $usercandelete = $user->rights->supplier_proposal->supprimer;
105 $usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($usercancreate)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->supplier_proposal->validate_advance)));
106 $usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->supplier_proposal->send_advance);
109 $usercanclose = $user->rights->supplier_proposal->cloturer;
110 $usercancreateorder = $user->rights->fournisseur->commande->creer;
113 $permissionnote = $usercancreate;
114 $permissiondellink = $usercancreate;
115 $permissiontoedit = $usercancreate;
122 $parameters = array(
'socid' => $socid);
123 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
124 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
130 if (!empty($backtopage))
132 header(
"Location: ".$backtopage);
138 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
140 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
142 include DOL_DOCUMENT_ROOT.
'/core/actions_lineupdown.inc.php';
145 if ($action ==
'confirm_clone' && $confirm ==
'yes')
147 if (1 == 0 && !
GETPOST(
'clone_content') && !
GETPOST(
'clone_receivers'))
151 if ($object->id > 0) {
152 $result = $object->createFromClone($user, $socid);
154 header(
"Location: ".
$_SERVER[
'PHP_SELF'].
'?id='.$result);
165 elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $usercandelete)
167 $result = $object->delete($user);
169 header(
'Location: '.DOL_URL_ROOT.
'/supplier_proposal/list.php');
172 $langs->load(
"errors");
178 elseif ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $usercancreate)
180 $result = $object->deleteline($lineid);
183 $object->line_order(
true);
185 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
187 $outputlangs = $langs;
188 if (!empty($conf->global->MAIN_MULTILANGS)) {
190 $newlang = (
GETPOST(
'lang_id',
'aZ09') ?
GETPOST(
'lang_id',
'aZ09') : $object->thirdparty->default_lang);
191 $outputlangs->setDefaultLang($newlang);
193 $ret = $object->fetch($id);
194 $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
197 header(
'Location: '.
$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
202 elseif ($action ==
'confirm_validate' && $confirm ==
'yes' && $usercanvalidate)
204 $result = $object->valid($user);
207 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
210 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
212 $outputlangs = $langs;
214 if ($conf->global->MAIN_MULTILANGS && empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) $newlang =
GETPOST(
'lang_id',
'aZ09');
215 if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
216 if (!empty($newlang)) {
218 $outputlangs->setDefaultLang($newlang);
220 $model = $object->model_pdf;
221 $ret = $object->fetch($id);
223 $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
227 $langs->load(
"errors");
228 if (count($object->errors) > 0)
setEventMessages($object->error, $object->errors,
'errors');
231 } elseif ($action ==
'setdate_livraison' && $usercancreate) {
232 $result = $object->setDeliveryDate($user,
dol_mktime(12, 0, 0, $_POST[
'liv_month'], $_POST[
'liv_day'], $_POST[
'liv_year']));
238 elseif ($action ==
'add' && $usercancreate)
240 $object->socid = $socid;
241 $object->fetch_thirdparty();
246 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Supplier")), null,
'errors');
256 if (
GETPOST(
'createmode') ==
'copy' &&
GETPOST(
'copie_supplier_proposal'))
258 if ($object->fetch(
GETPOST(
'copie_supplier_proposal')) > 0) {
260 $object->date_livraison = $date_delivery;
261 $object->delivery_date = $date_delivery;
262 $object->shipping_method_id =
GETPOST(
'shipping_method_id',
'int');
263 $object->cond_reglement_id =
GETPOST(
'cond_reglement_id');
264 $object->mode_reglement_id =
GETPOST(
'mode_reglement_id');
265 $object->fk_account =
GETPOST(
'fk_account',
'int');
266 $object->remise_percent =
GETPOST(
'remise_percent');
267 $object->remise_absolue =
GETPOST(
'remise_absolue');
268 $object->socid =
GETPOST(
'socid');
269 $object->fk_project =
GETPOST(
'projectid',
'int');
270 $object->model_pdf =
GETPOST(
'model');
271 $object->author = $user->id;
272 $object->note =
GETPOST(
'note',
'restricthtml');
273 $object->note_private =
GETPOST(
'note',
'restricthtml');
276 setEventMessages($langs->trans(
"ErrorFailedToCopyProposal",
GETPOST(
'copie_supplier_proposal')), null,
'errors');
280 $object->date_livraison = $date_delivery;
281 $object->delivery_date = $date_delivery;
282 $object->demand_reason_id =
GETPOST(
'demand_reason_id');
283 $object->shipping_method_id =
GETPOST(
'shipping_method_id',
'int');
284 $object->cond_reglement_id =
GETPOST(
'cond_reglement_id');
285 $object->mode_reglement_id =
GETPOST(
'mode_reglement_id');
286 $object->fk_account =
GETPOST(
'fk_account',
'int');
287 $object->fk_project =
GETPOST(
'projectid',
'int');
288 $object->model_pdf =
GETPOST(
'model');
289 $object->author = $user->id;
290 $object->note =
GETPOST(
'note',
'restricthtml');
291 $object->note_private =
GETPOST(
'note',
'restricthtml');
293 $object->origin =
GETPOST(
'origin');
294 $object->origin_id =
GETPOST(
'originid');
297 if (!empty($conf->multicurrency->enabled))
299 $object->multicurrency_code =
GETPOST(
'multicurrency_code',
'alpha');
303 $ret = $extrafields->setOptionalsFromPost(null, $object);
312 if ($origin && $originid)
314 $element =
'supplier_proposal';
315 $subelement =
'supplier_proposal';
317 $object->origin = $origin;
318 $object->origin_id = $originid;
321 $object->linked_objects [$object->origin] = $object->origin_id;
322 if (is_array($_POST[
'other_linked_objects']) && !empty($_POST[
'other_linked_objects'])) {
323 $object->linked_objects = array_merge($object->linked_objects, $_POST[
'other_linked_objects']);
326 $id = $object->create($user);
331 $classname = ucfirst($subelement);
332 $srcobject =
new $classname($db);
334 dol_syslog(
"Try to find source object origin=".$object->origin.
" originid=".$object->origin_id.
" to add lines");
335 $result = $srcobject->fetch($object->origin_id);
339 $lines = $srcobject->lines;
340 if (empty($lines) && method_exists($srcobject,
'fetch_lines'))
342 $srcobject->fetch_lines();
343 $lines = $srcobject->lines;
347 $num = count($lines);
348 for ($i = 0; $i < $num; $i++)
350 $label = (!empty($lines[$i]->label) ? $lines[$i]->label :
'');
351 $desc = (!empty($lines[$i]->desc) ? $lines[$i]->desc : $lines[$i]->libelle);
354 $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
357 if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
362 if (method_exists($lines[$i],
'fetch_optionals')) {
363 $lines[$i]->fetch_optionals();
364 $array_options = $lines[$i]->array_options;
367 $result = $object->addline(
369 $lines[$i]->subprice,
372 $lines[$i]->localtax1_tx,
373 $lines[$i]->localtax2_tx,
374 $lines[$i]->fk_product,
375 $lines[$i]->remise_percent,
378 $lines[$i]->info_bits,
381 $lines[$i]->special_code,
383 $lines[$i]->fk_fournprice,
384 $lines[$i]->pa_ht, $label,
386 $lines[$i]->ref_supplier,
399 if ($result > 0 && $lines[$i]->product_type == 9) {
400 $fk_parent_line = $result;
405 $parameters = array(
'objFrom' => $srcobject);
406 $reshook = $hookmanager->executeHooks(
'createFrom', $parameters, $object, $action);
421 $id = $object->create($user);
431 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
433 $outputlangs = $langs;
435 if ($conf->global->MAIN_MULTILANGS && empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) $newlang =
GETPOST(
'lang_id',
'aZ09');
436 if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
437 if (!empty($newlang)) {
439 $outputlangs->setDefaultLang($newlang);
441 $model = $object->model_pdf;
443 $ret = $object->fetch($id);
444 $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
448 header(
'Location: '.
$_SERVER[
"PHP_SELF"].
'?id='.$id);
464 elseif ($action ==
'confirm_reopen' && $usercanclose && !
GETPOST(
'cancel',
'alpha')) {
472 elseif ($action ==
'close' && $usercanclose && !
GETPOST(
'cancel',
'alpha')) {
480 elseif ($action ==
'setstatut' && $usercanclose && !
GETPOST(
'cancel',
'alpha')) {
482 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"CloseAs")), null,
'errors');
487 $object->cloture($user,
GETPOST(
'statut'),
GETPOST(
'note',
'restricthtml'));
493 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
496 $triggersendname =
'PROPOSAL_SUPPLIER_SENTBYMAIL';
497 $autocopy =
'MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO';
498 $trackid =
'spro'.$object->id;
499 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
502 $upload_dir = $conf->supplier_proposal->dir_output;
503 $permissiontoadd = $usercancreate;
504 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
508 if ($action ==
'modif' && $usercancreate)
510 $object->setDraft($user);
512 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
515 $outputlangs = $langs;
516 if (!empty($conf->global->MAIN_MULTILANGS)) {
518 $newlang = (
GETPOST(
'lang_id',
'aZ09') ?
GETPOST(
'lang_id',
'aZ09') : $object->thirdparty->default_lang);
519 $outputlangs->setDefaultLang($newlang);
521 $ret = $object->fetch($id);
522 $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
524 } elseif ($action ==
"setabsolutediscount" && $usercancreate) {
525 if ($_POST[
"remise_id"]) {
526 if ($object->id > 0) {
527 $result = $object->insert_discount($_POST[
"remise_id"]);
536 if ($action ==
'addline' && $usercancreate)
538 $langs->load(
'errors');
546 $ref_supplier =
GETPOST(
'fourn_ref',
'alpha');
547 $prod_entry_mode =
GETPOST(
'prod_entry_mode');
548 if ($prod_entry_mode ==
'free') {
553 $idprod =
GETPOST(
'idprod',
'int');
559 $remise_percent =
GETPOST(
'remise_percent'.$predef);
563 $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
564 $array_options = $extrafields->getOptionalsFromPost($object->table_element_line, $predef);
566 if (is_array($extralabelsline)) {
568 foreach ($extralabelsline as $key => $value) {
569 unset($_POST[
"options_".$key]);
573 if ($prod_entry_mode ==
'free' && empty($idprod) &&
GETPOST(
'type') < 0) {
574 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")), null,
'errors');
578 if ($prod_entry_mode ==
'free' && empty($idprod) &&
GETPOST(
'price_ht') ===
'' &&
GETPOST(
'price_ttc') ===
'' && $price_ht_devise ===
'')
580 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"UnitPrice")), null,
'errors');
583 if ($prod_entry_mode ==
'free' && empty($idprod) && empty($product_desc)) {
584 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Description")), null,
'errors');
587 if (!$error && ($qty >= 0)) {
591 $price_base_type = (
GETPOST(
'price_base_type',
'alpha') ?
GETPOST(
'price_base_type',
'alpha') :
'HT');
598 if (($prod_entry_mode !=
'free') && empty($error))
603 if (
GETPOST(
'idprodfournprice',
'alpha') == -1 ||
GETPOST(
'idprodfournprice',
'alpha') ==
'') $idprod = -99;
606 if (preg_match(
'/^idprod_([0-9]+)$/',
GETPOST(
'idprodfournprice',
'alpha'), $reg))
609 $res = $productsupplier->fetch($idprod);
612 if (!empty($conf->global->SUPPLIER_TAKE_FIRST_PRICE_IF_NO_PRICE_FOR_CURRENT_SUPPLIER))
615 $productsupplier->get_buyprice(0, -1, $idprod,
'none', $fksoctosearch);
616 if ($productsupplier->fourn_socid != $socid)
618 $productsupplier->ref_supplier =
'';
621 $fksoctosearch = $object->thirdparty->id;
622 $productsupplier->get_buyprice(0, -1, $idprod,
'none', $fksoctosearch);
624 } elseif (
GETPOST(
'idprodfournprice',
'alpha') > 0)
628 $idprod = $productsupplier->get_buyprice(
GETPOST(
'idprodfournprice',
'alpha'), $qtytosearch);
629 $res = $productsupplier->fetch($idprod);
634 $label = $productsupplier->label;
637 if (!empty($productsupplier->desc_supplier) && !empty($conf->global->PRODUIT_FOURN_TEXTS)) {
638 $desc = $productsupplier->desc_supplier;
639 }
else $desc = $productsupplier->description;
641 if (trim($product_desc) != trim($desc)) $desc =
dol_concatdesc($desc, $product_desc,
'', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION));
643 $type = $productsupplier->type;
644 $price_base_type = ($productsupplier->fourn_price_base_type ? $productsupplier->fourn_price_base_type :
'HT');
646 $ref_supplier = $productsupplier->ref_supplier;
648 $tva_tx =
get_default_tva($object->thirdparty, $mysoc, $productsupplier->id,
GETPOST(
'idprodfournprice',
'alpha'));
649 $tva_npr =
get_default_npr($object->thirdparty, $mysoc, $productsupplier->id,
GETPOST(
'idprodfournprice',
'alpha'));
650 if (empty($tva_tx)) $tva_npr = 0;
651 $localtax1_tx =
get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr);
652 $localtax2_tx =
get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr);
654 if (empty($pu_ht)) $pu_ht = 0;
657 $fournprice = (is_numeric(
GETPOST(
'idprodfournprice',
'alpha')) ?
GETPOST(
'idprodfournprice',
'alpha') : -1);
659 $pu_ht_devise =
price2num($price_ht_devise,
'MU');
661 $result = $object->addline(
668 $productsupplier->id,
682 $productsupplier->fk_unit,
697 if ($idprod == -99 || $idprod == 0)
701 $langs->load(
"errors");
702 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ProductOrService")).
' '.$langs->trans(
"or").
' '.$langs->trans(
"NoPriceDefinedForThisSupplier"), null,
'errors');
708 $langs->load(
"errors");
709 setEventMessages($langs->trans(
"ErrorQtyTooLowForThisSupplier"), null,
'errors');
711 } elseif ((
GETPOST(
'price_ht') !==
'' ||
GETPOST(
'price_ttc') !==
'' ||
GETPOST(
'multicurrency_price_ht') !=
'') && empty($error))
715 $tva_npr = (preg_match(
'/\*/', $tva_tx) ? 1 : 0);
716 $tva_tx = str_replace(
'*',
'', $tva_tx);
717 $label = (
GETPOST(
'product_label') ?
GETPOST(
'product_label') :
'');
718 $desc = $product_desc;
721 $fk_unit =
GETPOST(
'units',
'alpha');
723 if (!preg_match(
'/\((.*)\)/', $tva_tx)) {
728 $localtax1_tx =
get_localtax($tva_tx, 1, $mysoc, $object->thirdparty);
729 $localtax2_tx =
get_localtax($tva_tx, 2, $mysoc, $object->thirdparty);
731 if ($price_ht !==
'')
736 $pu_ht =
price2num($pu_ttc / (1 + ($tva_tx / 100)),
'MU');
738 $price_base_type =
'HT';
739 $pu_ht_devise =
price2num($price_ht_devise,
'MU');
741 $result = $object->addline(
769 if (!$error && $result > 0)
773 $ret = $object->fetch($object->id);
776 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
778 $outputlangs = $langs;
780 if ($conf->global->MAIN_MULTILANGS && empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) $newlang =
GETPOST(
'lang_id',
'aZ09');
781 if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
782 if (!empty($newlang)) {
784 $outputlangs->setDefaultLang($newlang);
786 $model = $object->model_pdf;
787 $ret = $object->fetch($id);
789 $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
793 unset($_POST[
'prod_entry_mode']);
795 unset($_POST[
'qty']);
796 unset($_POST[
'type']);
797 unset($_POST[
'remise_percent']);
799 unset($_POST[
'price_ht']);
800 unset($_POST[
'multicurrency_price_ht']);
801 unset($_POST[
'price_ttc']);
802 unset($_POST[
'tva_tx']);
803 unset($_POST[
'label']);
804 unset($_POST[
'product_ref']);
805 unset($_POST[
'product_label']);
806 unset($_POST[
'product_desc']);
807 unset($_POST[
'fournprice']);
808 unset($_POST[
'buying_price']);
809 unset($localtax1_tx);
810 unset($localtax2_tx);
811 unset($_POST[
'np_marginRate']);
812 unset($_POST[
'np_markRate']);
813 unset($_POST[
'dp_desc']);
814 unset($_POST[
'idprodfournprice']);
815 unset($_POST[
'idprod']);
817 unset($_POST[
'date_starthour']);
818 unset($_POST[
'date_startmin']);
819 unset($_POST[
'date_startsec']);
820 unset($_POST[
'date_startday']);
821 unset($_POST[
'date_startmonth']);
822 unset($_POST[
'date_startyear']);
823 unset($_POST[
'date_endhour']);
824 unset($_POST[
'date_endmin']);
825 unset($_POST[
'date_endsec']);
826 unset($_POST[
'date_endday']);
827 unset($_POST[
'date_endmonth']);
828 unset($_POST[
'date_endyear']);
838 elseif ($action ==
'updateline' && $usercancreate &&
GETPOST(
'save') == $langs->trans(
"Save")) {
843 if (preg_match(
'/\*/', $vat_rate))
850 $vat_rate = str_replace(
'*',
'', $vat_rate);
851 $localtax1_rate =
get_localtax($vat_rate, 1, $mysoc, $object->thirdparty);
852 $localtax2_rate =
get_localtax($vat_rate, 2, $mysoc, $object->thirdparty);
859 if (
GETPOST(
'price_ttc') !=
'')
862 $vatratecleaned = $vat_rate;
863 if (preg_match(
'/^(.*)\s*\((.*)\)$/', $vat_rate, $reg))
865 $vatratecleaned = trim($reg[1]);
866 $vatratecode = $reg[2];
870 $ht = $ttc / (1 + ($vatratecleaned / 100));
873 $price_base_type =
'HT';
877 $fournprice = (
GETPOST(
'fournprice') ?
GETPOST(
'fournprice') :
'');
878 $buyingprice = (
GETPOST(
'buying_price') !=
'' ?
GETPOST(
'buying_price') :
'');
881 $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
882 $array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
884 if (is_array($extralabelsline)) {
885 foreach ($extralabelsline as $key => $value) {
886 unset($_POST[
"options_".$key]);
891 $special_code =
GETPOST(
'special_code');
892 if (!
GETPOST(
'qty')) $special_code = 3;
895 $productid =
GETPOST(
'productid',
'int');
896 if (!empty($productid)) {
898 if (!empty($conf->global->SUPPLIER_PROPOSAL_WITH_PREDEFINED_PRICES_ONLY))
900 if ($productid > 0 && $productsupplier->get_buyprice(0,
price2num($_POST[
'qty']), $productid,
'none',
GETPOST(
'socid',
'int')) < 0)
902 setEventMessages($langs->trans(
"ErrorQtyTooLowForThisSupplier"), null,
'warnings');
907 $res = $product->fetch($productid);
909 $type = $product->type;
911 $price_min = $product->price_min;
912 if (!empty($conf->global->PRODUIT_MULTIPRICES) && !empty($object->thirdparty->price_level))
913 $price_min = $product->multiprices_min [$object->thirdparty->price_level];
918 $label = (
GETPOST(
'product_label') ?
GETPOST(
'product_label') :
'');
922 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")), null,
'errors');
930 $ref_supplier =
GETPOST(
'fourn_ref',
'alpha');
933 $result = $object->updateline(
960 if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
962 $outputlangs = $langs;
963 if (!empty($conf->global->MAIN_MULTILANGS)) {
965 $newlang = (
GETPOST(
'lang_id',
'aZ09') ?
GETPOST(
'lang_id',
'aZ09') : $object->thirdparty->default_lang);
966 $outputlangs->setDefaultLang($newlang);
968 $ret = $object->fetch($id);
969 $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
972 unset($_POST[
'qty']);
973 unset($_POST[
'type']);
974 unset($_POST[
'productid']);
975 unset($_POST[
'remise_percent']);
976 unset($_POST[
'price_ht']);
977 unset($_POST[
'multicurrency_price_ht']);
978 unset($_POST[
'price_ttc']);
979 unset($_POST[
'tva_tx']);
980 unset($_POST[
'product_ref']);
981 unset($_POST[
'product_label']);
982 unset($_POST[
'product_desc']);
983 unset($_POST[
'fournprice']);
984 unset($_POST[
'buying_price']);
986 unset($_POST[
'date_starthour']);
987 unset($_POST[
'date_startmin']);
988 unset($_POST[
'date_startsec']);
989 unset($_POST[
'date_startday']);
990 unset($_POST[
'date_startmonth']);
991 unset($_POST[
'date_startyear']);
992 unset($_POST[
'date_endhour']);
993 unset($_POST[
'date_endmin']);
994 unset($_POST[
'date_endsec']);
995 unset($_POST[
'date_endday']);
996 unset($_POST[
'date_endmonth']);
997 unset($_POST[
'date_endyear']);
1004 } elseif ($action ==
'updateline' && $usercancreate &&
GETPOST(
'cancel',
'alpha') == $langs->trans(
"Cancel")) {
1005 header(
'Location: '.
$_SERVER[
'PHP_SELF'].
'?id='.$object->id);
1010 elseif ($action ==
'classin' && $usercancreate) {
1011 $object->setProject(
GETPOST(
'projectid'),
'int');
1015 elseif ($action ==
'setavailability' && $usercancreate) {
1016 $result = $object->availability($_POST[
'availability_id']);
1020 elseif ($action ==
'setconditions' && $usercancreate) {
1021 $result = $object->setPaymentTerms(
GETPOST(
'cond_reglement_id',
'int'));
1022 } elseif ($action ==
'setremisepercent' && $usercancreate) {
1023 $result = $object->set_remise_percent($user,
GETPOST(
'remise_percent',
'alpha'));
1024 } elseif ($action ==
'setremiseabsolue' && $usercancreate) {
1025 $result = $object->set_remise_absolue($user,
GETPOST(
'remise_absolue',
'alpha'));
1029 elseif ($action ==
'setmode' && $usercancreate) {
1030 $result = $object->setPaymentMethods(
GETPOST(
'mode_reglement_id',
'int'));
1034 elseif ($action ==
'setmulticurrencycode' && $usercancreate) {
1035 $result = $object->setMulticurrencyCode(
GETPOST(
'multicurrency_code',
'alpha'));
1039 elseif ($action ==
'setmulticurrencyrate' && $usercancreate) {
1040 $result = $object->setMulticurrencyRate(
price2num(
GETPOST(
'multicurrency_tx')),
GETPOST(
'calculation_mode',
'int'));
1041 } elseif ($action ==
'update_extras') {
1045 $ret = $extrafields->setOptionalsFromPost(null, $object,
GETPOST(
'attribute',
'restricthtml'));
1046 if ($ret < 0) $error++;
1050 $result = $object->insertExtraFields(
'PROPOSAL_SUPPLIER_MODIFY');
1058 if ($error) $action =
'edit_extras';
1067 llxHeader(
'', $langs->trans(
'CommRequests'),
'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur');
1069 $form =
new Form($db);
1073 $companystatic =
new Societe($db);
1074 if (!empty($conf->projet->enabled)) { $formproject =
new FormProjets($db); }
1079 if ($action ==
'create')
1081 $currency_code = $conf->currency;
1087 $res = $soc->fetch($socid);
1090 if (!empty($origin) && !empty($originid))
1092 $element =
'supplier_proposal';
1093 $subelement =
'supplier_proposal';
1097 $classname = ucfirst($subelement);
1098 $objectsrc =
new $classname($db);
1099 $objectsrc->fetch($originid);
1100 if (empty($objectsrc->lines) && method_exists($objectsrc,
'fetch_lines'))
1102 $objectsrc->fetch_lines();
1104 $objectsrc->fetch_thirdparty();
1106 $projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project :
'');
1107 $soc = $objectsrc->thirdparty;
1109 $cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0));
1110 $mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0));
1111 $remise_percent = (!empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (!empty($soc->remise_supplier_percent) ? $soc->remise_supplier_percent : 0));
1112 $remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
1115 $objectsrc->fetch_optionals();
1116 $object->array_options = $objectsrc->array_options;
1118 if (!empty($conf->multicurrency->enabled))
1120 if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code;
1121 if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
1124 $cond_reglement_id = $soc->cond_reglement_supplier_id;
1125 $mode_reglement_id = $soc->mode_reglement_supplier_id;
1126 if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
1131 print '<form name="addprop" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
1132 print '<input type="hidden" name="token" value="'.newToken().
'">';
1133 print '<input type="hidden" name="action" value="add">';
1134 if ($origin !=
'project' && $originid) {
1135 print '<input type="hidden" name="origin" value="'.$origin.
'">';
1136 print '<input type="hidden" name="originid" value="'.$originid.
'">';
1141 print '<table class="border centpercent">';
1144 print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
'Ref').
'</td><td colspan="2">'.$langs->trans(
"Draft").
'</td></tr>';
1148 print '<td class="fieldrequired">'.$langs->trans(
'Supplier').
'</td>';
1150 print '<td colspan="2">';
1151 print $soc->getNomUrl(1);
1152 print '<input type="hidden" name="socid" value="'.$soc->id.
'">';
1155 print '<td colspan="2">';
1156 print img_picto(
'',
'company').$form->select_company(
'',
'socid',
's.fournisseur=1',
'SelectThirdParty', 0, 0, null, 0,
'minwidth300');
1157 print ' <a href="'.DOL_URL_ROOT.
'/societe/card.php?action=create&client=0&fournisseur=1&backtopage='.urlencode(
$_SERVER[
"PHP_SELF"].
'?action=create').
'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddThirdParty").
'"></span></a>';
1165 print '<tr><td>'.$langs->trans(
'Discounts').
'</td><td>';
1167 $absolute_discount = $soc->getAvailableDiscounts(
'',
'', 0, 1);
1171 $backtopage = urlencode(
$_SERVER[
"PHP_SELF"].
'?socid='.$thirdparty->id.
'&action='.$action.
'&origin='.
GETPOST(
'origin').
'&originid='.
GETPOST(
'originid'));
1172 include DOL_DOCUMENT_ROOT.
'/core/tpl/object_discounts.tpl.php';
1178 print '<tr><td class="nowrap">'.$langs->trans(
'PaymentConditionsShort').
'</td><td colspan="2">';
1179 $form->select_conditions_paiements(
GETPOST(
'cond_reglement_id') > 0 ?
GETPOST(
'cond_reglement_id') : $cond_reglement_id,
'cond_reglement_id', -1, 1);
1183 print '<tr><td>'.$langs->trans(
'PaymentMode').
'</td><td colspan="2">';
1184 $form->select_types_paiements(
GETPOST(
'mode_reglement_id') > 0 ?
GETPOST(
'mode_reglement_id') : $mode_reglement_id,
'mode_reglement_id');
1188 if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && !empty($conf->banque->enabled)) {
1189 print '<tr><td>'.$langs->trans(
'BankAccount').
'</td><td colspan="2">';
1190 $form->select_comptes(
GETPOST(
'fk_account') > 0 ?
GETPOST(
'fk_account',
'int') : $fk_account,
'fk_account', 0,
'', 1);
1195 if (!empty($conf->expedition->enabled)) {
1196 print '<tr><td>'.$langs->trans(
'SendingMethod').
'</td><td colspan="2">';
1197 print $form->selectShippingMethod(
GETPOST(
'shipping_method_id') > 0 ?
GETPOST(
'shipping_method_id',
'int') : $shipping_method_id,
'shipping_method_id',
'', 1);
1202 print '<tr><td>'.$langs->trans(
"DeliveryDate").
'</td>';
1203 print '<td colspan="2">';
1205 if ($conf->global->DATE_LIVRAISON_WEEK_DELAY !=
"") {
1206 $tmpdte = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60);
1207 $syear = date(
"Y", $tmpdte);
1208 $smonth = date(
"m", $tmpdte);
1209 $sday = date(
"d", $tmpdte);
1210 print $form->selectDate($syear.
"-".$smonth.
"-".$sday,
'liv_',
'',
'',
'',
"addask");
1212 print $form->selectDate($datedelivery ? $datedelivery : -1,
'liv_',
'',
'',
'',
"addask", 1, 1);
1219 print '<td>'.$langs->trans(
"DefaultModel").
'</td>';
1220 print '<td colspan="2">';
1222 $preselected = ($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT ? $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT : $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF);
1223 print $form->selectarray(
'model', $liste, $preselected, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1227 if (!empty($conf->projet->enabled))
1229 $langs->load(
"projects");
1233 if ($origin ==
'project') $projectid = ($originid ? $originid : 0);
1236 print '<td>'.$langs->trans(
"Project").
'</td><td colspan="2">';
1237 print img_picto(
'',
'project').$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
1238 print ' <a href="'.DOL_URL_ROOT.
'/projet/card.php?socid='.$soc->id.
'&action=create&status=1&backtopage='.urlencode(
$_SERVER[
"PHP_SELF"].
'?action=create&socid='.$soc->id).
'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans(
"AddProject").
'"></span></a>';
1245 if (!empty($conf->multicurrency->enabled)) {
1247 print '<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'', $object, 0).
'</td>';
1248 print '<td colspan="3" class="maxwidthonsmartphone">';
1249 print $form->selectMultiCurrency($currency_code,
'multicurrency_code');
1254 $parameters = array(
'colspan' =>
' colspan="3"',
'cols' => 3);
1255 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
1256 print $hookmanager->resPrint;
1257 if (empty($reshook)) {
1258 print $object->showOptionals($extrafields,
'edit', $parameters);
1263 if (!empty($origin) && !empty($originid) && is_object($objectsrc))
1266 if ($origin ==
'contrat') {
1268 $objectsrc->remise_absolue = $remise_absolue;
1269 $objectsrc->remise_percent = $remise_percent;
1270 $objectsrc->update_price(1, - 1, 1);
1273 print "\n<!-- ".$classname.
" info -->";
1275 print '<input type="hidden" name="amount" value="'.$objectsrc->total_ht.
'">'.
"\n";
1276 print '<input type="hidden" name="total" value="'.$objectsrc->total_ttc.
'">'.
"\n";
1277 print '<input type="hidden" name="tva" value="'.$objectsrc->total_tva.
'">'.
"\n";
1278 print '<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1279 print '<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1281 print '<tr><td>'.$langs->trans(
'CommRequest').
'</td><td colspan="2">'.$objectsrc->getNomUrl(1).
'</td></tr>';
1282 print '<tr><td>'.$langs->trans(
'AmountHT').
'</td><td colspan="2">'.
price($objectsrc->total_ht).
'</td></tr>';
1283 print '<tr><td>'.$langs->trans(
'AmountVAT').
'</td><td colspan="2">'.
price($objectsrc->total_tva).
"</td></tr>";
1284 if ($mysoc->localtax1_assuj ==
"1" || $objectsrc->total_localtax1 != 0)
1286 print '<tr><td>'.$langs->transcountry(
"AmountLT1", $mysoc->country_code).
'</td><td colspan="2">'.
price($objectsrc->total_localtax1).
"</td></tr>";
1289 if ($mysoc->localtax2_assuj ==
"1" || $objectsrc->total_localtax2 != 0)
1291 print '<tr><td>'.$langs->transcountry(
"AmountLT2", $mysoc->country_code).
'</td><td colspan="2">'.
price($objectsrc->total_localtax2).
"</td></tr>";
1293 print '<tr><td>'.$langs->trans(
'AmountTTC').
'</td><td colspan="2">'.
price($objectsrc->total_ttc).
"</td></tr>";
1295 if (!empty($conf->multicurrency->enabled))
1297 print '<tr><td>'.$langs->trans(
'MulticurrencyAmountHT').
'</td><td colspan="2">'.
price($objectsrc->multicurrency_total_ht).
'</td></tr>';
1298 print '<tr><td>'.$langs->trans(
'MulticurrencyAmountVAT').
'</td><td colspan="2">'.
price($objectsrc->multicurrency_total_tva).
"</td></tr>";
1299 print '<tr><td>'.$langs->trans(
'MulticurrencyAmountTTC').
'</td><td colspan="2">'.
price($objectsrc->multicurrency_total_ttc).
"</td></tr>";
1310 if (empty($conf->global->SUPPLIER_PROPOSAL_CLONE_ON_CREATE_PAGE))
print '<input type="hidden" name="createmode" value="empty">';
1312 if (!empty($conf->global->SUPPLIER_PROPOSAL_CLONE_ON_CREATE_PAGE))
1314 print '<br><table>';
1318 print '<td><input type="radio" name="createmode" value="copy"></td>';
1319 print '<td>'.$langs->trans(
"CopyAskFrom").
' </td>';
1321 $liste_ask = array();
1322 $liste_ask [0] =
'';
1324 $sql =
"SELECT p.rowid as id, p.ref, s.nom";
1325 $sql .=
" FROM ".MAIN_DB_PREFIX.
"supplier_proposal p";
1326 $sql .=
", ".MAIN_DB_PREFIX.
"societe s";
1327 $sql .=
" WHERE s.rowid = p.fk_soc";
1328 $sql .=
" AND p.entity = ".$conf->entity;
1329 $sql .=
" AND p.fk_statut <> ".SupplierProposal::STATUS_DRAFT;
1330 $sql .=
" ORDER BY Id";
1332 $resql = $db->query($sql);
1334 $num = $db->num_rows(
$resql);
1337 $row = $db->fetch_row(
$resql);
1338 $askPriceSupplierRefAndSocName = $row [1].
" - ".$row [2];
1339 $liste_ask [$row [0]] = $askPriceSupplierRefAndSocName;
1342 print $form->selectarray(
"copie_supplier_proposal", $liste_ask, 0);
1348 print '<tr><td class="tdtop"><input type="radio" name="createmode" value="empty" checked></td>';
1349 print '<td valign="top" colspan="2">'.$langs->trans(
"CreateEmptyAsk").
'</td></tr>';
1352 if (!empty($conf->global->SUPPLIER_PROPOSAL_CLONE_ON_CREATE_PAGE))
print '</table>';
1356 print '<div class="center">';
1357 print '<input type="submit" class="button" value="'.$langs->trans(
"CreateDraft").
'">';
1358 print ' ';
1359 print '<input type="button" class="button button-cancel" value="'.$langs->trans(
"Cancel").
'" onClick="javascript:history.go(-1)">';
1366 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
1369 $title = $langs->trans(
'ProductsAndServices');
1372 print '<table class="noborder centpercent">';
1374 $objectsrc->printOriginLinesList();
1384 $soc->fetch($object->socid);
1386 $head = supplier_proposal_prepare_head($object);
1392 if ($action ==
'clone') {
1394 $formquestion = array(
1399 array(
'type' =>
'other',
'name' =>
'socid',
'label' => $langs->trans(
"SelectThirdParty"),
'value' => $form->select_company(
GETPOST(
'socid',
'int'),
'socid',
's.fournisseur=1')));
1401 $formconfirm = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneAsk', $object->ref),
'confirm_clone', $formquestion,
'yes', 1);
1405 elseif ($action ==
'delete') {
1406 $formconfirm = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'DeleteAsk'), $langs->trans(
'ConfirmDeleteAsk', $object->ref),
'confirm_delete',
'', 0, 1);
1410 elseif ($action ==
'reopen') {
1411 $formconfirm = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ReOpen'), $langs->trans(
'ConfirmReOpenAsk', $object->ref),
'confirm_reopen',
'', 0, 1);
1415 elseif ($action ==
'ask_deleteline') {
1416 $formconfirm = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&lineid='.$lineid, $langs->trans(
'DeleteProductLine'), $langs->trans(
'ConfirmDeleteProductLine'),
'confirm_deleteline',
'', 0, 1);
1420 elseif ($action ==
'validate') {
1424 $ref = substr($object->ref, 1, 4);
1425 if ($ref ==
'PROV') {
1426 $numref = $object->getNextNumRef($soc);
1427 if (empty($numref)) {
1432 $numref = $object->ref;
1435 $text = $langs->trans(
'ConfirmValidateAsk', $numref);
1436 if (!empty($conf->notification->enabled)) {
1437 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1438 $notify =
new Notify($db);
1440 $text .= $notify->confirmMessage(
'PROPOSAL_SUPPLIER_VALIDATE', $object->socid, $object);
1444 $formconfirm = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ValidateAsk'), $text,
'confirm_validate',
'', 0, 1);
1448 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
1449 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
1450 if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
1451 elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
1458 $linkback = '<a href="'.DOL_URL_ROOT.'/supplier_proposal/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
1461 $morehtmlref = '<div class="refidno">';
1466 $morehtmlref .= $langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
1467 if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->
id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/supplier_proposal/list.php?socid='.$object->thirdparty->
id.'&search_societe='.urlencode($object->thirdparty->
name).'">'.$langs->trans("OtherProposals").'</a>)';
1469 if (!empty($conf->projet->enabled))
1471 $langs->load(
"projects");
1472 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
1475 if ($action !=
'classify') {
1476 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
1478 if ($action ==
'classify') {
1480 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
1481 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
1482 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
1483 $morehtmlref .= $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
1484 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
1485 $morehtmlref .=
'</form>';
1487 $morehtmlref .= $form->form_project(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
1490 if (!empty($object->fk_project)) {
1492 $proj->fetch($object->fk_project);
1493 $morehtmlref .=
'<a href="'.DOL_URL_ROOT.
'/projet/card.php?id='.$object->fk_project.
'" title="'.$langs->trans(
'ShowProject').
'">';
1494 $morehtmlref .= $proj->ref;
1495 $morehtmlref .=
'</a>';
1501 $morehtmlref .=
'</div>';
1504 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1507 print '<div class="fichecenter">';
1508 print '<div class="fichehalfleft">';
1509 print '<div class="underbanner clearboth"></div>';
1511 print '<table class="border tableforfield" width="100%">';
1514 if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
1515 $filterabsolutediscount =
"fk_invoice_supplier_source IS NULL";
1516 $filtercreditnote =
"fk_invoice_supplier_source IS NOT NULL";
1518 $filterabsolutediscount =
"fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')";
1519 $filtercreditnote =
"fk_invoice_supplier_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS PAID)%')";
1522 print '<tr><td class="titlefield">'.$langs->trans(
'Discounts').
'</td><td>';
1524 $absolute_discount = $soc->getAvailableDiscounts(
'', $filterabsolutediscount, 0, 1);
1525 $absolute_creditnote = $soc->getAvailableDiscounts(
'', $filtercreditnote, 0, 1);
1526 $absolute_discount =
price2num($absolute_discount,
'MT');
1527 $absolute_creditnote =
price2num($absolute_creditnote,
'MT');
1531 $backtopage = urlencode(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
1532 include DOL_DOCUMENT_ROOT.
'/core/tpl/object_discounts.tpl.php';
1537 print '<tr><td class="titlefield">';
1538 print '<table class="nobordernopadding" width="100%"><tr><td>';
1539 print $langs->trans(
'PaymentConditionsShort');
1542 print '<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editconditions&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetConditions'), 1).
'</a></td>';
1543 print '</tr></table>';
1544 print
'</td><td colspan="3">';
1545 if ($action ==
'editconditions') {
1546 $form->form_conditions_reglement(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->cond_reglement_id,
'cond_reglement_id', 1);
1548 $form->form_conditions_reglement(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->cond_reglement_id,
'none', 1);
1554 $langs->load(
'deliveries');
1556 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1557 print $langs->trans(
'DeliveryDate');
1560 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editdate_livraison&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetDeliveryDate'), 1).
'</a></td>';
1561 print
'</tr></table>';
1562 print
'</td><td colspan="3">';
1563 if ($action ==
'editdate_livraison') {
1564 print
'<form name="editdate_livraison" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post" class="formconsumeproduce">';
1565 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1566 print
'<input type="hidden" name="action" value="setdate_livraison">';
1567 print $form->selectDate($object->delivery_date,
'liv_',
'',
'',
'',
"editdate_livraison");
1568 print
'<input type="submit" class="button" value="'.$langs->trans(
'Modify').
'">';
1579 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1580 print $langs->trans(
'PaymentMode');
1583 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editmode&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetMode'), 1).
'</a></td>';
1584 print
'</tr></table>';
1585 print
'</td><td colspan="3">';
1586 if ($action ==
'editmode') {
1587 $form->form_modes_reglement(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->mode_reglement_id,
'mode_reglement_id',
'DBIT', 1, 1);
1589 $form->form_modes_reglement(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->mode_reglement_id,
'none');
1594 if (!empty($conf->multicurrency->enabled))
1599 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1600 print $form->editfieldkey(
'Currency',
'multicurrency_code',
'', $object, 0);
1602 if ($action !=
'editmulticurrencycode' && $object->statut == $object::STATUS_VALIDATED)
1603 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editmulticurrencycode&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetMultiCurrencyCode'), 1).
'</a></td>';
1604 print
'</tr></table>';
1605 print
'</td><td colspan="3">';
1606 if ($action ==
'editmulticurrencycode') {
1607 $form->form_multicurrency_code(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->multicurrency_code,
'multicurrency_code');
1609 $form->form_multicurrency_code(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->multicurrency_code,
'none');
1614 if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1)
1618 print
'<table class="nobordernopadding" width="100%"><tr><td>';
1619 print $form->editfieldkey(
'CurrencyRate',
'multicurrency_tx',
'', $object, 0);
1621 if ($action !=
'editmulticurrencyrate' && $object->statut == $object::STATUS_VALIDATED && $object->multicurrency_code && $object->multicurrency_code != $conf->currency)
1622 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editmulticurrencyrate&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetMultiCurrencyCode'), 1).
'</a></td>';
1623 print
'</tr></table>';
1624 print
'</td><td colspan="3">';
1625 if ($action ==
'editmulticurrencyrate' || $action ==
'actualizemulticurrencyrate') {
1626 if ($action ==
'actualizemulticurrencyrate') {
1629 $form->form_multicurrency_rate(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->multicurrency_tx,
'multicurrency_tx', $object->multicurrency_code);
1631 $form->form_multicurrency_rate(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->multicurrency_tx,
'none', $object->multicurrency_code);
1632 if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
1633 print
'<div class="inline-block"> ';
1634 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=actualizemulticurrencyrate">'.$langs->trans(
"ActualizeCurrency").
'</a>';
1656 if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && !empty($conf->banque->enabled))
1660 print
'<table width="100%" class="nobordernopadding"><tr><td>';
1661 print $langs->trans(
'BankAccount');
1663 if ($action !=
'editbankaccount' && $usercancreate)
1664 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editbankaccount&id='.$object->id.
'">'.
img_edit($langs->trans(
'SetBankAccount'), 1).
'</a></td>';
1665 print
'</tr></table>';
1666 print
'</td><td colspan="3">';
1667 if ($action ==
'editbankaccount') {
1668 $form->formSelectAccount(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->fk_account,
'fk_account', 1);
1670 $form->formSelectAccount(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->fk_account,
'none');
1678 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1683 print
'<div class="fichehalfright">';
1684 print
'<div class="ficheaddleft">';
1685 print
'<div class="underbanner clearboth"></div>';
1687 print
'<table class="border tableforfield centpercent">';
1689 if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
1692 print
'<tr><td class="titlefieldmiddle">'.$form->editfieldkey(
'MulticurrencyAmountHT',
'multicurrency_total_ht',
'', $object, 0).
'</td>';
1693 print
'<td>'.price($object->multicurrency_total_ht,
'', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).
'</td>';
1697 print
'<tr><td>'.$form->editfieldkey(
'MulticurrencyAmountVAT',
'multicurrency_total_tva',
'', $object, 0).
'</td>';
1698 print
'<td>'.price($object->multicurrency_total_tva,
'', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).
'</td>';
1702 print
'<tr><td>'.$form->editfieldkey(
'MulticurrencyAmountTTC',
'multicurrency_total_ttc',
'', $object, 0).
'</td>';
1703 print
'<td>'.price($object->multicurrency_total_ttc,
'', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).
'</td>';
1708 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
'AmountHT').
'</td>';
1709 print
'<td>'.price($object->total_ht,
'', $langs, 0, - 1, - 1, $conf->currency).
'</td>';
1713 print
'<tr><td>'.$langs->trans(
'AmountVAT').
'</td>';
1714 print
'<td>'.price($object->total_tva,
'', $langs, 0, - 1, - 1, $conf->currency).
'</td>';
1718 if ($mysoc->localtax1_assuj ==
"1" || $object->total_localtax1 != 0)
1720 print
'<tr><td>'.$langs->transcountry(
"AmountLT1", $mysoc->country_code).
'</td>';
1721 print
'<td class="nowrap">'.price($object->total_localtax1,
'', $langs, 0, - 1, - 1, $conf->currency).
'</td>';
1724 if ($mysoc->localtax2_assuj ==
"1" || $object->total_localtax2 != 0)
1726 print
'<tr><td height="10">'.$langs->transcountry(
"AmountLT2", $mysoc->country_code).
'</td>';
1727 print
'<td class="nowrap">'.price($object->total_localtax2,
'', $langs, 0, - 1, - 1, $conf->currency).
'</td>';
1732 print
'<tr><td height="10">'.$langs->trans(
'AmountTTC').
'</td>';
1733 print
'<td class="nowrap">'.price($object->total_ttc,
'', $langs, 0, - 1, - 1, $conf->currency).
'</td>';
1747 print
'<div class="clearboth"></div><br>';
1749 if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
1750 $blocname =
'contacts';
1751 $title = $langs->trans(
'ContactsAddresses');
1752 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1755 if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
1756 $blocname =
'notes';
1757 $title = $langs->trans(
'Notes');
1758 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
1766 $result = $object->getLinesArray();
1768 print
' <form name="addproduct" id="addproduct" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.(($action !=
'editline') ?
'#add' :
'#line_'.
GETPOST(
'lineid')).
'" method="POST">
1769 <input type="hidden" name="token" value="' .
newToken().
'">
1770 <input type="hidden" name="action" value="' . (($action !=
'editline') ?
'addline' :
'updateline').
'">
1771 <input type="hidden" name="mode" value="">
1772 <input type="hidden" name="id" value="' . $object->id.
'">
1776 include DOL_DOCUMENT_ROOT.
'/core/tpl/ajaxrow.tpl.php';
1779 print
'<div class="div-table-responsive-no-min">';
1780 print
'<table id="tablelines" class="noborder noshadow" width="100%">';
1783 global $forceall, $senderissupplier, $dateSelector, $inputalsopricewithtax;
1784 $forceall = 1; $dateSelector = 0; $inputalsopricewithtax = 1;
1785 $senderissupplier = 2;
1786 if (!empty($conf->global->SUPPLIER_PROPOSAL_WITH_PREDEFINED_PRICES_ONLY)) $senderissupplier = 1;
1788 if (!empty($object->lines))
1789 $ret = $object->printObjectLines($action, $soc, $mysoc, $lineid, $dateSelector);
1794 if ($action !=
'editline')
1797 $object->formAddObjectLine($dateSelector, $soc, $mysoc);
1799 $parameters = array();
1800 $reshook = $hookmanager->executeHooks(
'formAddObjectLine', $parameters, $object, $action);
1810 if ($action ==
'statut')
1813 $form_close =
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="POST" id="formacceptrefuse" class="formconsumeproduce">';
1814 $form_close .=
'<input type="hidden" name="token" value="'.newToken().
'">';
1815 $form_close .=
'<input type="hidden" name="action" value="setstatut">';
1817 if (!empty($conf->global->SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL)) $form_close .=
'<p class="notice">'.$langs->trans(
'SupplierProposalRefFournNotice').
'</p>';
1818 $form_close .=
'<table class="border centpercent">';
1819 $form_close .=
'<tr><td width="150" class="left">'.$langs->trans(
"CloseAs").
'</td><td class="left">';
1820 $form_close .=
'<select id="statut" name="statut" class="flat">';
1821 $form_close .=
'<option value="0"> </option>';
1822 $form_close .=
'<option value="2">'.$langs->trans(
'SupplierProposalStatusSigned').
'</option>';
1823 $form_close .=
'<option value="3">'.$langs->trans(
'SupplierProposalStatusNotSigned').
'</option>';
1824 $form_close .=
'</select>';
1825 $form_close .=
'</td></tr>';
1826 $form_close .=
'<tr><td width="150" class="left">'.$langs->trans(
'Note').
'</td><td class="left"><textarea cols="70" rows="'.ROWS_3.
'" wrap="soft" name="note">';
1827 $form_close .= $object->note;
1828 $form_close .=
'</textarea></td></tr>';
1829 $form_close .=
'<tr><td class="center" colspan="2">';
1830 $form_close .=
'<input type="submit" class="button button-save" name="validate" value="'.$langs->trans(
"Save").
'">';
1831 $form_close .=
' <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
1832 $form_close .=
'<a name="acceptedrefused"> </a>';
1833 $form_close .=
'</td>';
1834 $form_close .=
'</tr></table></form>';
1842 if ($action !=
'presend') {
1843 print
'<div class="tabsAction">';
1845 $parameters = array();
1846 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1848 if (empty($reshook))
1850 if ($action !=
'statut' && $action !=
'editline')
1855 if (count($object->lines) > 0)
1856 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=validate">'.$langs->trans(
'Validate').
'</a></div>';
1862 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=modif">'.$langs->trans(
'Modify').
'</a></div>';
1867 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=reopen'.(empty($conf->global->MAIN_JUMP_TAG) ?
'' :
'#reopen').
'"';
1868 print
'>'.$langs->trans(
'ReOpen').
'</a></div>';
1872 if (empty($user->socid)) {
1875 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans(
'SendMail').
'</a></div>';
1876 }
else print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
'SendMail').
'</a></div>';
1882 if ($usercancreateorder) {
1883 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/fourn/commande/card.php?action=create&origin='.$object->element.
'&originid='.$object->id.
'&socid='.$object->socid.
'">'.$langs->trans(
"AddOrder").
'</a></div>';
1889 print
'<div class="inline-block divButAction"><a class="butAction reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=statut'.(empty($conf->global->MAIN_JUMP_TAG) ?
'' :
'#acceptedrefused').
'"';
1890 print
'>'.$langs->trans(
'SetAcceptedRefused').
'</a></div>';
1895 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=close'.(empty($conf->global->MAIN_JUMP_TAG) ?
'' :
'#close').
'"';
1896 print
'>'.$langs->trans(
'Close').
'</a></div>';
1900 if ($usercancreate) {
1901 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&socid='.$object->socid.
'&action=clone&object='.$object->element.
'">'.$langs->trans(
"ToClone").
'</a></div>';
1906 print
'<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=delete&token='.
newToken().
'"';
1907 print
'>'.$langs->trans(
'Delete').
'</a></div>';
1915 if ($action !=
'presend')
1917 print
'<div class="fichecenter"><div class="fichehalfleft">';
1924 $urlsource =
$_SERVER[
"PHP_SELF"].
"?id=".$object->id;
1925 $genallowed = $usercanread;
1926 $delallowed = $usercancreate;
1928 print $formfile->showdocuments(
'supplier_proposal', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'', 0,
'', $soc->default_lang);
1932 $linktoelem = $form->showLinkToObjectBlock($object, null, array(
'supplier_proposal'));
1933 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
1936 print
'</div><div class="fichehalfright"><div class="ficheaddleft">';
1939 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1941 $somethingshown =
$formactions->showactions($object,
'supplier_proposal', $socid, 1);
1943 print
'</div></div></div>';
1947 if (
GETPOST(
'modelselected')) {
1948 $action =
'presend';
1952 $modelmail =
'supplier_proposal_send';
1953 $defaulttopic =
'SendAskRef';
1954 $diroutput = $conf->supplier_proposal->dir_output;
1955 $autocopy =
'MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO';
1956 $trackid =
'spro'.$object->id;
1958 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname= '')
Make an include_once using default root and alternate root if it fails.
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage notifications.
img_edit($titlealt= 'default', $float=0, $other= '')
Show logo editer/modifier fiche.
if(preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if(preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) if($action== 'set') elseif($action== 'specimen') elseif($action== 'setmodel') elseif($action== 'del') elseif($action== 'setdoc') $formactions
View.
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...
const STATUS_NOTSIGNED
Not signed quote, canceled.
static getIdAndTxFromCode($db, $code, $date_document= '')
Get id and rate of currency from code.
Class to manage products or services.
dol_now($mode= 'auto')
Return date for now.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for properties) With native = 0: P...
const STATUS_CLOSE
Billed or closed/processed quote.
get_default_npr(Societe $thirdparty_seller, Societe $thirdparty_buyer, $idprod=0, $idprodfournprice=0)
Fonction qui renvoie si tva doit etre tva percue recuperable.
$conf db name
Only used if Module[ID]Name translation string is not found.
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...
get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller="", $vatnpr=0)
Return localtax rate for a particular vat, when selling a product with vat $vatrate, from a $thirdparty_buyer to a $thirdparty_seller Note: This function applies same rules than get_default_tva.
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...
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
const STATUS_SIGNED
Signed quote.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage projects.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
const STATUS_VALIDATED
Validated status.
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_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
Class to manage translations.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
const STATUS_DRAFT
Draft status.
Class to manage price ask supplier.
dol_htmlcleanlastbr($stringtodecode)
This function remove all ending and br at end.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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) Si ...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
Class to manage predefined suppliers products.