40require
'../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formpropal.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
48if (isModEnabled(
'project')) {
49 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
61$langs->loadLangs(array(
'companies',
'propal',
'supplier_proposal',
'compta',
'bills',
'orders',
'products'));
65$action =
GETPOST(
'action',
'aZ09');
66$massaction =
GETPOST(
'massaction',
'alpha');
68$confirm =
GETPOST(
'confirm',
'alpha');
69$toselect =
GETPOST(
'toselect',
'array');
70$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'supplierproposallist';
71$optioncss =
GETPOST(
'optioncss',
'alpha');
72$mode =
GETPOST(
'mode',
'alpha');
74$search_user =
GETPOST(
'search_user',
'intcomma');
75$search_sale =
GETPOST(
'search_sale',
'intcomma');
77$search_societe =
GETPOST(
'search_societe',
'alpha');
78$search_societe_alias =
GETPOST(
'search_societe_alias',
'alpha');
79$search_login =
GETPOST(
'search_login',
'alpha');
80$search_town =
GETPOST(
'search_town',
'alpha');
81$search_zip =
GETPOST(
'search_zip',
'alpha');
82$search_state =
GETPOST(
"search_state");
83$search_country =
GETPOST(
"search_country",
'aZ09');
84$search_date_startday =
GETPOSTINT(
'search_date_startday');
85$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
86$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
87$search_date_endday =
GETPOSTINT(
'search_date_endday');
88$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
89$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
90$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
91$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
92$search_date_valid_startday =
GETPOSTINT(
'search_date_valid_startday');
93$search_date_valid_startmonth =
GETPOSTINT(
'search_date_valid_startmonth');
94$search_date_valid_startyear =
GETPOSTINT(
'search_date_valid_startyear');
95$search_date_valid_endday =
GETPOSTINT(
'search_date_valid_endday');
96$search_date_valid_endmonth =
GETPOSTINT(
'search_date_valid_endmonth');
97$search_date_valid_endyear =
GETPOSTINT(
'search_date_valid_endyear');
98$search_date_valid_start =
dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear);
99$search_date_valid_end =
dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear);
100$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
101$search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
102$search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
103$search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
104$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
105$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
106$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
107$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
108$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
109$search_status =
GETPOST(
'search_status',
'intcomma');
110$search_product_category =
GETPOST(
'search_product_category',
'int');
111$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
113$object_statut =
GETPOST(
'supplier_proposal_statut',
'intcomma');
114$search_btn =
GETPOST(
'button_search',
'alpha');
115$search_remove_btn =
GETPOST(
'button_removefilter',
'alpha');
118$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
119$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
121if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
125$offset = $limit * $page;
126$pageprev = $page - 1;
127$pagenext = $page + 1;
129 $sortfield =
'sp.date_livraison';
135if ($object_statut !=
'') {
136 $search_status = $object_statut;
143$module =
'supplier_proposal';
146if (!empty($user->socid)) {
147 $socid = $user->socid;
152 $dbtable =
'&societe';
155$diroutputmassaction =
$conf->supplier_proposal->dir_output.
'/temp/massgeneration/'.$user->id;
159$hookmanager->initHooks(array(
'supplier_proposallist'));
163$extrafields->fetch_name_optionals_label(
$object->table_element);
165$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
169$fieldstosearchall = array(
171 's.nom' =>
'Supplier',
172 'pd.description' =>
'Description',
173 'sp.note_public' =>
'NotePublic',
175if (empty($user->socid)) {
176 $fieldstosearchall[
"p.note_private"] =
"NotePrivate";
179$checkedtypetiers = 0;
181 'sp.ref' => array(
'label' => $langs->trans(
"Ref"),
'checked' => 1),
182 's.nom' => array(
'label' => $langs->trans(
"Supplier"),
'checked' => 1),
183 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' => 0),
184 's.town' => array(
'label' => $langs->trans(
"Town"),
'checked' => 1),
185 's.zip' => array(
'label' => $langs->trans(
"Zip"),
'checked' => 1),
186 'state.nom' => array(
'label' => $langs->trans(
"StateShort"),
'checked' => 0),
187 'country.code_iso' => array(
'label' => $langs->trans(
"Country"),
'checked' => 0),
188 'typent.code' => array(
'label' => $langs->trans(
"ThirdPartyType"),
'checked' => $checkedtypetiers),
189 'sp.date_valid' => array(
'label' => $langs->trans(
"DateValidation"),
'checked' => 1),
190 'sp.date_livraison' => array(
'label' => $langs->trans(
"DateEnd"),
'checked' => 1),
191 'sp.total_ht' => array(
'label' => $langs->trans(
"AmountHT"),
'checked' => 1),
192 'sp.total_tva' => array(
'label' => $langs->trans(
"AmountVAT"),
'checked' => 0),
193 'sp.total_ttc' => array(
'label' => $langs->trans(
"AmountTTC"),
'checked' => 0),
194 'sp.multicurrency_code' => array(
'label' =>
'Currency',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
195 'sp.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
196 'sp.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
197 'sp.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
198 'sp.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
199 'u.login' => array(
'label' => $langs->trans(
"Author"),
'checked' => 1,
'position' => 10),
200 'sp.datec' => array(
'label' => $langs->trans(
"DateCreation"),
'checked' => 0,
'position' => 500),
201 'sp.tms' => array(
'label' => $langs->trans(
"DateModificationShort"),
'checked' => 0,
'position' => 500),
202 'sp.fk_statut' => array(
'label' => $langs->trans(
"Status"),
'checked' => 1,
'position' => 1000),
205include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
209'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
211if (!$user->hasRight(
'societe',
'client',
'voir')) {
212 $search_sale = $user->id;
217$permissiontoread = $user->hasRight(
'supplier_proposal',
'lire');
218$permissiontodelete = $user->hasRight(
'supplier_proposal',
'supprimer');
225if (
GETPOST(
'cancel',
'alpha')) {
229if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
233$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
234$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
239if (empty($reshook)) {
241 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
244 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
249 $search_societe =
'';
250 $search_societe_alias =
'';
251 $search_montant_ht =
'';
252 $search_montant_vat =
'';
253 $search_montant_ttc =
'';
254 $search_multicurrency_code =
'';
255 $search_multicurrency_tx =
'';
256 $search_multicurrency_montant_ht =
'';
257 $search_multicurrency_montant_vat =
'';
258 $search_multicurrency_montant_ttc =
'';
260 $search_product_category =
'';
265 $search_country =
'';
266 $search_type_thirdparty =
'';
267 $search_date_startday =
'';
268 $search_date_startmonth =
'';
269 $search_date_startyear =
'';
270 $search_date_endday =
'';
271 $search_date_endmonth =
'';
272 $search_date_endyear =
'';
273 $search_date_start =
'';
274 $search_date_end =
'';
275 $search_date_valid_startday =
'';
276 $search_date_valid_startmonth =
'';
277 $search_date_valid_startyear =
'';
278 $search_date_valid_endday =
'';
279 $search_date_valid_endmonth =
'';
280 $search_date_valid_endyear =
'';
281 $search_date_valid_start =
'';
282 $search_date_valid_end =
'';
287 $objectclass =
'SupplierProposal';
288 $objectlabel =
'SupplierProposals';
289 $uploaddir =
$conf->supplier_proposal->dir_output;
290 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
298$form =
new Form($db);
302$companystatic =
new Societe($db);
307$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
308$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
310$title = $langs->trans(
'ListOfSupplierProposals');
311$help_url =
'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur';
317if ($search_all || $search_user > 0) {
318 $sql =
'SELECT DISTINCT';
320$sql .=
' s.rowid as socid, s.nom as name, s.name_alias as alias, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
321$sql .=
" typent.code as typent_code,";
322$sql .=
" state.code_departement as state_code, state.nom as state_name,";
323$sql .=
' sp.rowid, sp.note_public, sp.note_private, sp.total_ht, sp.total_tva, sp.total_ttc, sp.localtax1, sp.localtax2, sp.ref, sp.fk_statut as status, sp.fk_user_author, sp.date_valid, sp.date_livraison as dp,';
324$sql .=
' sp.fk_multicurrency, sp.multicurrency_code, sp.multicurrency_tx, sp.multicurrency_total_ht, sp.multicurrency_total_tva as multicurrency_total_vat, sp.multicurrency_total_ttc,';
325$sql .=
' sp.datec as date_creation, sp.tms as date_modification,';
326$sql .=
" p.rowid as project_id, p.ref as project_ref,";
327$sql .=
" u.firstname, u.lastname, u.photo, u.login, u.statut as ustatus, u.admin, u.employee, u.email as uemail";
329if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
330 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
331 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
335$parameters = array();
336$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
337$sql .= $hookmanager->resPrint;
338$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
339$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
340$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
341$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
342$sql .=
', '.MAIN_DB_PREFIX.
'supplier_proposal as sp';
343if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
344 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (sp.rowid = ef.fk_object)";
347 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'supplier_proposaldet as pd ON sp.rowid=pd.fk_supplier_proposal';
349$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON sp.fk_user_author = u.rowid';
350$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = sp.fk_projet";
351if ($search_user > 0) {
352 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as c";
353 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
355$sql .=
' WHERE sp.fk_soc = s.rowid';
356$sql .=
' AND sp.entity IN ('.getEntity(
'supplier_proposal').
')';
366if ($search_country) {
367 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
369if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
370 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
375if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
376 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
378 if ($search_societe) {
381 if ($search_societe_alias) {
386 $sql .=
natural_search(array(
'u.lastname',
'u.firstname',
'u.login'), $search_login);
388if ($search_montant_ht) {
391if ($search_montant_vat !=
'') {
394if ($search_montant_ttc !=
'') {
397if ($search_multicurrency_code !=
'') {
398 $sql .=
" AND sp.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
400if ($search_multicurrency_tx !=
'') {
401 $sql .=
natural_search(
'sp.multicurrency_tx', $search_multicurrency_tx, 1);
403if ($search_multicurrency_montant_ht !=
'') {
404 $sql .=
natural_search(
'sp.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
406if ($search_multicurrency_montant_vat !=
'') {
407 $sql .=
natural_search(
'sp.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
409if ($search_multicurrency_montant_ttc !=
'') {
410 $sql .=
natural_search(
'sp.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
413 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
416 $sql .=
' AND s.rowid = '.((int) $socid);
418if ($search_status >= 0 && $search_status !=
'') {
419 $sql .=
' AND sp.fk_statut IN ('.$db->sanitize($db->escape($search_status)).
')';
421if ($search_date_start) {
422 $sql .=
" AND sp.date_livraison >= '".$db->idate($search_date_start).
"'";
424if ($search_date_end) {
425 $sql .=
" AND sp.date_livraison <= '".$db->idate($search_date_end).
"'";
427if ($search_date_valid_start) {
428 $sql .=
" AND sp.date_valid >= '".$db->idate($search_date_valid_start).
"'";
430if ($search_date_valid_end) {
431 $sql .=
" AND sp.date_valid <= '".$db->idate($search_date_valid_end).
"'";
437if ($search_user > 0) {
438 $sql .=
" AND c.fk_c_type_contact = tc.rowid AND tc.element='supplier_proposal' AND tc.source='internal' AND c.element_id = sp.rowid AND c.fk_socpeople = ".((int) $search_user);
441if ($search_sale && $search_sale !=
'-1') {
442 if ($search_sale == -2) {
443 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = sp.fk_soc)";
444 } elseif ($search_sale > 0) {
445 $sql .=
" AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = sp.fk_soc AND sc.fk_user = ".((int) $search_sale).
")";
449$searchCategoryProductOperator = -1;
450$searchCategoryProductList = array($search_product_category);
451if (!empty($searchCategoryProductList)) {
452 $searchCategoryProductSqlList = array();
453 $listofcategoryid =
'';
454 foreach ($searchCategoryProductList as $searchCategoryProduct) {
455 if (intval($searchCategoryProduct) == -2) {
456 $searchCategoryProductSqlList[] =
"NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"supplier_proposaldet as sd WHERE sd.fk_supplier_proposal = sp.rowid AND sd.fk_product = ck.fk_product)";
457 } elseif (intval($searchCategoryProduct) > 0) {
458 if ($searchCategoryProductOperator == 0) {
459 $searchCategoryProductSqlList[] =
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"supplier_proposaldet as sd WHERE sd.fk_supplier_proposal = sp.rowid AND sd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).
")";
461 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
465 if ($listofcategoryid) {
466 $searchCategoryProductSqlList[] =
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"supplier_proposaldet as sd WHERE sd.fk_supplier_proposal = sp.rowid AND sd.fk_product = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
468 if ($searchCategoryProductOperator == 1) {
469 if (!empty($searchCategoryProductSqlList)) {
470 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
473 if (!empty($searchCategoryProductSqlList)) {
474 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
479include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
481$parameters = array();
482$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
483$sql .= $hookmanager->resPrint;
485$sql .= $db->order($sortfield, $sortorder);
486$sql .=
', sp.ref DESC';
489$nbtotalofrecords =
'';
491 $resql = $db->query($sql);
492 $nbtotalofrecords = $db->num_rows($resql);
493 if (($page * $limit) > $nbtotalofrecords) {
499$sql .= $db->plimit($limit + 1, $offset);
501$resql = $db->query($sql);
504 $userstatic =
new User($db);
509 $title = $langs->trans(
'SupplierProposals').
' - '.$soc->name;
511 $title = $langs->trans(
'SupplierProposals');
514 $num = $db->num_rows($resql);
516 $arrayofselected = is_array($toselect) ? $toselect : array();
518 if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
519 $obj = $db->fetch_object($resql);
523 header(
"Location: ".DOL_URL_ROOT.
'/supplier_proposal/card.php?id='.
$id);
530 llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-supplierproposal page-list');
534 $param .=
'&mode='.urlencode($mode);
536 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
537 $param .=
'&contextpage='.urlencode($contextpage);
539 if ($limit > 0 && $limit !=
$conf->liste_limit) {
540 $param .=
'&limit='.((int) $limit);
543 $param .=
'&search_all='.urlencode($search_all);
545 if ($search_date_startday) {
546 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
548 if ($search_date_startmonth) {
549 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
551 if ($search_date_startyear) {
552 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
554 if ($search_date_endday) {
555 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
557 if ($search_date_endmonth) {
558 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
560 if ($search_date_endyear) {
561 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
563 if ($search_date_valid_startday) {
564 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
566 if ($search_date_valid_startmonth) {
567 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
569 if ($search_date_valid_startyear) {
570 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
572 if ($search_date_valid_endday) {
573 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
575 if ($search_date_valid_endmonth) {
576 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
578 if ($search_date_valid_endyear) {
579 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
582 $param .=
'&search_ref='.urlencode($search_ref);
584 if ($search_societe) {
585 $param .=
'&search_societe='.urlencode($search_societe);
587 if ($search_societe_alias) {
588 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
590 if ($search_user > 0) {
591 $param .=
'&search_user='.urlencode((
string) ($search_user));
593 if ($search_sale > 0) {
594 $param .=
'&search_sale='.urlencode($search_sale);
596 if ($search_montant_ht) {
597 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
599 if ($search_multicurrency_code !=
'') {
600 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
602 if ($search_multicurrency_tx !=
'') {
603 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
605 if ($search_multicurrency_montant_ht !=
'') {
606 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
608 if ($search_multicurrency_montant_vat !=
'') {
609 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
611 if ($search_multicurrency_montant_ttc !=
'') {
612 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
615 $param .=
'&search_login='.urlencode($search_login);
618 $param .=
'&search_town='.urlencode($search_town);
621 $param .=
'&search_zip='.urlencode($search_zip);
624 $param .=
'&socid='.urlencode((
string) ($socid));
626 if ($search_status !=
'') {
627 $param .=
'&search_status='.urlencode($search_status);
629 if ($optioncss !=
'') {
630 $param .=
'&optioncss='.urlencode($optioncss);
632 if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
633 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
636 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
639 $arrayofmassactions = array(
640 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
641 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
644 if ($user->hasRight(
'supplier_proposal',
'supprimer')) {
645 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
647 if (in_array($massaction, array(
'presend',
'predelete'))) {
648 $arrayofmassactions = array();
650 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
652 $url = DOL_URL_ROOT.
'/supplier_proposal/card.php?action=create';
653 if (!empty($socid)) {
654 $url .=
'&socid='.$socid;
657 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss' =>
'reposition'));
658 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss' =>
'reposition'));
660 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewAskPrice'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'supplier_proposal',
'creer'));
663 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
664 if ($optioncss !=
'') {
665 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
667 print
'<input type="hidden" name="token" value="'.newToken().
'">';
668 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
669 print
'<input type="hidden" name="action" value="list">';
670 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
671 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
672 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
674 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'supplier_proposal', 0, $newcardbutton,
'', $limit, 0, 0, 1);
676 $topicmail =
"SendSupplierProposalRef";
677 $modelmail =
"supplier_proposal_send";
679 $trackid =
'spro'.$object->id;
680 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
683 foreach ($fieldstosearchall as $key => $val) {
684 $fieldstosearchall[$key] = $langs->trans($val);
686 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
694 if ($user->hasRight(
'user',
'user',
'lire')) {
695 $langs->load(
"commercial");
696 $moreforfilter .=
'<div class="divsearchfield">';
697 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
698 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
699 $moreforfilter .=
'</div>';
702 if ($user->hasRight(
'user',
'user',
'lire')) {
703 $moreforfilter .=
'<div class="divsearchfield">';
704 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
705 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
706 $moreforfilter .=
'</div>';
709 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
710 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
711 $moreforfilter .=
'<div class="divsearchfield">';
712 $tmptitle = $langs->trans(
'IncludingProductWithTag');
713 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
null,
'parent',
null,
null, 1);
714 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$form->selectarray(
'search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0,
'', 0, 0, 0, 0,
'maxwidth300 widthcentpercentminusx', 1);
715 $moreforfilter .=
'</div>';
717 $parameters = array();
718 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
719 if (empty($reshook)) {
720 $moreforfilter .= $hookmanager->resPrint;
722 $moreforfilter = $hookmanager->resPrint;
725 if (!empty($moreforfilter)) {
726 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
727 print $moreforfilter;
731 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
732 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
733 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
735 print
'<div class="div-table-responsive">';
736 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
740 print
'<tr class="liste_titre_filter">';
743 print
'<td class="liste_titre maxwidthsearch">';
744 $searchpicto = $form->showFilterButtons(
'left');
748 if (!empty($arrayfields[
'sp.ref'][
'checked'])) {
749 print
'<td class="liste_titre">';
750 print
'<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
753 if (!empty($arrayfields[
's.nom'][
'checked'])) {
754 print
'<td class="liste_titre left">';
755 print
'<input class="flat" type="text" size="12" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'">';
758 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
759 print
'<td class="liste_titre left">';
760 print
'<input class="flat" type="text" size="12" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'">';
763 if (!empty($arrayfields[
's.town'][
'checked'])) {
764 print
'<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.
'"></td>';
766 if (!empty($arrayfields[
's.zip'][
'checked'])) {
767 print
'<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.$search_zip.
'"></td>';
770 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
771 print
'<td class="liste_titre">';
772 print
'<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
776 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
777 print
'<td class="liste_titre center">';
778 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
782 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
783 print
'<td class="liste_titre maxwidthonsmartphone center">';
784 print $form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0,
'', 0, 0, 0, (!
getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT') ?
'ASC' :
$conf->global->SOCIETE_SORT_ON_TYPEENT),
'', 1);
788 if (!empty($arrayfields[
'sp.date_valid'][
'checked'])) {
789 print
'<td class="liste_titre center">';
790 print
'<div class="nowrapfordate">';
791 print $form->selectDate($search_date_valid_start ? $search_date_valid_start : -1,
'search_date_valid_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
793 print
'<div class="nowrapfordate">';
794 print $form->selectDate($search_date_valid_end ? $search_date_valid_end : -1,
'search_date_valid_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
799 if (!empty($arrayfields[
'sp.date_livraison'][
'checked'])) {
800 print
'<td class="liste_titre center">';
801 print
'<div class="nowrapfordate">';
802 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
804 print
'<div class="nowrapfordate">';
805 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
810 if (!empty($arrayfields[
'sp.total_ht'][
'checked'])) {
812 print
'<td class="liste_titre right">';
813 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
816 if (!empty($arrayfields[
'sp.total_tva'][
'checked'])) {
818 print
'<td class="liste_titre right">';
819 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
822 if (!empty($arrayfields[
'sp.total_ttc'][
'checked'])) {
824 print
'<td class="liste_titre right">';
825 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
828 if (!empty($arrayfields[
'sp.multicurrency_code'][
'checked'])) {
830 print
'<td class="liste_titre">';
831 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
834 if (!empty($arrayfields[
'sp.multicurrency_tx'][
'checked'])) {
836 print
'<td class="liste_titre">';
837 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
840 if (!empty($arrayfields[
'sp.multicurrency_total_ht'][
'checked'])) {
842 print
'<td class="liste_titre right">';
843 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
846 if (!empty($arrayfields[
'sp.multicurrency_total_vat'][
'checked'])) {
848 print
'<td class="liste_titre right">';
849 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
852 if (!empty($arrayfields[
'sp.multicurrency_total_ttc'][
'checked'])) {
854 print
'<td class="liste_titre right">';
855 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
858 if (!empty($arrayfields[
'u.login'][
'checked'])) {
860 print
'<td class="liste_titre center">';
861 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
865 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
867 $parameters = array(
'arrayfields' => $arrayfields);
868 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
869 print $hookmanager->resPrint;
871 if (!empty($arrayfields[
'sp.datec'][
'checked'])) {
872 print
'<td class="liste_titre">';
876 if (!empty($arrayfields[
'sp.tms'][
'checked'])) {
877 print
'<td class="liste_titre">';
881 if (!empty($arrayfields[
'sp.fk_statut'][
'checked'])) {
882 print
'<td class="liste_titre center parentonrightofpage">';
883 $formpropal->selectProposalStatus($search_status, 1, 0, 1,
'supplier',
'search_status',
'search_status width100 onrightofpage');
888 print
'<td class="liste_titre maxwidthsearch">';
889 $searchpicto = $form->showFilterButtons();
896 $totalarray = array();
897 $totalarray[
'nbfield'] = 0;
900 print
'<tr class="liste_titre">';
902 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
903 $totalarray[
'nbfield']++;
905 if (!empty($arrayfields[
'sp.ref'][
'checked'])) {
906 print_liste_field_titre($arrayfields[
'sp.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.ref',
'', $param,
'', $sortfield, $sortorder);
907 $totalarray[
'nbfield']++;
909 if (!empty($arrayfields[
's.nom'][
'checked'])) {
910 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
911 $totalarray[
'nbfield']++;
913 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
915 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
916 $totalarray[
'nbfield']++;
918 if (!empty($arrayfields[
's.town'][
'checked'])) {
919 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
920 $totalarray[
'nbfield']++;
922 if (!empty($arrayfields[
's.zip'][
'checked'])) {
923 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
924 $totalarray[
'nbfield']++;
926 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
927 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
928 $totalarray[
'nbfield']++;
930 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
931 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
932 $totalarray[
'nbfield']++;
934 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
935 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
936 $totalarray[
'nbfield']++;
938 if (!empty($arrayfields[
'sp.date_valid'][
'checked'])) {
939 print_liste_field_titre($arrayfields[
'sp.date_valid'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.date_valid',
'', $param,
'', $sortfield, $sortorder,
'center ');
940 $totalarray[
'nbfield']++;
942 if (!empty($arrayfields[
'sp.date_livraison'][
'checked'])) {
943 print_liste_field_titre($arrayfields[
'sp.date_livraison'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
944 $totalarray[
'nbfield']++;
946 if (!empty($arrayfields[
'sp.total_ht'][
'checked'])) {
947 print_liste_field_titre($arrayfields[
'sp.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
948 $totalarray[
'nbfield']++;
950 if (!empty($arrayfields[
'sp.total_tva'][
'checked'])) {
951 print_liste_field_titre($arrayfields[
'sp.total_tva'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
952 $totalarray[
'nbfield']++;
954 if (!empty($arrayfields[
'sp.total_ttc'][
'checked'])) {
955 print_liste_field_titre($arrayfields[
'sp.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
956 $totalarray[
'nbfield']++;
958 if (!empty($arrayfields[
'sp.multicurrency_code'][
'checked'])) {
959 print_liste_field_titre($arrayfields[
'sp.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
960 $totalarray[
'nbfield']++;
962 if (!empty($arrayfields[
'sp.multicurrency_tx'][
'checked'])) {
963 print_liste_field_titre($arrayfields[
'sp.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
964 $totalarray[
'nbfield']++;
966 if (!empty($arrayfields[
'sp.multicurrency_total_ht'][
'checked'])) {
967 print_liste_field_titre($arrayfields[
'sp.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
968 $totalarray[
'nbfield']++;
970 if (!empty($arrayfields[
'sp.multicurrency_total_vat'][
'checked'])) {
971 print_liste_field_titre($arrayfields[
'sp.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
972 $totalarray[
'nbfield']++;
974 if (!empty($arrayfields[
'sp.multicurrency_total_ttc'][
'checked'])) {
975 print_liste_field_titre($arrayfields[
'sp.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
976 $totalarray[
'nbfield']++;
978 if (!empty($arrayfields[
'u.login'][
'checked'])) {
979 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder,
'center ');
980 $totalarray[
'nbfield']++;
983 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
985 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
986 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
987 print $hookmanager->resPrint;
988 if (!empty($arrayfields[
'sp.datec'][
'checked'])) {
989 print_liste_field_titre($arrayfields[
'sp.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
990 $totalarray[
'nbfield']++;
992 if (!empty($arrayfields[
'sp.tms'][
'checked'])) {
993 print_liste_field_titre($arrayfields[
'sp.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap');
994 $totalarray[
'nbfield']++;
996 if (!empty($arrayfields[
'sp.fk_statut'][
'checked'])) {
997 print_liste_field_titre($arrayfields[
'sp.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
998 $totalarray[
'nbfield']++;
1002 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1003 $totalarray[
'nbfield']++;
1011 $savnbfield = $totalarray[
'nbfield'];
1012 $totalarray = array();
1013 $totalarray[
'nbfield'] = 0;
1014 $totalarray[
'val'] = array();
1015 $totalarray[
'val'][
'sp.total_ht'] = 0;
1016 $totalarray[
'val'][
'sp.total_tva'] = 0;
1017 $totalarray[
'val'][
'sp.total_ttc'] = 0;
1019 $imaxinloop = ($limit ? min($num, $limit) : $num);
1020 while ($i < $imaxinloop) {
1021 $obj = $db->fetch_object($resql);
1023 $objectstatic->id = $obj->rowid;
1024 $objectstatic->ref = $obj->ref;
1025 $objectstatic->note_public = $obj->note_public;
1026 $objectstatic->note_private = $obj->note_private;
1027 $objectstatic->status = $obj->status;
1030 $companystatic->id = $obj->socid;
1031 $companystatic->name = $obj->name;
1032 $companystatic->name_alias = $obj->alias;
1033 $companystatic->client = $obj->client;
1034 $companystatic->code_client = $obj->code_client;
1036 if ($mode ==
'kanban') {
1038 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1039 print
'<div class="box-flex-container kanban">';
1043 $userstatic->fetch($obj->fk_user_author);
1044 $objectstatic->delivery_date = $obj->dp;
1045 print $objectstatic->getKanbanView(
'', array(
'thirdparty' => $companystatic,
'userauthor' => $userstatic,
'selected' => in_array($obj->rowid, $arrayofselected)));
1046 if ($i == ($imaxinloop - 1)) {
1051 print
'<tr class="oddeven '.((getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->status > 1) ?
'opacitymedium' :
'').
'">';
1054 print
'<td class="nowrap center">';
1055 if ($massactionbutton || $massaction) {
1057 if (in_array($obj->rowid, $arrayofselected)) {
1060 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1064 if (!empty($arrayfields[
'sp.ref'][
'checked'])) {
1065 print
'<td class="nowraponall">';
1067 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1069 print
'<td class="nobordernopadding nowraponall">';
1070 print $objectstatic->getNomUrl(1,
'',
'', 0, -1, 1);
1076 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
1081 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
1084 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1085 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1086 print
'</td></tr></table>';
1090 $totalarray[
'nbfield']++;
1095 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1096 print
'<td class="tdoverflowmax150">';
1097 print $companystatic->getNomUrl(1,
'supplier', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1100 $totalarray[
'nbfield']++;
1105 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1106 print
'<td class="tdoverflowmax200">';
1107 print $companystatic->name_alias;
1110 $totalarray[
'nbfield']++;
1115 if (!empty($arrayfields[
's.town'][
'checked'])) {
1116 print
'<td class="nocellnopadd">';
1120 $totalarray[
'nbfield']++;
1124 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1125 print
'<td class="nocellnopadd">';
1129 $totalarray[
'nbfield']++;
1133 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1134 print
"<td>".$obj->state_name.
"</td>\n";
1136 $totalarray[
'nbfield']++;
1140 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1141 print
'<td class="center">';
1142 $tmparray =
getCountry($obj->fk_pays,
'all');
1143 print $tmparray[
'label'];
1146 $totalarray[
'nbfield']++;
1150 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1151 print
'<td class="center">';
1152 if (empty($typenArray) || !is_array($typenArray) || count($typenArray) == 0) {
1153 $typenArray = $formcompany->typent_array(1);
1155 print $typenArray[$obj->typent_code];
1158 $totalarray[
'nbfield']++;
1163 if (!empty($arrayfields[
'sp.date_valid'][
'checked'])) {
1164 print
'<td class="center">';
1168 $totalarray[
'nbfield']++;
1173 if (!empty($arrayfields[
'sp.date_livraison'][
'checked'])) {
1174 print
'<td class="center">';
1178 $totalarray[
'nbfield']++;
1183 if (!empty($arrayfields[
'sp.total_ht'][
'checked'])) {
1184 print
'<td class="right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
1186 $totalarray[
'nbfield']++;
1189 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'sp.total_ht';
1191 $totalarray[
'val'][
'sp.total_ht'] += $obj->total_ht;
1194 if (!empty($arrayfields[
'sp.total_tva'][
'checked'])) {
1195 print
'<td class="right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
1197 $totalarray[
'nbfield']++;
1200 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'sp.total_tva';
1202 $totalarray[
'val'][
'sp.total_tva'] += $obj->total_tva;
1205 if (!empty($arrayfields[
'sp.total_ttc'][
'checked'])) {
1206 print
'<td class="right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
1208 $totalarray[
'nbfield']++;
1211 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'sp.total_ttc';
1213 $totalarray[
'val'][
'sp.total_ttc'] += $obj->total_ttc;
1217 if (!empty($arrayfields[
'sp.multicurrency_code'][
'checked'])) {
1218 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
1220 $totalarray[
'nbfield']++;
1225 if (!empty($arrayfields[
'sp.multicurrency_tx'][
'checked'])) {
1226 print
'<td class="nowrap">';
1227 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
1230 $totalarray[
'nbfield']++;
1234 if (!empty($arrayfields[
'sp.multicurrency_total_ht'][
'checked'])) {
1235 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
1237 $totalarray[
'nbfield']++;
1241 if (!empty($arrayfields[
'sp.multicurrency_total_vat'][
'checked'])) {
1242 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
1244 $totalarray[
'nbfield']++;
1248 if (!empty($arrayfields[
'sp.multicurrency_total_ttc'][
'checked'])) {
1249 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
1251 $totalarray[
'nbfield']++;
1255 $userstatic->id = $obj->fk_user_author;
1256 $userstatic->login = $obj->login;
1257 $userstatic->status = $obj->ustatus;
1258 $userstatic->lastname = $obj->name;
1259 $userstatic->firstname = $obj->firstname;
1260 $userstatic->photo = $obj->photo;
1261 $userstatic->admin = $obj->admin;
1262 $userstatic->ref = $obj->fk_user_author;
1263 $userstatic->employee = $obj->employee;
1264 $userstatic->email = $obj->uemail;
1267 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1268 print
'<td class="tdoverflowmax125">';
1269 if ($userstatic->id > 0) {
1270 print $userstatic->getNomUrl(-1,
'', 0, 0, 24, 1,
'login',
'', 1);
1274 $totalarray[
'nbfield']++;
1279 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1281 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1282 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1283 print $hookmanager->resPrint;
1285 if (!empty($arrayfields[
'sp.datec'][
'checked'])) {
1286 print
'<td class="center nowraponall">';
1287 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1290 $totalarray[
'nbfield']++;
1294 if (!empty($arrayfields[
'sp.tms'][
'checked'])) {
1295 print
'<td class="center nowraponall">';
1296 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
1299 $totalarray[
'nbfield']++;
1303 if (!empty($arrayfields[
'sp.fk_statut'][
'checked'])) {
1304 print
'<td class="center">'.$objectstatic->getLibStatut(5).
"</td>\n";
1306 $totalarray[
'nbfield']++;
1312 print
'<td class="nowrap center">';
1313 if ($massactionbutton || $massaction) {
1315 if (in_array($obj->rowid, $arrayofselected)) {
1318 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1323 $totalarray[
'nbfield']++;
1328 $total += $obj->total_ht;
1329 $subtotal += $obj->total_ht;
1335 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1340 foreach ($arrayfields as $key => $val) {
1341 if (!empty($val[
'checked'])) {
1345 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1350 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1351 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
1352 print $hookmanager->resPrint;
1354 print
'</table>'.
"\n";
1355 print
'</div>'.
"\n";
1357 print
'</form>'.
"\n";
1359 $hidegeneratedfilelistifempty = 1;
1360 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1361 $hidegeneratedfilelistifempty = 0;
1365 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1366 $urlsource .= str_replace(
'&',
'&', $param);
1368 $filedir = $diroutputmassaction;
1370 $genallowed = $user->hasRight(
'supplier_proposal',
'lire');
1371 $delallowed = $user->hasRight(
'supplier_proposal',
'creer');
1373 print $formfile->showdocuments(
'massfilesarea_supplier_proposal',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage price ask supplier.
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_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.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.