40require
'../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_proposal/modules_supplier_proposal.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/lib/supplier_proposal.lib.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
52 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
53 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
66$langs->loadLangs(array(
'companies',
'supplier_proposal',
'compta',
'bills',
'propal',
'orders',
'products',
'sendings'));
68 $langs->load(
'margins');
76$action =
GETPOST(
'action',
'aZ09');
77$cancel =
GETPOST(
'cancel',
'alpha');
78$backtopage =
GETPOST(
'backtopage',
'alpha');
79$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
81$origin =
GETPOST(
'origin',
'alpha');
83$confirm =
GETPOST(
'confirm',
'alpha');
98$hookmanager->initHooks(array(
'supplier_proposalcard',
'globalcard'));
107$extrafields->fetch_name_optionals_label(
$object->table_element);
110if ($id > 0 || !empty($ref)) {
111 $ret =
$object->fetch($id, $ref);
113 $ret =
$object->fetch_thirdparty();
122$usercanread = $user->hasRight(
'supplier_proposal',
'lire');
123$usercancreate = $user->hasRight(
'supplier_proposal',
'creer');
124$usercandelete = $user->hasRight(
'supplier_proposal',
'supprimer');
127$usercanvalidate = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !empty($usercancreate)) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'supplier_proposal',
'validate_advance')));
128$usercansend = (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || $user->hasRight(
'supplier_proposal',
'send_advance'));
131$usercanclose = $user->hasRight(
'supplier_proposal',
'cloturer');
132$usercancreateorder = ($user->hasRight(
'fournisseur',
'commande',
'creer') || $user->hasRight(
'supplier_order',
'creer'));
135$permissionnote = $usercancreate;
136$permissiondellink = $usercancreate;
137$permissiontoedit = $usercancreate;
138$permissiontoadd = $usercancreate;
139$permissiontoeditextra = $permissiontoadd;
140if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
142 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
146if (!empty($user->socid)) {
147 $socid = $user->socid;
156$parameters = array(
'socid' => $socid);
157$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
165if (empty($reshook)) {
166 $backurlforlist = DOL_URL_ROOT.
'/supplier_proposal/list.php';
168 if (empty($backtopage) || ($cancel && empty($id))) {
169 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
170 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
171 $backtopage = $backurlforlist;
173 $backtopage = DOL_URL_ROOT.
'/supplier_proposal/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
178 if ($cancel && !($action ==
'updateline' && $usercancreate)) {
179 if (!empty($backtopageforcancel)) {
180 header(
"Location: ".$backtopageforcancel);
182 } elseif (!empty($backtopage)) {
183 header(
"Location: ".$backtopage);
189 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
191 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
193 include DOL_DOCUMENT_ROOT.
'/core/actions_lineupdown.inc.php';
196 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $usercancreate) {
197 if (
false && !
GETPOST(
'clone_content') && !
GETPOST(
'clone_receivers')) {
201 $result =
$object->createFromClone($user, $socid);
203 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$result);
211 } elseif ($action ==
'confirm_delete' && $confirm ==
'yes' && $usercandelete) {
213 $result =
$object->delete($user);
215 header(
'Location: '.DOL_URL_ROOT.
'/supplier_proposal/list.php');
218 $langs->load(
"errors");
221 } elseif ($action ==
'confirm_deleteline' && $confirm ==
'yes' && $usercancreate) {
223 $result =
$object->deleteLine($lineid);
228 $langs->load(
"errors");
234 $outputlangs = $langs;
237 $newlang = (
GETPOST(
'lang_id',
'aZ09') ?
GETPOST(
'lang_id',
'aZ09') :
$object->thirdparty->default_lang);
238 $outputlangs->setDefaultLang($newlang);
244 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
247 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
249 } elseif ($action ==
'confirm_delete_subtotalline' && $confirm ==
'yes' && $usercancreate) {
254 $result =
$object->deleteSubtotalLine($langs,
GETPOSTINT(
'lineid'), (
bool)
GETPOST(
'deletecorrespondingsubtotalline'));
259 $outputlangs = $langs;
265 $newlang =
$object->thirdparty->default_lang;
267 if (!empty($newlang)) {
269 $outputlangs->setDefaultLang($newlang);
270 $outputlangs->load(
'products');
274 $result =
$object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
277 header(
'Location: '.
dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' => $id]));
284 } elseif ($action ==
'confirm_validate' && $confirm ==
'yes' && $usercanvalidate) {
286 $result =
$object->valid($user);
289 $outputlangs = $langs;
292 $newlang =
GETPOST(
'lang_id',
'aZ09');
295 $newlang =
$object->thirdparty->default_lang;
297 if (!empty($newlang)) {
299 $outputlangs->setDefaultLang($newlang);
307 $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
310 $langs->load(
"errors");
311 if (count(
$object->errors) > 0) {
317 } elseif ($action ==
'setdate_livraison' && $usercancreate) {
322 } elseif ($action ==
'add' && $usercancreate) {
330 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Supplier")),
null,
'errors');
341 if (
GETPOST(
'createmode') ==
'copy' &&
GETPOSTINT(
'copie_supplier_proposal') > 0) {
344 $object->delivery_date = $date_delivery;
352 $object->model_pdf = $model_pdf;
354 $object->user_creation_id = $user->id;
360 setEventMessages($langs->trans(
"ErrorFailedToCopyProposal",
GETPOST(
'copie_supplier_proposal')),
null,
'errors');
364 $object->delivery_date = $date_delivery;
372 $object->model_pdf = $model_pdf;
374 $object->user_creation_id = $user->id;
383 $object->multicurrency_code =
GETPOST(
'multicurrency_code',
'alpha');
387 $ret = $extrafields->setOptionalsFromPost(
null, $object);
395 if ($origin && $originid) {
397 $element = $subelement = $origin;
399 if (preg_match(
'/^([^_]+)_([^_]+)/i', $origin, $regs)) {
401 $subelement = $regs[2];
405 if ($element ==
'order') {
406 $element = $subelement =
'commande';
408 if ($element ==
'propal') {
409 $element =
'comm/propal';
410 $subelement =
'propal';
412 if ($element ==
'contract') {
413 $element = $subelement =
'contrat';
415 if ($element ==
'inter') {
416 $element = $subelement =
'fichinter';
418 if ($element ==
'shipping') {
419 $element = $subelement =
'expedition';
423 $object->origin_type = $origin;
424 $object->origin_id = $originid;
429 $object->linked_objects = array_merge(
$object->linked_objects,
GETPOST(
'other_linked_objects',
'array:int'));
437 $classname = ucfirst($subelement);
438 $srcobject =
new $classname(
$db);
439 '@phan-var-force Commande|Propal|Contrat|Fichinter|Expedition $srcobject';
441 dol_syslog(
"Try to find source object origin=".
$object->origin_type.
" originid=".
$object->origin_id.
" to add lines");
442 $result = $srcobject->fetch(
$object->origin_id);
445 $lines = $srcobject->lines;
446 if (empty($lines) && method_exists($srcobject,
'fetch_lines')) {
447 $srcobject->fetch_lines();
448 $lines = $srcobject->lines;
452 $num = count($lines);
453 for ($i = 0; $i < $num; $i++) {
454 $label = (!empty($lines[$i]->label) ? $lines[$i]->label :
'');
455 $desc = (!empty($lines[$i]->desc) ? $lines[$i]->desc :
'');
458 $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
461 if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
466 if (method_exists($lines[$i],
'fetch_optionals')) {
467 $lines[$i]->fetch_optionals();
468 $array_options = $lines[$i]->array_options;
470 $array_options = array();
475 $lines[$i]->subprice,
478 $lines[$i]->localtax1_tx,
479 $lines[$i]->localtax2_tx,
480 $lines[$i]->fk_product,
481 $lines[$i]->remise_percent,
484 $lines[$i]->info_bits,
487 $lines[$i]->special_code,
489 $lines[$i]->fk_fournprice,
493 $lines[$i]->ref_supplier,
506 if ($result > 0 && $lines[$i]->product_type == 9) {
507 $fk_parent_line = $result;
512 $parameters = array(
'objFrom' => $srcobject);
513 $reshook = $hookmanager->executeHooks(
'createFrom', $parameters, $object, $action);
534 $categories =
GETPOST(
'categories',
'array');
535 $object->setCategories($categories);
542 $outputlangs = $langs;
545 $newlang =
GETPOST(
'lang_id',
'aZ09');
548 $newlang =
$object->thirdparty->default_lang;
550 if (!empty($newlang)) {
552 $outputlangs->setDefaultLang($newlang);
556 if (!empty($model)) {
558 $result =
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
565 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
578 } elseif ($action ==
'confirm_reopen' && $usercanclose && !
GETPOST(
'cancel',
'alpha')) {
584 } elseif ($action ==
'close' && $usercanclose && !
GETPOST(
'cancel',
'alpha')) {
590 } elseif ($action ==
'setstatut' && $usercanclose && !
GETPOST(
'cancel',
'alpha')) {
593 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"CloseAs")),
null,
'errors');
601 } elseif ($action ==
'addline' &&
GETPOST(
'updateallvatlinesblock',
'alpha') &&
GETPOST(
'vatforblocklines',
'alpha') !==
'' && $usercancreate) {
602 $tx_tva =
GETPOST(
'vatforblocklines') ?
GETPOST(
'vatforblocklines') : 0;
603 $object->updateSubtotalLineBlockLines($langs,
$object->getRangOfLine($lineid),
'tva', $tx_tva);
604 } elseif ($action ==
'addline' &&
GETPOST(
'updatealldiscountlinesblock',
'alpha') &&
GETPOST(
'discountforblocklines',
'alpha') !==
'' && $usercancreate) {
605 $discount =
GETPOST(
'discountforblocklines') ?
GETPOST(
'discountforblocklines') : 0;
606 $object->updateSubtotalLineBlockLines($langs,
$object->getRangOfLine($lineid),
'discount', $discount);
607 } elseif ($action ==
'settags' &&
isModEnabled(
'category') && $usercancreate) {
612 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
615 $triggersendname =
'PROPOSAL_SUPPLIER_SENTBYMAIL';
616 $autocopy =
'MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO';
617 $trackid =
'spro'.$object->id;
618 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
621 $upload_dir =
$conf->supplier_proposal->dir_output;
622 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
625 if ($action ==
'modif' && $usercancreate) {
630 $outputlangs = $langs;
633 $newlang = (
GETPOST(
'lang_id',
'aZ09') ?
GETPOST(
'lang_id',
'aZ09') :
$object->thirdparty->default_lang);
634 $outputlangs->setDefaultLang($newlang);
640 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
642 } elseif ($action ==
"setabsolutediscount" && $usercancreate) {
654 if ($action ==
'addline' &&
GETPOST(
'submitforalllines',
'aZ09') &&
GETPOST(
'vatforalllines',
'alpha') && $usercancreate) {
656 $vat_rate = (
GETPOST(
'vatforalllines') ?
GETPOST(
'vatforalllines') : 0);
657 $vat_rate = str_replace(
'*',
'', $vat_rate);
660 foreach (
$object->lines as $line) {
661 if ($line->special_code == SUBTOTALS_SPECIAL_CODE) {
664 $result =
$object->updateline($line->id, $line->subprice, $line->qty, (
float) $line->remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $line->desc,
'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->array_options, $line->ref_fourn, $line->fk_unit, $line->multicurrency_subprice);
666 } elseif ($action ==
'confirm_addtitleline' && $usercancreate) {
669 $langs->load(
'subtotals');
671 $desc =
GETPOST(
'subtotallinedesc',
'alphanohtml');
672 $depth =
GETPOSTINT(
'subtotallinelevel') ?? 1;
674 $subtotal_options = array();
676 foreach (SupplierProposal::$TITLE_OPTIONS as $option) {
677 $value =
GETPOST($option,
'alphanohtml');
679 $subtotal_options[$option] = $value ==
'on' ? 1 : $value;
684 $result =
$object->addSubtotalLine($langs, $desc, (
int) $depth, $subtotal_options);
695 $outputlangs = $langs;
696 $newlang =
GETPOST(
'lang_id',
'alpha');
698 $newlang =
$object->thirdparty->default_lang;
700 if (!empty($newlang)) {
702 $outputlangs->setDefaultLang($newlang);
705 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
710 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
712 } elseif ($action ==
'confirm_addsubtotalline' && $usercancreate) {
715 $langs->load(
'subtotals');
717 $choosen_line =
GETPOST(
'subtotaltitleline',
'alphanohtml');
718 foreach (
$object->lines as $line) {
719 if ($line->desc == $choosen_line && $line->special_code == SUBTOTALS_SPECIAL_CODE) {
721 $depth = -$line->qty;
725 $subtotal_options = array();
727 foreach (SupplierProposal::$SUBTOTAL_OPTIONS as $option) {
728 $value =
GETPOST($option,
'alphanohtml');
730 $subtotal_options[$option] = $value ==
'on' ? 1 : $value;
735 if (isset($desc) && isset($depth)) {
736 $result =
$object->addSubtotalLine($langs, $desc, (
int) $depth, $subtotal_options);
739 $object->errors[] = $langs->trans(
"CorrespondingTitleNotFound");
748 $outputlangs = $langs;
749 $newlang =
GETPOST(
'lang_id',
'alpha');
751 $newlang =
$object->thirdparty->default_lang;
753 if (!empty($newlang)) {
755 $outputlangs->setDefaultLang($newlang);
758 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
763 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
765 } elseif ($action ==
'addline' && $usercancreate) {
766 $langs->load(
'errors');
775 $ref_supplier =
GETPOST(
'fourn_ref',
'alpha');
777 $prod_entry_mode =
GETPOST(
'prod_entry_mode',
'aZ09');
778 if ($prod_entry_mode ==
'free') {
794 if (empty($remise_percent)) {
799 $extralabelsline = $extrafields->fetch_name_optionals_label(
$object->table_element_line);
800 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line, $predef);
802 if (is_array($extralabelsline)) {
804 foreach ($extralabelsline as $key => $value) {
805 unset($_POST[
"options_".$key]);
809 if ($prod_entry_mode ==
'free' &&
GETPOST(
'price_ht') < 0 && $qty < 0) {
810 setEventMessages($langs->trans(
'ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv(
'UnitPrice'), $langs->transnoentitiesnoconv(
'Qty')),
null,
'errors');
813 if ($prod_entry_mode ==
'free' && (empty($idprod) || $idprod < 0) &&
GETPOST(
'type') < 0) {
814 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
818 if ($prod_entry_mode ==
'free' && (empty($idprod) || $idprod < 0) &&
GETPOST(
'price_ht') ===
'' &&
GETPOST(
'price_ttc') ===
'' &&
GETPOST(
'multicurrency_price_ht') ===
'') {
819 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"UnitPrice")),
null,
'errors');
822 if ($prod_entry_mode ==
'free' && (empty($idprod) || $idprod < 0) && empty($line_desc)) {
823 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Description")),
null,
'errors');
826 if (!$error && ($qty >= 0)) {
830 $price_base_type = (
GETPOST(
'price_base_type',
'alpha') ?
GETPOST(
'price_base_type',
'alpha') :
'HT');
834 if ($prod_entry_mode !=
'free' && empty($error)) {
838 if (
GETPOST(
'idprodfournprice',
'alpha') == -1 ||
GETPOST(
'idprodfournprice',
'alpha') ==
'') {
843 if (preg_match(
'/^idprod_([0-9]+)$/',
GETPOST(
'idprodfournprice',
'alpha'), $reg)) {
844 $idprod = (int) $reg[1];
845 $res = $productsupplier->fetch($idprod);
848 if (
getDolGlobalString(
'SUPPLIER_TAKE_FIRST_PRICE_IF_NO_PRICE_FOR_CURRENT_SUPPLIER')) {
850 $productsupplier->get_buyprice(0, -1, $idprod,
'none', $fksoctosearch);
851 if ($productsupplier->fourn_socid != $socid) {
852 $productsupplier->ref_supplier =
'';
855 $fksoctosearch =
$object->thirdparty->id;
856 $productsupplier->get_buyprice(0, -1, $idprod,
'none', $fksoctosearch);
858 } elseif (
GETPOSTINT(
'idprodfournprice') > 0) {
861 $idprod = $productsupplier->get_buyprice(
GETPOSTINT(
'idprodfournprice'), $qtytosearch);
862 $res = $productsupplier->fetch($idprod);
866 $label = $productsupplier->label;
870 $outputlangs = $langs;
872 if (
GETPOST(
'lang_id',
'aZ09')) {
873 $newlang =
GETPOST(
'lang_id',
'aZ09');
875 if (empty($newlang)) {
876 $newlang =
$object->thirdparty->default_lang;
878 if (!empty($newlang)) {
880 $outputlangs->setDefaultLang($newlang);
882 $desc = (!empty($productsupplier->multilangs[$outputlangs->defaultlang][
"description"])) ? $productsupplier->multilangs[$outputlangs->defaultlang][
"description"] : $productsupplier->
description;
884 $desc = $productsupplier->description;
887 if (!empty($productsupplier->desc_supplier) &&
getDolGlobalString(
'PRODUIT_FOURN_TEXTS')) {
888 $desc = $productsupplier->desc_supplier;
899 $ref_supplier = $productsupplier->ref_supplier;
904 $tmpidprodfournprice =
GETPOST(
'idprodfournprice',
'alpha');
905 if (is_numeric($tmpidprodfournprice) && (
int) $tmpidprodfournprice > 0) {
906 $tmpidprodfournprice = (int) $tmpidprodfournprice;
908 $tmpidprodfournprice = 0;
914 if (empty($tva_tx)) {
920 $type = $productsupplier->type;
921 if (
GETPOST(
'price_ht') !=
'' ||
GETPOST(
'multicurrency_price_ht') !=
'') {
922 $price_base_type =
'HT';
924 $pu_devise =
price2num($price_ht_devise,
'CU');
925 } elseif (
GETPOST(
'price_ttc') !=
'' ||
GETPOST(
'multicurrency_price_ttc') !=
'') {
926 $price_base_type =
'TTC';
928 $pu_devise =
price2num($price_ttc_devise,
'CU');
930 $price_base_type = ($productsupplier->fourn_price_base_type ? $productsupplier->fourn_price_base_type :
'HT');
931 if (empty(
$object->multicurrency_code) || ($productsupplier->fourn_multicurrency_code !=
$object->multicurrency_code)) {
932 $pu = $productsupplier->fourn_pu;
935 $pu = $productsupplier->fourn_pu;
936 $pu_devise = $productsupplier->fourn_multicurrency_unitprice;
945 $fournprice = (is_numeric(
GETPOST(
'idprodfournprice',
'alpha')) ?
GETPOST(
'idprodfournprice',
'alpha') : -1);
950 ($price_base_type ==
'HT' ? $pu : 0),
955 $productsupplier->id,
958 ($price_base_type ==
'TTC' ? $pu : 0),
961 min($rank, count(
$object->lines) + 1),
969 $productsupplier->fk_unit,
985 if ($idprod == -99 || $idprod == 0) {
988 $langs->load(
"errors");
989 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ProductOrService")).
' '.$langs->trans(
"or").
' '.$langs->trans(
"NoPriceDefinedForThisSupplier"),
null,
'errors');
994 $langs->load(
"errors");
995 setEventMessages($langs->trans(
"ErrorQtyTooLowForThisSupplier"),
null,
'errors');
997 } elseif ((
GETPOST(
'price_ht') !==
'' ||
GETPOST(
'price_ttc') !==
'' ||
GETPOST(
'multicurrency_price_ht') !=
'') && empty($error)) {
1001 $tva_npr = (preg_match(
'/\*/', $tva_tx) ? 1 : 0);
1002 $tva_tx = str_replace(
'*',
'', $tva_tx);
1003 $label = (
GETPOST(
'product_label') ?
GETPOST(
'product_label') :
'');
1009 if (!preg_match(
'/\((.*)\)/', $tva_tx)) {
1017 if (
GETPOST(
'price_ht') !=
'' ||
GETPOST(
'multicurrency_price_ht') !=
'') {
1021 $pu_ht =
price2num((
float) $pu_ttc / (1 + ((
float) $tva_tx / 100)),
'MU');
1023 $price_base_type =
'HT';
1024 $pu_ht_devise =
price2num($price_ht_devise,
'CU');
1051 (
float) $pu_ht_devise
1056 if (!$error && $result > 0) {
1063 $outputlangs = $langs;
1066 $newlang =
GETPOST(
'lang_id',
'aZ09');
1069 $newlang =
$object->thirdparty->default_lang;
1071 if (!empty($newlang)) {
1073 $outputlangs->setDefaultLang($newlang);
1081 $result =
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
1087 unset($_POST[
'prod_entry_mode']);
1089 unset($_POST[
'qty']);
1090 unset($_POST[
'type']);
1091 unset($_POST[
'remise_percent']);
1092 unset($_POST[
'pu']);
1093 unset($_POST[
'price_ht']);
1094 unset($_POST[
'multicurrency_price_ht']);
1095 unset($_POST[
'price_ttc']);
1096 unset($_POST[
'fourn_ref']);
1097 unset($_POST[
'tva_tx']);
1098 unset($_POST[
'label']);
1099 unset($_POST[
'product_ref']);
1100 unset($_POST[
'product_label']);
1101 unset($_POST[
'product_desc']);
1102 unset($_POST[
'fournprice']);
1103 unset($_POST[
'buying_price']);
1104 unset($localtax1_tx);
1105 unset($localtax2_tx);
1106 unset($_POST[
'np_marginRate']);
1107 unset($_POST[
'np_markRate']);
1108 unset($_POST[
'dp_desc']);
1109 unset($_POST[
'idprodfournprice']);
1110 unset($_POST[
'units']);
1112 unset($_POST[
'idprod']);
1114 unset($_POST[
'date_starthour']);
1115 unset($_POST[
'date_startmin']);
1116 unset($_POST[
'date_startsec']);
1117 unset($_POST[
'date_startday']);
1118 unset($_POST[
'date_startmonth']);
1119 unset($_POST[
'date_startyear']);
1120 unset($_POST[
'date_endhour']);
1121 unset($_POST[
'date_endmin']);
1122 unset($_POST[
'date_endsec']);
1123 unset($_POST[
'date_endday']);
1124 unset($_POST[
'date_endmonth']);
1125 unset($_POST[
'date_endyear']);
1132 } elseif ($action ==
'updatetitleline' &&
GETPOSTISSET(
"save") && $usercancreate && !
GETPOST(
'cancel',
'alpha')) {
1135 $langs->load(
'subtotals');
1137 $desc =
GETPOST(
'line_desc',
'alphanohtml') ?? $langs->trans(
"Title");
1140 $subtotal_options = array();
1142 foreach (SupplierProposal::$TITLE_OPTIONS as $option) {
1143 $value =
GETPOST($option,
'alphanohtml');
1145 $subtotal_options[$option] = $value ==
'on' ? 1 : $value;
1150 $result =
$object->updateSubtotalLine($langs,
GETPOSTINT(
'lineid'), $desc, $depth, $subtotal_options);
1161 $outputlangs = $langs;
1162 $newlang =
GETPOST(
'lang_id',
'alpha');
1164 $newlang =
$object->thirdparty->default_lang;
1166 if (!empty($newlang)) {
1168 $outputlangs->setDefaultLang($newlang);
1171 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
1176 } elseif ($action ==
'updatesubtotalline' &&
GETPOSTISSET(
"save") && $usercancreate && !
GETPOST(
'cancel',
'alpha')) {
1179 $langs->load(
'subtotals');
1181 $desc =
GETPOST(
'line_desc',
'alphanohtml');
1184 $subtotal_options = array();
1186 foreach (SupplierProposal::$SUBTOTAL_OPTIONS as $option) {
1187 $value =
GETPOST($option,
'alphanohtml');
1189 $subtotal_options[$option] = $value ==
'on' ? 1 : $value;
1194 $result =
$object->updateSubtotalLine($langs,
GETPOSTINT(
'lineid'), $desc, $depth, $subtotal_options);
1202 $outputlangs = $langs;
1203 $newlang =
GETPOST(
'lang_id',
'alpha');
1205 $newlang =
$object->thirdparty->default_lang;
1207 if (!empty($newlang)) {
1209 $outputlangs->setDefaultLang($newlang);
1212 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
1217 } elseif ($action ==
'updateline' && $usercancreate &&
GETPOST(
'save') == $langs->trans(
"Save")) {
1223 if (preg_match(
'/\*/', $vat_rate)) {
1231 $vat_rate = str_replace(
'*',
'', $vat_rate);
1235 if (
GETPOST(
'price_ht') !=
'') {
1236 $price_base_type =
'HT';
1240 $vatratecleaned = $vat_rate;
1241 if (preg_match(
'/^(.*)\s*\((.*)\)$/', $vat_rate, $reg)) {
1242 $vatratecleaned = trim($reg[1]);
1243 $vatratecode = $reg[2];
1247 $ht = (float) $ttc / (1 + ((
float) $vatratecleaned / 100));
1248 $price_base_type =
'HT';
1258 $extralabelsline = $extrafields->fetch_name_optionals_label(
$object->table_element_line);
1259 $array_options = $extrafields->getOptionalsFromPost(
$object->table_element_line);
1261 if (is_array($extralabelsline)) {
1262 foreach ($extralabelsline as $key => $value) {
1263 unset($_POST[
"options_".$key]);
1268 $special_code =
GETPOST(
'special_code');
1275 if (!empty($productid)) {
1277 if (
getDolGlobalInt(
'SUPPLIER_PROPOSAL_WITH_PREDEFINED_PRICES_ONLY') == 1) {
1278 if ($productid > 0 && $productsupplier->get_buyprice(0, (
float)
price2num(
GETPOST(
'qty')), $productid,
'none',
GETPOSTINT(
'socid')) < 0) {
1279 setEventMessages($langs->trans(
"ErrorQtyTooLowForThisSupplier"),
null,
'warnings');
1284 $res = $product->fetch($productid);
1286 $type = $product->type;
1288 $price_min = $product->price_min;
1290 $price_min = $product->multiprices_min [
$object->thirdparty->price_level];
1296 $label = (
GETPOST(
'product_label') ?
GETPOST(
'product_label') :
'');
1300 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
1308 $ref_supplier =
GETPOST(
'fourn_ref',
'alpha');
1311 $result =
$object->updateline(
1332 (
float) $pu_ht_devise
1340 $outputlangs = $langs;
1343 $newlang = (
GETPOST(
'lang_id',
'aZ09') ?
GETPOST(
'lang_id',
'aZ09') :
$object->thirdparty->default_lang);
1344 $outputlangs->setDefaultLang($newlang);
1347 $object->generateDocument(
$object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
1350 unset($_POST[
'qty']);
1351 unset($_POST[
'type']);
1352 unset($_POST[
'productid']);
1353 unset($_POST[
'remise_percent']);
1354 unset($_POST[
'price_ht']);
1355 unset($_POST[
'multicurrency_price_ht']);
1356 unset($_POST[
'price_ttc']);
1357 unset($_POST[
'tva_tx']);
1358 unset($_POST[
'product_ref']);
1359 unset($_POST[
'product_label']);
1360 unset($_POST[
'product_desc']);
1361 unset($_POST[
'fournprice']);
1362 unset($_POST[
'buying_price']);
1364 unset($_POST[
'date_starthour']);
1365 unset($_POST[
'date_startmin']);
1366 unset($_POST[
'date_startsec']);
1367 unset($_POST[
'date_startday']);
1368 unset($_POST[
'date_startmonth']);
1369 unset($_POST[
'date_startyear']);
1370 unset($_POST[
'date_endhour']);
1371 unset($_POST[
'date_endmin']);
1372 unset($_POST[
'date_endsec']);
1373 unset($_POST[
'date_endday']);
1374 unset($_POST[
'date_endmonth']);
1375 unset($_POST[
'date_endyear']);
1382 } elseif ($action ==
'updateline' && $usercancreate && $cancel) {
1383 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
1385 } elseif ($action ==
'classin' && $usercancreate) {
1388 } elseif ($action ==
'setavailability' && $usercancreate) {
1391 } elseif ($action ==
'setconditions' && $usercancreate) {
1393 $sql =
"SELECT code ";
1394 $sql .=
"FROM " .
$db->prefix() .
"c_payment_term";
1395 $sql .=
" WHERE rowid = " .
GETPOSTINT(
'cond_reglement_id');
1396 $result =
$db->query($sql);
1398 $obj =
$db->fetch_object($result);
1399 if ($obj->code ==
'DEP30PCTDEL') {
1406 } elseif ($action ==
'setmode' && $usercancreate) {
1409 } elseif ($action ==
'setmulticurrencycode' && $usercancreate) {
1411 $result =
$object->setMulticurrencyCode(
GETPOST(
'multicurrency_code',
'alpha'));
1412 } elseif ($action ==
'setmulticurrencyrate' && $usercancreate) {
1415 } elseif ($action ==
'update_extras' && $permissiontoeditextra) {
1418 $attribute_name =
GETPOST(
'attribute',
'aZ09');
1421 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
1427 $result =
$object->updateExtraField($attribute_name,
'PROPOSAL_SUPPLIER_MODIFY');
1435 $action =
'edit_extras';
1445$title =
$object->ref.
" - ".$langs->trans(
'Card');
1446if ($action ==
'create') {
1447 $title = $langs->trans(
"SupplierProposalNew");
1449$help_url =
'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur';
1451llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-supplierproposal page-card');
1465if ($action ==
'create') {
1466 $currency_code =
$conf->currency;
1468 print
load_fiche_titre($langs->trans(
"SupplierProposalNew"),
'',
'supplier_proposal');
1472 $res = $soc->fetch($socid);
1476 if (!empty($origin) && !empty($originid)) {
1477 $element = $subelement =
GETPOST(
'origin');
1479 if (preg_match(
'/^([^_]+)_([^_]+)/i',
GETPOST(
'origin'), $regs)) {
1480 $element = $regs[1];
1481 $subelement = $regs[2];
1485 if ($element ==
'order' || $element ==
'commande') {
1486 $element = $subelement =
'commande';
1488 if ($element ==
'propal') {
1489 $element =
'comm/propal';
1490 $subelement =
'propal';
1495 $classname = ucfirst($subelement);
1496 $objectsrc =
new $classname(
$db);
1497 '@phan-var-force Commande|Propal|CommandeFournisseur|SupplierProposal $objectsrc';
1499 $objectsrc->fetch($originid);
1500 if (empty($objectsrc->lines) && method_exists($objectsrc,
'fetch_lines')) {
1501 $objectsrc->fetch_lines();
1503 $objectsrc->fetch_thirdparty();
1505 $projectid = (int) $objectsrc->fk_project;
1506 $soc = $objectsrc->thirdparty;
1508 $cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0));
1509 $deposit_percent = (!empty($objectsrc->deposit_percent) ? $objectsrc->deposit_percent : (!empty($soc->deposit_percent) ? $soc->deposit_percent : 0));
1510 $mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0));
1513 $objectsrc->fetch_optionals();
1514 $object->array_options = $objectsrc->array_options;
1517 if (!empty($objectsrc->multicurrency_code)) {
1518 $currency_code = $objectsrc->multicurrency_code;
1520 if (
getDolGlobalString(
'MULTICURRENCY_USE_ORIGIN_TX') && !empty($objectsrc->multicurrency_tx)) {
1521 $currency_tx = $objectsrc->multicurrency_tx;
1525 $cond_reglement_id = $soc->cond_reglement_supplier_id;
1526 $deposit_percent = !empty($soc->deposit_percent) ? $soc->deposit_percent : 0;
1527 $mode_reglement_id = $soc->mode_reglement_supplier_id;
1528 if (
isModEnabled(
"multicurrency") && !empty($soc->multicurrency_code)) {
1529 $currency_code = $soc->multicurrency_code;
1532 if (
GETPOSTISSET(
'cond_reglement_id_deposit_percent')) {
1533 $deposit_percent =
GETPOSTFLOAT(
'cond_reglement_id_deposit_percent');
1538 print
'<form name="addprop" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
1539 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1540 print
'<input type="hidden" name="action" value="add">';
1541 if ($origin !=
'project' && $originid) {
1542 print
'<input type="hidden" name="origin" value="'.$origin.
'">';
1543 print
'<input type="hidden" name="originid" value="'.$originid.
'">';
1545 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1550 $parameters = array();
1552 $reshook = $hookmanager->executeHooks(
'tabContentCreateSupplierProposal', $parameters, $object, $action);
1553 if (empty($reshook)) {
1554 print
'<table class="border centpercent">';
1557 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
'Ref').
'</td><td colspan="2">'.$langs->trans(
"Draft").
'</td></tr>';
1561 print
'<td class="fieldrequired">'.$langs->trans(
'Supplier').
'</td>';
1563 print
'<td colspan="2">';
1564 print $soc->getNomUrl(1,
'supplier');
1565 print
'<input type="hidden" name="socid" value="'.$soc->id.
'">';
1568 print
'<td colspan="2">';
1569 $filter =
'((s.fournisseur:=:1) AND (s.status:=:1))';
1570 print
img_picto(
'',
'company',
'class="pictofixedwidth"').$form->select_company((empty($socid) ?
'' : $socid),
'socid', $filter,
'SelectThirdParty', 1, 0, array(), 0,
'minwidth175 maxwidth500 widthcentpercentminusxx');
1574 $(document).ready(function() {
1575 $("#socid").change(function() {
1576 console.log("We have changed the company - Reload page");
1578 $("input[name=action]").val("create");
1579 $("form[name=addprop]").submit();
1584 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>';
1591 print
'<tr><td>'.$langs->trans(
'Discounts').
'</td><td>';
1593 $absolute_discount = $soc->getAvailableDiscounts(
null,
'', 0, 1);
1597 $backtopage = urlencode($_SERVER[
"PHP_SELF"].
'?socid='.$thirdparty->id.
'&action='.$action.
'&origin='.
GETPOST(
'origin').
'&originid='.
GETPOST(
'originid'));
1598 include DOL_DOCUMENT_ROOT.
'/core/tpl/object_discounts.tpl.php';
1604 print
'<tr><td class="nowrap">'.$langs->trans(
'PaymentConditionsShort').
'</td><td colspan="2">';
1605 print
img_picto(
'',
'payment',
'class="pictofixedwidth"');
1606 print $form->getSelectConditionsPaiements(
GETPOSTISSET(
'cond_reglement_id') ?
GETPOSTINT(
'cond_reglement_id') : $cond_reglement_id,
'cond_reglement_id', -1, 1, 0,
'', $deposit_percent);
1610 print
'<tr><td>'.$langs->trans(
'PaymentMode').
'</td><td colspan="2">';
1611 print
img_picto(
'',
'bank',
'class="pictofixedwidth"');
1612 $form->select_types_paiements(
GETPOST(
'mode_reglement_id') > 0 ?
GETPOST(
'mode_reglement_id') : $mode_reglement_id,
'mode_reglement_id');
1617 print
'<tr><td>'.$langs->trans(
'BankAccount').
'</td><td colspan="2">';
1618 print
img_picto(
'',
'bank',
'class="pictofixedwidth"');
1619 $form->select_comptes(
GETPOST(
'fk_account') > 0 ?
GETPOSTINT(
'fk_account') : $fk_account,
'fk_account', 0,
'', 1);
1625 print
'<tr><td>'.$langs->trans(
'SendingMethod').
'</td><td colspan="2">';
1626 print
img_picto(
'',
'dolly',
'class="pictofixedwidth"');
1627 $form->selectShippingMethod(
GETPOST(
'shipping_method_id') > 0 ?
GETPOSTINT(
'shipping_method_id') :
"",
'shipping_method_id',
'', 1);
1632 print
'<tr><td>'.$langs->trans(
"DeliveryDate").
'</td>';
1633 print
'<td colspan="2">';
1634 print
img_picto(
'',
'action',
'class="pictofixedwidth"');
1637 $tmpdte = time() + (7 *
getDolGlobalInt(
'DATE_LIVRAISON_WEEK_DELAY') * 24 * 60 * 60);
1638 $syear =
date(
"Y", $tmpdte);
1639 $smonth =
date(
"m", $tmpdte);
1640 $sday =
date(
"d", $tmpdte);
1641 print $form->selectDate($syear.
"-".$smonth.
"-".$sday,
'liv_', 0, 0, 0,
"addask");
1643 print $form->selectDate($datedelivery ? $datedelivery : -1,
'liv_', 0, 0, 0,
"addask", 1, 1);
1650 if (count($list) > 0) {
1652 print
'<td>'.$langs->trans(
"DefaultModel").
'</td>';
1653 print
'<td colspan="2">';
1654 print
img_picto(
'',
'pdf',
'class="pictofixedwidth"');
1656 print $form->selectarray(
'model', $list, $preselected, 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1662 $langs->load(
"projects");
1666 if ($origin ==
'project') {
1667 $projectid = ($originid ? $originid : 0);
1671 print
'<td>'.$langs->trans(
"Project").
'</td><td colspan="2">';
1672 if (!empty($user->socid)) {
1673 $projSocFilter = $user->socid;
1674 } elseif (
getDolGlobalString(
'PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') || $socid == 0) {
1677 $projSocFilter = -1;
1679 $projSocFilter = $socid;
1681 print
img_picto(
'',
'project',
'class="pictofixedwidth"').$formproject->select_projects($projSocFilter, $projectid,
'projectid', 0, 0, 1, 1, 0, 0, 0,
'', 1, 0,
'maxwidth500');
1682 print
' <a href="'.DOL_URL_ROOT.
'/projet/card.php?socid='.((int) $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>';
1690 print
'<td>'.$form->editfieldkey(
'Currency',
'multicurrency_code',
'', $object, 0).
'</td>';
1691 print
'<td colspan="3" class="maxwidthonsmartphone">';
1692 print
img_picto(
'',
'currency',
'class="pictofixedwidth"');
1693 print $form->selectMultiCurrency($currency_code,
'multicurrency_code');
1698 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td colspan="3">';
1699 print $form->selectCategories(Categorie::TYPE_SUPPLIER_PROPOSAL,
'categories', $object);
1704 $parameters = array(
'colspan' =>
' colspan="3"',
'cols' => 3);
1705 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
1706 print $hookmanager->resPrint;
1707 if (empty($reshook)) {
1708 print
$object->showOptionals($extrafields,
'create', $parameters);
1713 if (!empty($origin) && !empty($originid) && is_object($objectsrc) && $classname !==
null) {
1715 if ($origin ==
'contrat') {
1717 $objectsrc->update_price(1,
'auto', 1);
1720 print
"\n<!-- ".$classname.
" info -->";
1722 print
'<input type="hidden" name="amount" value="'.$objectsrc->total_ht.
'">'.
"\n";
1723 print
'<input type="hidden" name="total" value="'.$objectsrc->total_ttc.
'">'.
"\n";
1724 print
'<input type="hidden" name="tva" value="'.$objectsrc->total_tva.
'">'.
"\n";
1725 print
'<input type="hidden" name="origin" value="'.$objectsrc->element.
'">';
1726 print
'<input type="hidden" name="originid" value="'.$objectsrc->id.
'">';
1728 print
'<tr><td>'.$langs->trans(
'CommRequest').
'</td><td colspan="2">'.$objectsrc->getNomUrl(1).
'</td></tr>';
1729 print
'<tr><td>'.$langs->trans(
'AmountHT').
'</td><td colspan="2">'.
price($objectsrc->total_ht).
'</td></tr>';
1730 print
'<tr><td>'.$langs->trans(
'AmountVAT').
'</td><td colspan="2">'.
price($objectsrc->total_tva).
"</td></tr>";
1731 if (
$mysoc->localtax1_assuj ==
"1" || $objectsrc->total_localtax1 != 0) {
1732 print
'<tr><td>'.$langs->transcountry(
"AmountLT1",
$mysoc->country_code).
'</td><td colspan="2">'.
price($objectsrc->total_localtax1).
"</td></tr>";
1735 if (
$mysoc->localtax2_assuj ==
"1" || $objectsrc->total_localtax2 != 0) {
1736 print
'<tr><td>'.$langs->transcountry(
"AmountLT2",
$mysoc->country_code).
'</td><td colspan="2">'.
price($objectsrc->total_localtax2).
"</td></tr>";
1738 print
'<tr><td>'.$langs->trans(
'AmountTTC').
'</td><td colspan="2">'.
price($objectsrc->total_ttc).
"</td></tr>";
1741 print
'<tr><td>'.$langs->trans(
'MulticurrencyAmountHT').
'</td><td colspan="2">'.
price($objectsrc->multicurrency_total_ht).
'</td></tr>';
1742 print
'<tr><td>'.$langs->trans(
'MulticurrencyAmountVAT').
'</td><td colspan="2">'.
price($objectsrc->multicurrency_total_tva).
"</td></tr>";
1743 print
'<tr><td>'.$langs->trans(
'MulticurrencyAmountTTC').
'</td><td colspan="2">'.
price($objectsrc->multicurrency_total_ttc).
"</td></tr>";
1755 print
'<input type="hidden" name="createmode" value="empty">';
1759 print
'<br><table>';
1763 print
'<td><input type="radio" name="createmode" value="copy"></td>';
1764 print
'<td>'.$langs->trans(
"CopyAskFrom").
' </td>';
1766 $liste_ask = array();
1767 $liste_ask [0] =
'';
1769 $sql =
"SELECT p.rowid as id, p.ref, s.nom";
1770 $sql .=
" FROM ".MAIN_DB_PREFIX.
"supplier_proposal p";
1771 $sql .=
", ".MAIN_DB_PREFIX.
"societe s";
1772 $sql .=
" WHERE s.rowid = p.fk_soc";
1773 $sql .=
" AND p.entityy IN (".getEntity(
'supplier_proposal').
")";
1774 $sql .=
" AND p.fk_statut <> ".SupplierProposal::STATUS_DRAFT;
1775 $sql .=
" ORDER BY Id";
1777 $resql =
$db->query($sql);
1779 $num =
$db->num_rows($resql);
1782 $row =
$db->fetch_row($resql);
1783 $askPriceSupplierRefAndSocName = $row[1].
" - ".$row[2];
1784 $liste_ask[$row[0]] = $askPriceSupplierRefAndSocName;
1787 print $form->selectarray(
"copie_supplier_proposal", $liste_ask, 0);
1793 print
'<tr><td class="tdtop"><input type="radio" name="createmode" value="empty" checked></td>';
1794 print
'<td valign="top" colspan="2">'.$langs->trans(
"CreateEmptyAsk").
'</td></tr>';
1804 print $form->buttonsSaveCancel(
"CreateDraft");
1810 if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
1813 $title = $langs->trans(
'ProductsAndServices');
1816 print
'<div class="div-table-responsive-no-min">';
1817 print
'<table class="noborder centpercent">';
1819 $objectsrc->printOriginLinesList();
1833 print
dol_get_fiche_head($head,
'comm', $langs->trans(
'CommRequest'), -1,
'supplier_proposal', 0,
'',
'', 0,
'', 1);
1838 if ($action ==
'clone') {
1839 $filter =
'(s.fournisseur:=:1)';
1841 $formquestion = array(
1849 'label' => $langs->trans(
"SelectThirdParty"),
1850 'value' => $form->select_company(
GETPOSTINT(
'socid'),
'socid', $filter))
1853 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneAsk',
$object->ref),
'confirm_clone', $formquestion,
'yes', 1);
1854 } elseif ($action ==
'delete') {
1856 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteAsk'), $langs->trans(
'ConfirmDeleteAsk',
$object->ref),
'confirm_delete',
'', 0, 1);
1857 } elseif ($action ==
'reopen') {
1859 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ReOpen'), $langs->trans(
'ConfirmReOpenAsk',
$object->ref),
'confirm_reopen',
'', 0, 1);
1860 } elseif ($action ==
'ask_deleteline') {
1862 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$lineid, $langs->trans(
'DeleteProductLine'), $langs->trans(
'ConfirmDeleteProductLine'),
'confirm_deleteline',
'', 0, 1);
1863 } elseif ($action ==
'ask_subtotal_deleteline') {
1865 $langs->load(
"subtotals");
1866 $title =
"DeleteSubtotalLine";
1867 $question =
"ConfirmDeleteSubtotalLine";
1868 if (
GETPOST(
'type') ==
'title') {
1871 'type' =>
'checkbox',
1872 'name' =>
'deletecorrespondingsubtotalline',
1873 'label' => $langs->trans(
"DeleteCorrespondingSubtotalLine"),
1877 $title =
"DeleteTitleLine";
1878 $question =
"ConfirmDeleteTitleLine";
1880 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$lineid, $langs->trans($title), $langs->trans($question),
'confirm_delete_subtotalline', $formconfirm,
'no', 1);
1881 } elseif ($action ==
'validate') {
1886 $ref = substr(
$object->ref, 1, 4);
1887 if ($ref ==
'PROV') {
1888 $numref =
$object->getNextNumRef($soc);
1889 if (empty($numref)) {
1897 $text = $langs->trans(
'ConfirmValidateAsk', $numref);
1899 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
1902 $text .= $notify->confirmMessage(
'PROPOSAL_SUPPLIER_VALIDATE',
$object->socid, $object);
1906 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ValidateAsk'), $text,
'confirm_validate',
'', 0, 1);
1910 if ($action ==
'add_title_line') {
1911 $langs->load(
'subtotals');
1913 $depth_array =
$object->getPossibleLevels($langs);
1915 } elseif ($action ==
'add_subtotal_line') {
1916 $langs->load(
'subtotals');
1918 $titles =
$object->getPossibleTitles();
1923 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
1924 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
1925 if (empty($reshook)) {
1926 $formconfirm .= $hookmanager->resPrint;
1927 } elseif ($reshook > 0) {
1928 $formconfirm = $hookmanager->resPrint;
1936 $linkback =
'<a href="'.DOL_URL_ROOT.
'/supplier_proposal/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
1939 $morehtmlref =
'<div class="refidno">';
1944 $morehtmlref .=
$object->thirdparty->getNomUrl(1,
'supplier');
1946 $morehtmlref .=
' (<a href="'.DOL_URL_ROOT.
'/supplier_proposal/list.php?socid='.
$object->thirdparty->id.
'">'.$langs->trans(
"OtherProposals").
'</a>)';
1950 $langs->load(
"projects");
1951 $morehtmlref .=
'<br>';
1952 if ($usercancreate) {
1953 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
1954 if ($action !=
'classify') {
1955 $morehtmlref .=
'<a class="editfielda" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'action' =>
'classify',
'id' =>
$object->id],
true).
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
1958 $canLinkAll = ($canLinkAll ===
'' || $canLinkAll ===
false) ? 0 : $canLinkAll;
1960 $projectSocId = ((int) $canLinkAll == 1) ? -1 : $currentSocId;
1961 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $projectSocId,
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
1963 if (!empty(
$object->fk_project)) {
1965 $proj->fetch(
$object->fk_project);
1966 $morehtmlref .= $proj->getNomUrl(1);
1968 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
1973 $morehtmlref .=
'</div>';
1976 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
1979 $parameters = array();
1981 $reshook = $hookmanager->executeHooks(
'tabContentViewSupplierProposal', $parameters, $object, $action);
1982 if (empty($reshook)) {
1983 print
'<div class="fichecenter">';
1984 print
'<div class="fichehalfleft">';
1985 print
'<div class="underbanner clearboth"></div>';
1987 print
'<table class="border tableforfield centpercent">';
1991 $filterabsolutediscount =
"fk_invoice_supplier_source IS NULL";
1992 $filtercreditnote =
"fk_invoice_supplier_source IS NOT NULL";
1994 $filterabsolutediscount =
"fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')";
1995 $filtercreditnote =
"fk_invoice_supplier_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS PAID)%')";
1998 print
'<tr><td class="titlefield">'.$langs->trans(
'Discounts').
'</td><td>';
2000 $absolute_discount = $soc->getAvailableDiscounts(
null, $filterabsolutediscount, 0, 1);
2001 $absolute_creditnote = $soc->getAvailableDiscounts(
null, $filtercreditnote, 0, 1);
2002 $absolute_discount =
price2num($absolute_discount,
'MT');
2003 $absolute_creditnote =
price2num($absolute_creditnote,
'MT');
2007 $backtopage = urlencode($_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
2008 include DOL_DOCUMENT_ROOT.
'/core/tpl/object_discounts.tpl.php';
2013 print
'<tr><td class="titlefield">';
2014 print
'<table class="nobordernopadding" width="100%"><tr><td>';
2015 print $langs->trans(
'PaymentConditionsShort');
2018 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editconditions&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetConditions'), 1).
'</a></td>';
2020 print
'</tr></table>';
2021 print
'</td><td class="valuefield">';
2022 if ($action ==
'editconditions') {
2023 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
string)
$object->cond_reglement_id,
'cond_reglement_id', 1,
'', 1,
$object->deposit_percent);
2025 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
string)
$object->cond_reglement_id,
'none', 1,
'', 1,
$object->deposit_percent);
2032 print
'<table class="nobordernopadding" width="100%"><tr><td>';
2033 print $langs->trans(
'DeliveryDate');
2036 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editdate_livraison&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetDeliveryDate'), 1).
'</a></td>';
2038 print
'</tr></table>';
2039 print
'</td><td class="valuefield">';
2040 if ($action ==
'editdate_livraison') {
2041 print
'<form name="editdate_livraison" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post" class="formconsumeproduce">';
2042 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2043 print
'<input type="hidden" name="action" value="setdate_livraison">';
2044 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
2045 print $form->selectDate(
$object->delivery_date,
'liv_', 0, 0, 0,
"editdate_livraison");
2046 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
2057 print
'<table class="nobordernopadding" width="100%"><tr><td>';
2058 print $langs->trans(
'PaymentMode');
2061 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editmode&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetMode'), 1).
'</a></td>';
2063 print
'</tr></table>';
2064 print
'</td><td class="valuefield">';
2065 if ($action ==
'editmode') {
2066 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
string)
$object->mode_reglement_id,
'mode_reglement_id',
'DBIT', 1, 1);
2068 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
string)
$object->mode_reglement_id,
'none');
2088 print
'<table width="100%" class="nobordernopadding"><tr><td>';
2089 print $langs->trans(
'BankAccount');
2091 if ($action !=
'editbankaccount' && $usercancreate) {
2092 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>';
2094 print
'</tr></table>';
2095 print
'</td><td class="valuefield">';
2096 if ($action ==
'editbankaccount') {
2097 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
string)
$object->fk_account,
'fk_account', 1);
2099 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
string)
$object->fk_account,
'none');
2107 print
'<table class="nobordernopadding centpercent"><tr><td>';
2108 print $langs->trans(
"Categories");
2109 print
'<td><td class="right">';
2110 if ($usercancreate) {
2111 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/supplier_proposal/card.php?id='.
$object->id.
'&action=edittags&token='.
newToken().
'">'.
img_edit().
'</a>';
2115 print
'</td></tr></table>';
2118 if ($action ==
'edittags') {
2119 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'">';
2120 print
'<input type="hidden" name="action" value="settags">';
2121 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2122 print $form->selectCategories(Categorie::TYPE_SUPPLIER_PROPOSAL,
'categories', $object);
2123 print
'<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans(
"Modify").
'">';
2126 print $form->showCategories(
$object->id, Categorie::TYPE_SUPPLIER_PROPOSAL, 1);
2131 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
2136 print
'<div class="fichehalfright">';
2137 print
'<div class="underbanner clearboth"></div>';
2139 print
'<table class="border tableforfield centpercent">';
2141 include DOL_DOCUMENT_ROOT.
'/core/tpl/object_currency_amount.tpl.php';
2145 print
'<td class="titlefieldmiddle">' . $langs->trans(
'AmountHT') .
'</td>';
2146 print
'<td class="nowrap amountcard right">' .
price(
$object->total_ht, 0, $langs, 0, -1, -1,
$conf->currency) .
'</td>';
2149 print
'<td class="nowrap amountcard right">' .
price(
$object->multicurrency_total_ht, 0, $langs, 0, -1, -1,
$object->multicurrency_code) .
'</td>';
2155 print
'<td class="titlefieldmiddle">' . $langs->trans(
'AmountVAT') .
'</td>';
2156 print
'<td class="nowrap amountcard right">' .
price(
$object->total_tva, 0, $langs, 0, -1, -1,
$conf->currency) .
'</td>';
2159 print
'<td class="nowrap amountcard right">' .
price(
$object->multicurrency_total_tva, 0, $langs, 0, -1, -1,
$object->multicurrency_code) .
'</td>';
2164 if (
$mysoc->localtax1_assuj ==
"1" ||
$object->total_localtax1 != 0) {
2166 print
'<td class="titlefieldmiddle">' . $langs->transcountry(
"AmountLT1",
$mysoc->country_code) .
'</td>';
2167 print
'<td class="nowrap amountcard right">' .
price(
$object->total_localtax1, 0, $langs, 0, -1, -1,
$conf->currency) .
'</td>';
2169 print
'<td class="nowrap amountcard right">' .
price(
$object->total_localtax1, 0, $langs, 0, -1, -1,
$object->multicurrency_code) .
'</td>';
2173 if (
$mysoc->localtax2_assuj ==
"1" ||
$object->total_localtax2 != 0) {
2175 print
'<td>' . $langs->transcountry(
"AmountLT2",
$mysoc->country_code) .
'</td>';
2176 print
'<td class="nowrap amountcard right">' .
price(
$object->total_localtax2, 0, $langs, 0, -1, -1,
$conf->currency) .
'</td>';
2178 print
'<td class="nowrap amountcard right">' .
price(
$object->total_localtax2, 0, $langs, 0, -1, -1,
$object->multicurrency_code) .
'</td>';
2186 print
'<td>' . $langs->trans(
'AmountTTC') .
'</td>';
2187 print
'<td class="nowrap amountcard right">' .
price(
$object->total_ttc, 0, $langs, 0, -1, -1,
$conf->currency) .
'</td>';
2190 print
'<td class="nowrap amountcard right">' .
price(
$object->multicurrency_total_ttc, 0, $langs, 0, -1, -1,
$object->multicurrency_code) .
'</td>';
2204 print
'<div class="clearboth"></div><br>';
2207 $blocname =
'contacts';
2208 $title = $langs->trans(
'ContactsAddresses');
2209 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
2213 $blocname =
'notes';
2214 $title = $langs->trans(
'Notes');
2215 include DOL_DOCUMENT_ROOT.
'/core/tpl/bloc_showhide.tpl.php';
2223 $result =
$object->getLinesArray();
2225 print
' <form name="addproduct" id="addproduct" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.(($action !=
'editline') ?
'#add' :
'').
'" method="POST">
2226 <input type="hidden" name="token" value="' .
newToken().
'">
2227 <input type="hidden" name="action" value="' . (($action !=
'editline') ?
'addline' :
'updateline').
'">
2228 <input type="hidden" name="mode" value="">
2229 <input type="hidden" name="id" value="' .
$object->id.
'">
2235 include DOL_DOCUMENT_ROOT .
'/core/tpl/subtotal_ajaxrow.tpl.php';
2237 include DOL_DOCUMENT_ROOT .
'/core/tpl/ajaxrow.tpl.php';
2241 print
'<div class="div-table-responsive-no-min">';
2242 print
'<table id="tablelines" class="noborder noshadow centpercent">';
2245 global $forceall, $senderissupplier, $inputalsopricewithtax;
2248 $inputalsopricewithtax = 1;
2249 $senderissupplier = 2;
2250 if (
getDolGlobalInt(
'SUPPLIER_PROPOSAL_WITH_PREDEFINED_PRICES_ONLY')) {
2251 $senderissupplier =
getDolGlobalInt(
'SUPPLIER_PROPOSAL_WITH_PREDEFINED_PRICES_ONLY');
2255 $object->printObjectLines($action, $soc,
$mysoc, $lineid, $dateSelector);
2260 if ($action !=
'editline') {
2263 $parameters = array(
'dateSelector' => $dateSelector);
2264 $reshook = $hookmanager->executeHooks(
'formAddObjectLine', $parameters, $object, $action);
2268 if (empty($reshook)) {
2281 if ($action ==
'statut') {
2283 $form_close =
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="POST" id="formacceptrefuse" class="formconsumeproduce paddingbottom paddingleft paddingright">';
2284 $form_close .=
'<input type="hidden" name="token" value="'.newToken().
'">';
2285 $form_close .=
'<input type="hidden" name="action" value="setstatut">';
2288 $form_close .=
'<p class="notice">'.$langs->trans(
'SupplierProposalRefFournNotice').
'</p>';
2290 $form_close .=
'<table class="border centpercent marginleftonly marginrightonly">';
2291 $form_close .=
'<tr><td>'.$langs->trans(
"CloseAs").
'</td><td class="left">';
2292 $form_close .=
'<select id="statut" name="statut" class="flat">';
2293 $form_close .=
'<option value="0"> </option>';
2294 $form_close .=
'<option value="2">'.$langs->trans(
'SupplierProposalStatusSigned').
'</option>';
2295 $form_close .=
'<option value="3">'.$langs->trans(
'SupplierProposalStatusNotSigned').
'</option>';
2296 $form_close .=
'</select>';
2297 $form_close .=
'</td></tr>';
2298 $form_close .=
'<tr><td class="left">'.$langs->trans(
'Note').
'</td><td class="left"><textarea cols="70" rows="'.ROWS_3.
'" wrap="soft" name="note">';
2299 $form_close .=
$object->note_private;
2300 $form_close .=
'</textarea></td></tr>';
2301 $form_close .=
'</table>';
2302 $form_close .= $form->buttonsSaveCancel();
2303 $form_close .=
'<a id="acceptedrefused"> </a>';
2304 $form_close .=
'</form>';
2312 if ($action !=
'presend') {
2313 print
'<div class="tabsAction">';
2315 $parameters = array();
2316 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
2318 if (empty($reshook)) {
2319 if ($action !=
'statut' && $action !=
'editline') {
2322 $langs->load(
'subtotals');
2324 $url_button = array();
2326 $url_button[] = array(
2327 'lang' =>
'subtotals',
2329 'perm' => (
bool) $usercancreate,
2330 'label' => $langs->trans(
'AddTitleLine'),
2331 'url' =>
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'add_title_line'],
true)
2334 $url_button[] = array(
2335 'lang' =>
'subtotals',
2337 'perm' => (
bool) $usercancreate,
2338 'label' => $langs->trans(
'AddSubtotalLine'),
2339 'url' =>
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'add_subtotal_line'],
true)
2342 print
dolGetButtonAction(
'', $langs->trans(
'Subtotal'),
'default', $url_button,
'',
true);
2346 if (count(
$object->lines) > 0) {
2347 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=validate&token='.
newToken().
'">'.$langs->trans(
'Validate').
'</a></div>';
2354 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=modif&token='.
newToken().
'">'.$langs->trans(
'Modify').
'</a></div>';
2359 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=reopen&token='.
newToken().(!
getDolGlobalString(
'MAIN_JUMP_TAG') ?
'' :
'#reopen').
'"';
2360 print
'>'.$langs->trans(
'ReOpen').
'</a></div>';
2364 if (empty($user->socid)) {
2367 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'email',
dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id,
'action' =>
'presend',
'mode' =>
'init'],
true).
'#formmailbeforetitle',
'');
2376 if ($usercancreateorder) {
2377 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.
'&token='.
newToken().
'">'.$langs->trans(
"AddSupplierOrderShort").
'</a></div>';
2383 print
'<div class="inline-block divButAction"><a class="butAction reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&token='.
newToken().
'&action=statut'.(!
getDolGlobalString(
'MAIN_JUMP_TAG') ?
'' :
'#acceptedrefused').
'"';
2384 print
'>'.$langs->trans(
'SetAcceptedRefused').
'</a></div>';
2389 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&token='.
newToken().
'&action=close'.(!
getDolGlobalString(
'MAIN_JUMP_TAG') ?
'' :
'#close').
'"';
2390 print
'>'.$langs->trans(
'Close').
'</a></div>';
2394 if ($usercancreate) {
2395 print
'<div class="inline-block divButAction"><a class="butAction butActionClone" href="'.$_SERVER[
'PHP_SELF'].
'?id='.((int)
$object->id).
'&socid='.((int)
$object->socid).
'&action=clone&object='.urlencode(
$object->element).
'&token='.
newToken().
'">'.$langs->trans(
"ToClone").
'</a></div>';
2406 if ($action !=
'presend') {
2407 print
'<div class="fichecenter"><div class="fichehalfleft">';
2414 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
2415 $genallowed = $usercanread;
2416 $delallowed = $usercancreate;
2418 print $formfile->showdocuments(
'supplier_proposal', $filename, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $soc->default_lang);
2422 $tmparray = $form->showLinkToObjectBlock($object, array(), array(
'supplier_proposal'), 1);
2423 $linktoelem = $tmparray[
'linktoelem'];
2424 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
2425 print $htmltoenteralink;
2427 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
2431 print
'</div><div class="fichehalfright">';
2434 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2436 $somethingshown = $formactions->showactions($object,
'supplier_proposal', $socid, 1,
'', $MAXEVENT);
2438 print
'</div></div>';
2442 if (
GETPOST(
'modelselected')) {
2443 $action =
'presend';
2447 $modelmail =
'supplier_proposal_send';
2448 $defaulttopic =
'SendAskRef';
2449 $diroutput =
$conf->supplier_proposal->dir_output;
2450 $autocopy =
'MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO';
2451 $trackid =
'spro'.$object->id;
2453 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
Class to manage the table of subscription to notifications.
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 price ask supplier.
const STATUS_NOTSIGNED
Not signed quote, canceled.
const STATUS_DRAFT
Draft status.
const STATUS_VALIDATED
Validated status.
const STATUS_SIGNED
Signed quote.
const STATUS_CLOSE
Billed or closed/processed quote.
Class to manage translations.
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.
$date_start
Variables from include:
dol_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
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.
GETPOSTISARRAY($paramname, $method=0)
Return true if the parameter $paramname is submit from a POST OR GET as an array.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
dol_htmlcleanlastbr($stringtodecode)
This function remove all ending and br at end.
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...
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify 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...
get_localtax($vatrate, $local, $thirdparty_buyer=null, $thirdparty_seller=null, $vatnpr=0)
Return localtax rate for a particular VAT rate, when selling a product with vat $vatrate,...
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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...
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
print $langs trans('Date')." left Ref Label right Qty right Price right TotalHT right TotalTTC right right right right right right right right right centpercent right TotalHT right n right VAT right n right TotalVAT right n No sujeto a RE IRPF right TotalLT1 right n right TotalLT2 right n right TotalTTC right n takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency right TotalTTC takeposcustomercurrency right takeposcustomercurrency n right Paid right PaymentTypeShortLIQ right SELECT p pos_change as p datep as date
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.
supplier_proposal_prepare_head($object)
Prepare array with list of tabs.