39require
'../main.inc.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formpropal.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
47if (isModEnabled(
'project')) {
48 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
52$langs->loadLangs(array(
'companies',
'propal',
'supplier_proposal',
'compta',
'bills',
'orders',
'products'));
56$action =
GETPOST(
'action',
'aZ09');
57$massaction =
GETPOST(
'massaction',
'alpha');
59$confirm =
GETPOST(
'confirm',
'alpha');
60$toselect =
GETPOST(
'toselect',
'array');
61$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'supplierproposallist';
62$optioncss =
GETPOST(
'optioncss',
'alpha');
63$mode =
GETPOST(
'mode',
'alpha');
65$search_user =
GETPOST(
'search_user',
'intcomma');
66$search_sale =
GETPOST(
'search_sale',
'intcomma');
68$search_societe =
GETPOST(
'search_societe',
'alpha');
69$search_societe_alias =
GETPOST(
'search_societe_alias',
'alpha');
70$search_login =
GETPOST(
'search_login',
'alpha');
71$search_town =
GETPOST(
'search_town',
'alpha');
72$search_zip =
GETPOST(
'search_zip',
'alpha');
73$search_state =
GETPOST(
"search_state");
74$search_country =
GETPOST(
"search_country",
'aZ09');
75$search_date_startday =
GETPOSTINT(
'search_date_startday');
76$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
77$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
78$search_date_endday =
GETPOSTINT(
'search_date_endday');
79$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
80$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
81$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
82$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
83$search_date_valid_startday =
GETPOSTINT(
'search_date_valid_startday');
84$search_date_valid_startmonth =
GETPOSTINT(
'search_date_valid_startmonth');
85$search_date_valid_startyear =
GETPOSTINT(
'search_date_valid_startyear');
86$search_date_valid_endday =
GETPOSTINT(
'search_date_valid_endday');
87$search_date_valid_endmonth =
GETPOSTINT(
'search_date_valid_endmonth');
88$search_date_valid_endyear =
GETPOSTINT(
'search_date_valid_endyear');
89$search_date_valid_start =
dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear);
90$search_date_valid_end =
dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear);
91$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
92$search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
93$search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
94$search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
95$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
96$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
97$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
98$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
99$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
100$search_status =
GETPOST(
'search_status',
'intcomma');
101$search_product_category =
GETPOST(
'search_product_category',
'int');
102$search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
104$object_statut =
GETPOST(
'supplier_proposal_statut',
'intcomma');
105$search_btn =
GETPOST(
'button_search',
'alpha');
106$search_remove_btn =
GETPOST(
'button_removefilter',
'alpha');
109$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
110$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
112if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
116$offset = $limit * $page;
117$pageprev = $page - 1;
118$pagenext = $page + 1;
120 $sortfield =
'sp.date_livraison';
126if ($object_statut !=
'') {
127 $search_status = $object_statut;
134$module =
'supplier_proposal';
137if (!empty($user->socid)) {
138 $socid = $user->socid;
143 $dbtable =
'&societe';
146$diroutputmassaction = $conf->supplier_proposal->dir_output.
'/temp/massgeneration/'.$user->id;
150$hookmanager->initHooks(array(
'supplier_proposallist'));
154$extrafields->fetch_name_optionals_label(
$object->table_element);
156$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
160$fieldstosearchall = array(
162 's.nom' =>
'Supplier',
163 'pd.description' =>
'Description',
164 'sp.note_public' =>
'NotePublic',
166if (empty($user->socid)) {
167 $fieldstosearchall[
"p.note_private"] =
"NotePrivate";
170$checkedtypetiers = 0;
172 'sp.ref' => array(
'label' => $langs->trans(
"Ref"),
'checked' => 1),
173 's.nom' => array(
'label' => $langs->trans(
"Supplier"),
'checked' => 1),
174 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' => 0),
175 's.town' => array(
'label' => $langs->trans(
"Town"),
'checked' => 1),
176 's.zip' => array(
'label' => $langs->trans(
"Zip"),
'checked' => 1),
177 'state.nom' => array(
'label' => $langs->trans(
"StateShort"),
'checked' => 0),
178 'country.code_iso' => array(
'label' => $langs->trans(
"Country"),
'checked' => 0),
179 'typent.code' => array(
'label' => $langs->trans(
"ThirdPartyType"),
'checked' => $checkedtypetiers),
180 'sp.date_valid' => array(
'label' => $langs->trans(
"DateValidation"),
'checked' => 1),
181 'sp.date_livraison' => array(
'label' => $langs->trans(
"DateEnd"),
'checked' => 1),
182 'sp.total_ht' => array(
'label' => $langs->trans(
"AmountHT"),
'checked' => 1),
183 'sp.total_tva' => array(
'label' => $langs->trans(
"AmountVAT"),
'checked' => 0),
184 'sp.total_ttc' => array(
'label' => $langs->trans(
"AmountTTC"),
'checked' => 0),
185 'sp.multicurrency_code' => array(
'label' =>
'Currency',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
186 'sp.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
187 'sp.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
188 'sp.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
189 'sp.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
190 'u.login' => array(
'label' => $langs->trans(
"Author"),
'checked' => 1,
'position' => 10),
191 'sp.datec' => array(
'label' => $langs->trans(
"DateCreation"),
'checked' => 0,
'position' => 500),
192 'sp.tms' => array(
'label' => $langs->trans(
"DateModificationShort"),
'checked' => 0,
'position' => 500),
193 'sp.fk_statut' => array(
'label' => $langs->trans(
"Status"),
'checked' => 1,
'position' => 1000),
196include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
200'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
202if (!$user->hasRight(
'societe',
'client',
'voir')) {
203 $search_sale = $user->id;
208$permissiontoread = $user->hasRight(
'supplier_proposal',
'lire');
209$permissiontodelete = $user->hasRight(
'supplier_proposal',
'supprimer');
216if (
GETPOST(
'cancel',
'alpha')) {
220if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
224$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
225$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
230if (empty($reshook)) {
232 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
235 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
240 $search_societe =
'';
241 $search_societe_alias =
'';
242 $search_montant_ht =
'';
243 $search_montant_vat =
'';
244 $search_montant_ttc =
'';
245 $search_multicurrency_code =
'';
246 $search_multicurrency_tx =
'';
247 $search_multicurrency_montant_ht =
'';
248 $search_multicurrency_montant_vat =
'';
249 $search_multicurrency_montant_ttc =
'';
251 $search_product_category =
'';
256 $search_country =
'';
257 $search_type_thirdparty =
'';
258 $search_date_startday =
'';
259 $search_date_startmonth =
'';
260 $search_date_startyear =
'';
261 $search_date_endday =
'';
262 $search_date_endmonth =
'';
263 $search_date_endyear =
'';
264 $search_date_start =
'';
265 $search_date_end =
'';
266 $search_date_valid_startday =
'';
267 $search_date_valid_startmonth =
'';
268 $search_date_valid_startyear =
'';
269 $search_date_valid_endday =
'';
270 $search_date_valid_endmonth =
'';
271 $search_date_valid_endyear =
'';
272 $search_date_valid_start =
'';
273 $search_date_valid_end =
'';
278 $objectclass =
'SupplierProposal';
279 $objectlabel =
'SupplierProposals';
280 $uploaddir = $conf->supplier_proposal->dir_output;
281 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
289$form =
new Form($db);
293$companystatic =
new Societe($db);
298$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
299$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
301$title = $langs->trans(
'ListOfSupplierProposals');
302$help_url =
'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur';
308if ($search_all || $search_user > 0) {
309 $sql =
'SELECT DISTINCT';
311$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,';
312$sql .=
" typent.code as typent_code,";
313$sql .=
" state.code_departement as state_code, state.nom as state_name,";
314$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,';
315$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,';
316$sql .=
' sp.datec as date_creation, sp.tms as date_modification,';
317$sql .=
" p.rowid as project_id, p.ref as project_ref,";
318$sql .=
" u.firstname, u.lastname, u.photo, u.login, u.statut as ustatus, u.admin, u.employee, u.email as uemail";
320if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
321 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
322 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
326$parameters = array();
327$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
328$sql .= $hookmanager->resPrint;
329$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
330$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
331$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
332$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
333$sql .=
', '.MAIN_DB_PREFIX.
'supplier_proposal as sp';
334if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
335 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (sp.rowid = ef.fk_object)";
338 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'supplier_proposaldet as pd ON sp.rowid=pd.fk_supplier_proposal';
340$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON sp.fk_user_author = u.rowid';
341$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = sp.fk_projet";
342if ($search_user > 0) {
343 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as c";
344 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
346$sql .=
' WHERE sp.fk_soc = s.rowid';
347$sql .=
' AND sp.entity IN ('.getEntity(
'supplier_proposal').
')';
357if ($search_country) {
358 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
360if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
361 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
366if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
367 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
369 if ($search_societe) {
372 if ($search_societe_alias) {
377 $sql .=
natural_search(array(
'u.lastname',
'u.firstname',
'u.login'), $search_login);
379if ($search_montant_ht) {
382if ($search_montant_vat !=
'') {
385if ($search_montant_ttc !=
'') {
388if ($search_multicurrency_code !=
'') {
389 $sql .=
" AND sp.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
391if ($search_multicurrency_tx !=
'') {
392 $sql .=
natural_search(
'sp.multicurrency_tx', $search_multicurrency_tx, 1);
394if ($search_multicurrency_montant_ht !=
'') {
395 $sql .=
natural_search(
'sp.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
397if ($search_multicurrency_montant_vat !=
'') {
398 $sql .=
natural_search(
'sp.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
400if ($search_multicurrency_montant_ttc !=
'') {
401 $sql .=
natural_search(
'sp.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
404 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
407 $sql .=
' AND s.rowid = '.((int) $socid);
409if ($search_status >= 0 && $search_status !=
'') {
410 $sql .=
' AND sp.fk_statut IN ('.$db->sanitize($db->escape($search_status)).
')';
412if ($search_date_start) {
413 $sql .=
" AND sp.date_livraison >= '".$db->idate($search_date_start).
"'";
415if ($search_date_end) {
416 $sql .=
" AND sp.date_livraison <= '".$db->idate($search_date_end).
"'";
418if ($search_date_valid_start) {
419 $sql .=
" AND sp.date_valid >= '".$db->idate($search_date_valid_start).
"'";
421if ($search_date_valid_end) {
422 $sql .=
" AND sp.date_valid <= '".$db->idate($search_date_valid_end).
"'";
428if ($search_user > 0) {
429 $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);
432if ($search_sale && $search_sale !=
'-1') {
433 if ($search_sale == -2) {
434 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = sp.fk_soc)";
435 } elseif ($search_sale > 0) {
436 $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).
")";
440$searchCategoryProductOperator = -1;
441$searchCategoryProductList = array($search_product_category);
442if (!empty($searchCategoryProductList)) {
443 $searchCategoryProductSqlList = array();
444 $listofcategoryid =
'';
445 foreach ($searchCategoryProductList as $searchCategoryProduct) {
446 if (intval($searchCategoryProduct) == -2) {
447 $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)";
448 } elseif (intval($searchCategoryProduct) > 0) {
449 if ($searchCategoryProductOperator == 0) {
450 $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).
")";
452 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
456 if ($listofcategoryid) {
457 $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).
"))";
459 if ($searchCategoryProductOperator == 1) {
460 if (!empty($searchCategoryProductSqlList)) {
461 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
464 if (!empty($searchCategoryProductSqlList)) {
465 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
470include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
472$parameters = array();
473$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
474$sql .= $hookmanager->resPrint;
476$sql .= $db->order($sortfield, $sortorder);
477$sql .=
', sp.ref DESC';
480$nbtotalofrecords =
'';
482 $resql = $db->query($sql);
483 $nbtotalofrecords = $db->num_rows($resql);
484 if (($page * $limit) > $nbtotalofrecords) {
490$sql .= $db->plimit($limit + 1, $offset);
492$resql = $db->query($sql);
495 $userstatic =
new User($db);
500 $title = $langs->trans(
'SupplierProposals').
' - '.$soc->name;
502 $title = $langs->trans(
'SupplierProposals');
505 $num = $db->num_rows($resql);
507 $arrayofselected = is_array($toselect) ? $toselect : array();
509 if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
510 $obj = $db->fetch_object($resql);
514 header(
"Location: ".DOL_URL_ROOT.
'/supplier_proposal/card.php?id='.
$id);
521 llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-supplierproposal page-list');
525 $param .=
'&mode='.urlencode($mode);
527 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
528 $param .=
'&contextpage='.urlencode($contextpage);
530 if ($limit > 0 && $limit != $conf->liste_limit) {
531 $param .=
'&limit='.((int) $limit);
534 $param .=
'&search_all='.urlencode($search_all);
536 if ($search_date_startday) {
537 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
539 if ($search_date_startmonth) {
540 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
542 if ($search_date_startyear) {
543 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
545 if ($search_date_endday) {
546 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
548 if ($search_date_endmonth) {
549 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
551 if ($search_date_endyear) {
552 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
554 if ($search_date_valid_startday) {
555 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
557 if ($search_date_valid_startmonth) {
558 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
560 if ($search_date_valid_startyear) {
561 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
563 if ($search_date_valid_endday) {
564 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
566 if ($search_date_valid_endmonth) {
567 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
569 if ($search_date_valid_endyear) {
570 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
573 $param .=
'&search_ref='.urlencode($search_ref);
575 if ($search_societe) {
576 $param .=
'&search_societe='.urlencode($search_societe);
578 if ($search_societe_alias) {
579 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
581 if ($search_user > 0) {
582 $param .=
'&search_user='.urlencode((
string) ($search_user));
584 if ($search_sale > 0) {
585 $param .=
'&search_sale='.urlencode($search_sale);
587 if ($search_montant_ht) {
588 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
590 if ($search_multicurrency_code !=
'') {
591 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
593 if ($search_multicurrency_tx !=
'') {
594 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
596 if ($search_multicurrency_montant_ht !=
'') {
597 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
599 if ($search_multicurrency_montant_vat !=
'') {
600 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
602 if ($search_multicurrency_montant_ttc !=
'') {
603 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
606 $param .=
'&search_login='.urlencode($search_login);
609 $param .=
'&search_town='.urlencode($search_town);
612 $param .=
'&search_zip='.urlencode($search_zip);
615 $param .=
'&socid='.urlencode((
string) ($socid));
617 if ($search_status !=
'') {
618 $param .=
'&search_status='.urlencode($search_status);
620 if ($optioncss !=
'') {
621 $param .=
'&optioncss='.urlencode($optioncss);
623 if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
624 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
627 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
630 $arrayofmassactions = array(
631 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
632 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
635 if ($user->hasRight(
'supplier_proposal',
'supprimer')) {
636 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
638 if (in_array($massaction, array(
'presend',
'predelete'))) {
639 $arrayofmassactions = array();
641 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
643 $url = DOL_URL_ROOT.
'/supplier_proposal/card.php?action=create';
644 if (!empty($socid)) {
645 $url .=
'&socid='.$socid;
648 $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'));
649 $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'));
651 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewAskPrice'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'supplier_proposal',
'creer'));
654 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
655 if ($optioncss !=
'') {
656 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
658 print
'<input type="hidden" name="token" value="'.newToken().
'">';
659 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
660 print
'<input type="hidden" name="action" value="list">';
661 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
662 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
663 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
665 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'supplier_proposal', 0, $newcardbutton,
'', $limit, 0, 0, 1);
667 $topicmail =
"SendSupplierProposalRef";
668 $modelmail =
"supplier_proposal_send";
670 $trackid =
'spro'.$object->id;
671 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
674 foreach ($fieldstosearchall as $key => $val) {
675 $fieldstosearchall[$key] = $langs->trans($val);
677 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
685 if ($user->hasRight(
'user',
'user',
'lire')) {
686 $langs->load(
"commercial");
687 $moreforfilter .=
'<div class="divsearchfield">';
688 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
689 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
690 $moreforfilter .=
'</div>';
693 if ($user->hasRight(
'user',
'user',
'lire')) {
694 $moreforfilter .=
'<div class="divsearchfield">';
695 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
696 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
697 $moreforfilter .=
'</div>';
700 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
701 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
702 $moreforfilter .=
'<div class="divsearchfield">';
703 $tmptitle = $langs->trans(
'IncludingProductWithTag');
704 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
null,
'parent',
null,
null, 1);
705 $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);
706 $moreforfilter .=
'</div>';
708 $parameters = array();
709 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
710 if (empty($reshook)) {
711 $moreforfilter .= $hookmanager->resPrint;
713 $moreforfilter = $hookmanager->resPrint;
716 if (!empty($moreforfilter)) {
717 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
718 print $moreforfilter;
722 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
723 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
724 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
726 print
'<div class="div-table-responsive">';
727 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
731 print
'<tr class="liste_titre_filter">';
734 print
'<td class="liste_titre maxwidthsearch">';
735 $searchpicto = $form->showFilterButtons(
'left');
739 if (!empty($arrayfields[
'sp.ref'][
'checked'])) {
740 print
'<td class="liste_titre">';
741 print
'<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
744 if (!empty($arrayfields[
's.nom'][
'checked'])) {
745 print
'<td class="liste_titre left">';
746 print
'<input class="flat" type="text" size="12" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'">';
749 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
750 print
'<td class="liste_titre left">';
751 print
'<input class="flat" type="text" size="12" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'">';
754 if (!empty($arrayfields[
's.town'][
'checked'])) {
755 print
'<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.
'"></td>';
757 if (!empty($arrayfields[
's.zip'][
'checked'])) {
758 print
'<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.$search_zip.
'"></td>';
761 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
762 print
'<td class="liste_titre">';
763 print
'<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
767 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
768 print
'<td class="liste_titre center">';
769 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
773 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
774 print
'<td class="liste_titre maxwidthonsmartphone center">';
775 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);
779 if (!empty($arrayfields[
'sp.date_valid'][
'checked'])) {
780 print
'<td class="liste_titre center">';
781 print
'<div class="nowrapfordate">';
782 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'));
784 print
'<div class="nowrapfordate">';
785 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'));
790 if (!empty($arrayfields[
'sp.date_livraison'][
'checked'])) {
791 print
'<td class="liste_titre center">';
792 print
'<div class="nowrapfordate">';
793 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
795 print
'<div class="nowrapfordate">';
796 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
801 if (!empty($arrayfields[
'sp.total_ht'][
'checked'])) {
803 print
'<td class="liste_titre right">';
804 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
807 if (!empty($arrayfields[
'sp.total_tva'][
'checked'])) {
809 print
'<td class="liste_titre right">';
810 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
813 if (!empty($arrayfields[
'sp.total_ttc'][
'checked'])) {
815 print
'<td class="liste_titre right">';
816 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
819 if (!empty($arrayfields[
'sp.multicurrency_code'][
'checked'])) {
821 print
'<td class="liste_titre">';
822 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
825 if (!empty($arrayfields[
'sp.multicurrency_tx'][
'checked'])) {
827 print
'<td class="liste_titre">';
828 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
831 if (!empty($arrayfields[
'sp.multicurrency_total_ht'][
'checked'])) {
833 print
'<td class="liste_titre right">';
834 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
837 if (!empty($arrayfields[
'sp.multicurrency_total_vat'][
'checked'])) {
839 print
'<td class="liste_titre right">';
840 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
843 if (!empty($arrayfields[
'sp.multicurrency_total_ttc'][
'checked'])) {
845 print
'<td class="liste_titre right">';
846 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
849 if (!empty($arrayfields[
'u.login'][
'checked'])) {
851 print
'<td class="liste_titre center">';
852 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
856 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
858 $parameters = array(
'arrayfields' => $arrayfields);
859 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
860 print $hookmanager->resPrint;
862 if (!empty($arrayfields[
'sp.datec'][
'checked'])) {
863 print
'<td class="liste_titre">';
867 if (!empty($arrayfields[
'sp.tms'][
'checked'])) {
868 print
'<td class="liste_titre">';
872 if (!empty($arrayfields[
'sp.fk_statut'][
'checked'])) {
873 print
'<td class="liste_titre center parentonrightofpage">';
874 $formpropal->selectProposalStatus($search_status, 1, 0, 1,
'supplier',
'search_status',
'search_status width100 onrightofpage');
879 print
'<td class="liste_titre maxwidthsearch">';
880 $searchpicto = $form->showFilterButtons();
887 $totalarray = array();
888 $totalarray[
'nbfield'] = 0;
891 print
'<tr class="liste_titre">';
893 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
894 $totalarray[
'nbfield']++;
896 if (!empty($arrayfields[
'sp.ref'][
'checked'])) {
897 print_liste_field_titre($arrayfields[
'sp.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.ref',
'', $param,
'', $sortfield, $sortorder);
898 $totalarray[
'nbfield']++;
900 if (!empty($arrayfields[
's.nom'][
'checked'])) {
901 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
902 $totalarray[
'nbfield']++;
904 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
906 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
907 $totalarray[
'nbfield']++;
909 if (!empty($arrayfields[
's.town'][
'checked'])) {
910 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
911 $totalarray[
'nbfield']++;
913 if (!empty($arrayfields[
's.zip'][
'checked'])) {
914 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
915 $totalarray[
'nbfield']++;
917 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
918 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
919 $totalarray[
'nbfield']++;
921 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
922 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
923 $totalarray[
'nbfield']++;
925 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
926 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
927 $totalarray[
'nbfield']++;
929 if (!empty($arrayfields[
'sp.date_valid'][
'checked'])) {
930 print_liste_field_titre($arrayfields[
'sp.date_valid'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.date_valid',
'', $param,
'', $sortfield, $sortorder,
'center ');
931 $totalarray[
'nbfield']++;
933 if (!empty($arrayfields[
'sp.date_livraison'][
'checked'])) {
934 print_liste_field_titre($arrayfields[
'sp.date_livraison'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
935 $totalarray[
'nbfield']++;
937 if (!empty($arrayfields[
'sp.total_ht'][
'checked'])) {
938 print_liste_field_titre($arrayfields[
'sp.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
939 $totalarray[
'nbfield']++;
941 if (!empty($arrayfields[
'sp.total_tva'][
'checked'])) {
942 print_liste_field_titre($arrayfields[
'sp.total_tva'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
943 $totalarray[
'nbfield']++;
945 if (!empty($arrayfields[
'sp.total_ttc'][
'checked'])) {
946 print_liste_field_titre($arrayfields[
'sp.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
947 $totalarray[
'nbfield']++;
949 if (!empty($arrayfields[
'sp.multicurrency_code'][
'checked'])) {
950 print_liste_field_titre($arrayfields[
'sp.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
951 $totalarray[
'nbfield']++;
953 if (!empty($arrayfields[
'sp.multicurrency_tx'][
'checked'])) {
954 print_liste_field_titre($arrayfields[
'sp.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
955 $totalarray[
'nbfield']++;
957 if (!empty($arrayfields[
'sp.multicurrency_total_ht'][
'checked'])) {
958 print_liste_field_titre($arrayfields[
'sp.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
959 $totalarray[
'nbfield']++;
961 if (!empty($arrayfields[
'sp.multicurrency_total_vat'][
'checked'])) {
962 print_liste_field_titre($arrayfields[
'sp.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
963 $totalarray[
'nbfield']++;
965 if (!empty($arrayfields[
'sp.multicurrency_total_ttc'][
'checked'])) {
966 print_liste_field_titre($arrayfields[
'sp.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
967 $totalarray[
'nbfield']++;
969 if (!empty($arrayfields[
'u.login'][
'checked'])) {
970 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder,
'center ');
971 $totalarray[
'nbfield']++;
974 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
976 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
977 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
978 print $hookmanager->resPrint;
979 if (!empty($arrayfields[
'sp.datec'][
'checked'])) {
980 print_liste_field_titre($arrayfields[
'sp.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
981 $totalarray[
'nbfield']++;
983 if (!empty($arrayfields[
'sp.tms'][
'checked'])) {
984 print_liste_field_titre($arrayfields[
'sp.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap');
985 $totalarray[
'nbfield']++;
987 if (!empty($arrayfields[
'sp.fk_statut'][
'checked'])) {
988 print_liste_field_titre($arrayfields[
'sp.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
989 $totalarray[
'nbfield']++;
993 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
994 $totalarray[
'nbfield']++;
1002 $savnbfield = $totalarray[
'nbfield'];
1003 $totalarray = array();
1004 $totalarray[
'nbfield'] = 0;
1005 $totalarray[
'val'] = array();
1006 $totalarray[
'val'][
'sp.total_ht'] = 0;
1007 $totalarray[
'val'][
'sp.total_tva'] = 0;
1008 $totalarray[
'val'][
'sp.total_ttc'] = 0;
1010 $imaxinloop = ($limit ? min($num, $limit) : $num);
1011 while ($i < $imaxinloop) {
1012 $obj = $db->fetch_object($resql);
1014 $objectstatic->id = $obj->rowid;
1015 $objectstatic->ref = $obj->ref;
1016 $objectstatic->note_public = $obj->note_public;
1017 $objectstatic->note_private = $obj->note_private;
1018 $objectstatic->status = $obj->status;
1021 $companystatic->id = $obj->socid;
1022 $companystatic->name = $obj->name;
1023 $companystatic->name_alias = $obj->alias;
1024 $companystatic->client = $obj->client;
1025 $companystatic->code_client = $obj->code_client;
1027 if ($mode ==
'kanban') {
1029 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1030 print
'<div class="box-flex-container kanban">';
1034 $userstatic->fetch($obj->fk_user_author);
1035 $objectstatic->delivery_date = $obj->dp;
1036 print $objectstatic->getKanbanView(
'', array(
'thirdparty' => $companystatic,
'userauthor' => $userstatic,
'selected' => in_array($obj->rowid, $arrayofselected)));
1037 if ($i == ($imaxinloop - 1)) {
1042 print
'<tr class="oddeven '.((getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->status > 1) ?
'opacitymedium' :
'').
'">';
1045 print
'<td class="nowrap center">';
1046 if ($massactionbutton || $massaction) {
1048 if (in_array($obj->rowid, $arrayofselected)) {
1051 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1055 if (!empty($arrayfields[
'sp.ref'][
'checked'])) {
1056 print
'<td class="nowraponall">';
1058 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1060 print
'<td class="nobordernopadding nowraponall">';
1061 print $objectstatic->getNomUrl(1,
'',
'', 0, -1, 1);
1067 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
1072 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
1075 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1076 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1077 print
'</td></tr></table>';
1081 $totalarray[
'nbfield']++;
1086 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1087 print
'<td class="tdoverflowmax150">';
1088 print $companystatic->getNomUrl(1,
'supplier', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1091 $totalarray[
'nbfield']++;
1096 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1097 print
'<td class="tdoverflowmax200">';
1098 print $companystatic->name_alias;
1101 $totalarray[
'nbfield']++;
1106 if (!empty($arrayfields[
's.town'][
'checked'])) {
1107 print
'<td class="nocellnopadd">';
1111 $totalarray[
'nbfield']++;
1115 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1116 print
'<td class="nocellnopadd">';
1120 $totalarray[
'nbfield']++;
1124 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1125 print
"<td>".$obj->state_name.
"</td>\n";
1127 $totalarray[
'nbfield']++;
1131 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1132 print
'<td class="center">';
1133 $tmparray =
getCountry($obj->fk_pays,
'all');
1134 print $tmparray[
'label'];
1137 $totalarray[
'nbfield']++;
1141 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1142 print
'<td class="center">';
1143 if (empty($typenArray) || !is_array($typenArray) || count($typenArray) == 0) {
1144 $typenArray = $formcompany->typent_array(1);
1146 print $typenArray[$obj->typent_code];
1149 $totalarray[
'nbfield']++;
1154 if (!empty($arrayfields[
'sp.date_valid'][
'checked'])) {
1155 print
'<td class="center">';
1159 $totalarray[
'nbfield']++;
1164 if (!empty($arrayfields[
'sp.date_livraison'][
'checked'])) {
1165 print
'<td class="center">';
1169 $totalarray[
'nbfield']++;
1174 if (!empty($arrayfields[
'sp.total_ht'][
'checked'])) {
1175 print
'<td class="right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
1177 $totalarray[
'nbfield']++;
1180 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'sp.total_ht';
1182 $totalarray[
'val'][
'sp.total_ht'] += $obj->total_ht;
1185 if (!empty($arrayfields[
'sp.total_tva'][
'checked'])) {
1186 print
'<td class="right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
1188 $totalarray[
'nbfield']++;
1191 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'sp.total_tva';
1193 $totalarray[
'val'][
'sp.total_tva'] += $obj->total_tva;
1196 if (!empty($arrayfields[
'sp.total_ttc'][
'checked'])) {
1197 print
'<td class="right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
1199 $totalarray[
'nbfield']++;
1202 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'sp.total_ttc';
1204 $totalarray[
'val'][
'sp.total_ttc'] += $obj->total_ttc;
1208 if (!empty($arrayfields[
'sp.multicurrency_code'][
'checked'])) {
1209 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
1211 $totalarray[
'nbfield']++;
1216 if (!empty($arrayfields[
'sp.multicurrency_tx'][
'checked'])) {
1217 print
'<td class="nowrap">';
1218 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
1221 $totalarray[
'nbfield']++;
1225 if (!empty($arrayfields[
'sp.multicurrency_total_ht'][
'checked'])) {
1226 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
1228 $totalarray[
'nbfield']++;
1232 if (!empty($arrayfields[
'sp.multicurrency_total_vat'][
'checked'])) {
1233 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
1235 $totalarray[
'nbfield']++;
1239 if (!empty($arrayfields[
'sp.multicurrency_total_ttc'][
'checked'])) {
1240 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
1242 $totalarray[
'nbfield']++;
1246 $userstatic->id = $obj->fk_user_author;
1247 $userstatic->login = $obj->login;
1248 $userstatic->status = $obj->ustatus;
1249 $userstatic->lastname = $obj->name;
1250 $userstatic->firstname = $obj->firstname;
1251 $userstatic->photo = $obj->photo;
1252 $userstatic->admin = $obj->admin;
1253 $userstatic->ref = $obj->fk_user_author;
1254 $userstatic->employee = $obj->employee;
1255 $userstatic->email = $obj->uemail;
1258 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1259 print
'<td class="tdoverflowmax125">';
1260 if ($userstatic->id > 0) {
1261 print $userstatic->getNomUrl(-1,
'', 0, 0, 24, 1,
'login',
'', 1);
1265 $totalarray[
'nbfield']++;
1270 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1272 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1273 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1274 print $hookmanager->resPrint;
1276 if (!empty($arrayfields[
'sp.datec'][
'checked'])) {
1277 print
'<td class="center nowraponall">';
1278 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1281 $totalarray[
'nbfield']++;
1285 if (!empty($arrayfields[
'sp.tms'][
'checked'])) {
1286 print
'<td class="center nowraponall">';
1287 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
1290 $totalarray[
'nbfield']++;
1294 if (!empty($arrayfields[
'sp.fk_statut'][
'checked'])) {
1295 print
'<td class="center">'.$objectstatic->getLibStatut(5).
"</td>\n";
1297 $totalarray[
'nbfield']++;
1303 print
'<td class="nowrap center">';
1304 if ($massactionbutton || $massaction) {
1306 if (in_array($obj->rowid, $arrayofselected)) {
1309 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1314 $totalarray[
'nbfield']++;
1319 $total += $obj->total_ht;
1320 $subtotal += $obj->total_ht;
1326 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1331 foreach ($arrayfields as $key => $val) {
1332 if (!empty($val[
'checked'])) {
1336 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1341 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1342 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
1343 print $hookmanager->resPrint;
1345 print
'</table>'.
"\n";
1346 print
'</div>'.
"\n";
1348 print
'</form>'.
"\n";
1350 $hidegeneratedfilelistifempty = 1;
1351 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1352 $hidegeneratedfilelistifempty = 0;
1356 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1357 $urlsource .= str_replace(
'&',
'&', $param);
1359 $filedir = $diroutputmassaction;
1361 $genallowed = $user->hasRight(
'supplier_proposal',
'lire');
1362 $delallowed = $user->hasRight(
'supplier_proposal',
'creer');
1364 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.
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.