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 == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction ===
'0')) {
115$offset = $limit * $page;
116$pageprev = $page - 1;
117$pagenext = $page + 1;
119 $sortfield =
'sp.date_livraison';
125if ($object_statut !=
'') {
126 $search_status = $object_statut;
133$module =
'supplier_proposal';
136if (!empty($user->socid)) {
137 $socid = $user->socid;
142 $dbtable =
'&societe';
145$diroutputmassaction = $conf->supplier_proposal->dir_output.
'/temp/massgeneration/'.$user->id;
149$hookmanager->initHooks(array(
'supplier_proposallist'));
153$extrafields->fetch_name_optionals_label(
$object->table_element);
155$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
159$fieldstosearchall = array(
161 's.nom' =>
'Supplier',
162 'pd.description' =>
'Description',
163 'sp.note_public' =>
'NotePublic',
165if (empty($user->socid)) {
166 $fieldstosearchall[
"p.note_private"] =
"NotePrivate";
169$checkedtypetiers = 0;
171 'sp.ref' => array(
'label' => $langs->trans(
"Ref"),
'checked' => 1),
172 's.nom' => array(
'label' => $langs->trans(
"Supplier"),
'checked' => 1),
173 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' => 0),
174 's.town' => array(
'label' => $langs->trans(
"Town"),
'checked' => 1),
175 's.zip' => array(
'label' => $langs->trans(
"Zip"),
'checked' => 1),
176 'state.nom' => array(
'label' => $langs->trans(
"StateShort"),
'checked' => 0),
177 'country.code_iso' => array(
'label' => $langs->trans(
"Country"),
'checked' => 0),
178 'typent.code' => array(
'label' => $langs->trans(
"ThirdPartyType"),
'checked' => $checkedtypetiers),
179 'sp.date_valid' => array(
'label' => $langs->trans(
"DateValidation"),
'checked' => 1),
180 'sp.date_livraison' => array(
'label' => $langs->trans(
"DateEnd"),
'checked' => 1),
181 'sp.total_ht' => array(
'label' => $langs->trans(
"AmountHT"),
'checked' => 1),
182 'sp.total_tva' => array(
'label' => $langs->trans(
"AmountVAT"),
'checked' => 0),
183 'sp.total_ttc' => array(
'label' => $langs->trans(
"AmountTTC"),
'checked' => 0),
184 'sp.multicurrency_code' => array(
'label' =>
'Currency',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
185 'sp.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
186 'sp.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
187 'sp.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
188 'sp.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' => 0,
'enabled' => (!isModEnabled(
"multicurrency") ? 0 : 1)),
189 'u.login' => array(
'label' => $langs->trans(
"Author"),
'checked' => 1,
'position' => 10),
190 'sp.datec' => array(
'label' => $langs->trans(
"DateCreation"),
'checked' => 0,
'position' => 500),
191 'sp.tms' => array(
'label' => $langs->trans(
"DateModificationShort"),
'checked' => 0,
'position' => 500),
192 'sp.fk_statut' => array(
'label' => $langs->trans(
"Status"),
'checked' => 1,
'position' => 1000),
195include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
199'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
201if (!$user->hasRight(
'societe',
'client',
'voir')) {
202 $search_sale = $user->id;
207$permissiontoread = $user->hasRight(
'supplier_proposal',
'lire');
208$permissiontodelete = $user->hasRight(
'supplier_proposal',
'supprimer');
215if (
GETPOST(
'cancel',
'alpha')) {
219if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
223$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
224$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
229if (empty($reshook)) {
231 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
234 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
239 $search_societe =
'';
240 $search_societe_alias =
'';
241 $search_montant_ht =
'';
242 $search_montant_vat =
'';
243 $search_montant_ttc =
'';
244 $search_multicurrency_code =
'';
245 $search_multicurrency_tx =
'';
246 $search_multicurrency_montant_ht =
'';
247 $search_multicurrency_montant_vat =
'';
248 $search_multicurrency_montant_ttc =
'';
250 $search_product_category =
'';
255 $search_country =
'';
256 $search_type_thirdparty =
'';
257 $search_date_startday =
'';
258 $search_date_startmonth =
'';
259 $search_date_startyear =
'';
260 $search_date_endday =
'';
261 $search_date_endmonth =
'';
262 $search_date_endyear =
'';
263 $search_date_start =
'';
264 $search_date_end =
'';
265 $search_date_valid_startday =
'';
266 $search_date_valid_startmonth =
'';
267 $search_date_valid_startyear =
'';
268 $search_date_valid_endday =
'';
269 $search_date_valid_endmonth =
'';
270 $search_date_valid_endyear =
'';
271 $search_date_valid_start =
'';
272 $search_date_valid_end =
'';
277 $objectclass =
'SupplierProposal';
278 $objectlabel =
'SupplierProposals';
279 $uploaddir = $conf->supplier_proposal->dir_output;
280 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
288$form =
new Form($db);
292$companystatic =
new Societe($db);
297$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
298$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
300$title = $langs->trans(
'ListOfSupplierProposals');
301$help_url =
'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur';
307if ($search_all || $search_user > 0) {
308 $sql =
'SELECT DISTINCT';
310$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,';
311$sql .=
" typent.code as typent_code,";
312$sql .=
" state.code_departement as state_code, state.nom as state_name,";
313$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,';
314$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,';
315$sql .=
' sp.datec as date_creation, sp.tms as date_modification,';
316$sql .=
" p.rowid as project_id, p.ref as project_ref,";
317$sql .=
" u.firstname, u.lastname, u.photo, u.login, u.statut as ustatus, u.admin, u.employee, u.email as uemail";
319if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
320 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
321 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
325$parameters = array();
326$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
327$sql .= $hookmanager->resPrint;
328$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
329$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
330$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
331$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
332$sql .=
', '.MAIN_DB_PREFIX.
'supplier_proposal as sp';
333if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
334 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (sp.rowid = ef.fk_object)";
337 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'supplier_proposaldet as pd ON sp.rowid=pd.fk_supplier_proposal';
339$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON sp.fk_user_author = u.rowid';
340$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = sp.fk_projet";
341if ($search_user > 0) {
342 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as c";
343 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
345$sql .=
' WHERE sp.fk_soc = s.rowid';
346$sql .=
' AND sp.entity IN ('.getEntity(
'supplier_proposal').
')';
356if ($search_country) {
357 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
359if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
360 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
365if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
366 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
368 if ($search_societe) {
371 if ($search_societe_alias) {
376 $sql .=
natural_search(array(
'u.lastname',
'u.firstname',
'u.login'), $search_login);
378if ($search_montant_ht) {
381if ($search_montant_vat !=
'') {
384if ($search_montant_ttc !=
'') {
387if ($search_multicurrency_code !=
'') {
388 $sql .=
" AND sp.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
390if ($search_multicurrency_tx !=
'') {
391 $sql .=
natural_search(
'sp.multicurrency_tx', $search_multicurrency_tx, 1);
393if ($search_multicurrency_montant_ht !=
'') {
394 $sql .=
natural_search(
'sp.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
396if ($search_multicurrency_montant_vat !=
'') {
397 $sql .=
natural_search(
'sp.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
399if ($search_multicurrency_montant_ttc !=
'') {
400 $sql .=
natural_search(
'sp.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
403 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
406 $sql .=
' AND s.rowid = '.((int) $socid);
408if ($search_status >= 0 && $search_status !=
'') {
409 $sql .=
' AND sp.fk_statut IN ('.$db->sanitize($db->escape($search_status)).
')';
411if ($search_date_start) {
412 $sql .=
" AND sp.date_livraison >= '".$db->idate($search_date_start).
"'";
414if ($search_date_end) {
415 $sql .=
" AND sp.date_livraison <= '".$db->idate($search_date_end).
"'";
417if ($search_date_valid_start) {
418 $sql .=
" AND sp.date_valid >= '".$db->idate($search_date_valid_start).
"'";
420if ($search_date_valid_end) {
421 $sql .=
" AND sp.date_valid <= '".$db->idate($search_date_valid_end).
"'";
427if ($search_user > 0) {
428 $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);
431if ($search_sale && $search_sale !=
'-1') {
432 if ($search_sale == -2) {
433 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = sp.fk_soc)";
434 } elseif ($search_sale > 0) {
435 $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).
")";
439$searchCategoryProductOperator = -1;
440$searchCategoryProductList = array($search_product_category);
441if (!empty($searchCategoryProductList)) {
442 $searchCategoryProductSqlList = array();
443 $listofcategoryid =
'';
444 foreach ($searchCategoryProductList as $searchCategoryProduct) {
445 if (intval($searchCategoryProduct) == -2) {
446 $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)";
447 } elseif (intval($searchCategoryProduct) > 0) {
448 if ($searchCategoryProductOperator == 0) {
449 $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).
")";
451 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
455 if ($listofcategoryid) {
456 $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).
"))";
458 if ($searchCategoryProductOperator == 1) {
459 if (!empty($searchCategoryProductSqlList)) {
460 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
463 if (!empty($searchCategoryProductSqlList)) {
464 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
469include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
471$parameters = array();
472$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
473$sql .= $hookmanager->resPrint;
475$sql .= $db->order($sortfield, $sortorder);
476$sql .=
', sp.ref DESC';
479$nbtotalofrecords =
'';
481 $resql = $db->query($sql);
482 $nbtotalofrecords = $db->num_rows($resql);
483 if (($page * $limit) > $nbtotalofrecords) {
489$sql .= $db->plimit($limit + 1, $offset);
491$resql = $db->query($sql);
494 $userstatic =
new User($db);
499 $title = $langs->trans(
'SupplierProposals').
' - '.$soc->name;
501 $title = $langs->trans(
'SupplierProposals');
504 $num = $db->num_rows($resql);
506 $arrayofselected = is_array($toselect) ? $toselect : array();
508 if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
509 $obj = $db->fetch_object($resql);
513 header(
"Location: ".DOL_URL_ROOT.
'/supplier_proposal/card.php?id='.$id);
520 llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist');
524 $param .=
'&mode='.urlencode($mode);
526 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
527 $param .=
'&contextpage='.urlencode($contextpage);
529 if ($limit > 0 && $limit != $conf->liste_limit) {
530 $param .=
'&limit='.((int) $limit);
533 $param .=
'&search_all='.urlencode($search_all);
535 if ($search_date_startday) {
536 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
538 if ($search_date_startmonth) {
539 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
541 if ($search_date_startyear) {
542 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
544 if ($search_date_endday) {
545 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
547 if ($search_date_endmonth) {
548 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
550 if ($search_date_endyear) {
551 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
553 if ($search_date_valid_startday) {
554 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
556 if ($search_date_valid_startmonth) {
557 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
559 if ($search_date_valid_startyear) {
560 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
562 if ($search_date_valid_endday) {
563 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
565 if ($search_date_valid_endmonth) {
566 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
568 if ($search_date_valid_endyear) {
569 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
572 $param .=
'&search_ref='.urlencode($search_ref);
574 if ($search_societe) {
575 $param .=
'&search_societe='.urlencode($search_societe);
577 if ($search_societe_alias) {
578 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
580 if ($search_user > 0) {
581 $param .=
'&search_user='.urlencode((
string) ($search_user));
583 if ($search_sale > 0) {
584 $param .=
'&search_sale='.urlencode($search_sale);
586 if ($search_montant_ht) {
587 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
589 if ($search_multicurrency_code !=
'') {
590 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
592 if ($search_multicurrency_tx !=
'') {
593 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
595 if ($search_multicurrency_montant_ht !=
'') {
596 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
598 if ($search_multicurrency_montant_vat !=
'') {
599 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
601 if ($search_multicurrency_montant_ttc !=
'') {
602 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
605 $param .=
'&search_login='.urlencode($search_login);
608 $param .=
'&search_town='.urlencode($search_town);
611 $param .=
'&search_zip='.urlencode($search_zip);
614 $param .=
'&socid='.urlencode((
string) ($socid));
616 if ($search_status !=
'') {
617 $param .=
'&search_status='.urlencode($search_status);
619 if ($optioncss !=
'') {
620 $param .=
'&optioncss='.urlencode($optioncss);
622 if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
623 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
626 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
629 $arrayofmassactions = array(
630 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
631 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
634 if ($user->hasRight(
'supplier_proposal',
'supprimer')) {
635 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
637 if (in_array($massaction, array(
'presend',
'predelete'))) {
638 $arrayofmassactions = array();
640 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
642 $url = DOL_URL_ROOT.
'/supplier_proposal/card.php?action=create';
643 if (!empty($socid)) {
644 $url .=
'&socid='.$socid;
647 $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'));
648 $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'));
650 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewAskPrice'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'supplier_proposal',
'creer'));
653 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
654 if ($optioncss !=
'') {
655 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
657 print
'<input type="hidden" name="token" value="'.newToken().
'">';
658 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
659 print
'<input type="hidden" name="action" value="list">';
660 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
661 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
662 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
664 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'supplier_proposal', 0, $newcardbutton,
'', $limit, 0, 0, 1);
666 $topicmail =
"SendSupplierProposalRef";
667 $modelmail =
"supplier_proposal_send";
669 $trackid =
'spro'.$object->id;
670 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
673 foreach ($fieldstosearchall as $key => $val) {
674 $fieldstosearchall[$key] = $langs->trans($val);
676 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
684 if ($user->hasRight(
'user',
'user',
'lire')) {
685 $langs->load(
"commercial");
686 $moreforfilter .=
'<div class="divsearchfield">';
687 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
688 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
689 $moreforfilter .=
'</div>';
692 if ($user->hasRight(
'user',
'user',
'lire')) {
693 $moreforfilter .=
'<div class="divsearchfield">';
694 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
695 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
696 $moreforfilter .=
'</div>';
699 if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
700 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
701 $moreforfilter .=
'<div class="divsearchfield">';
702 $tmptitle = $langs->trans(
'IncludingProductWithTag');
703 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
null,
'parent',
null,
null, 1);
704 $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);
705 $moreforfilter .=
'</div>';
707 $parameters = array();
708 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
709 if (empty($reshook)) {
710 $moreforfilter .= $hookmanager->resPrint;
712 $moreforfilter = $hookmanager->resPrint;
715 if (!empty($moreforfilter)) {
716 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
717 print $moreforfilter;
721 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
722 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
723 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
725 print
'<div class="div-table-responsive">';
726 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
730 print
'<tr class="liste_titre_filter">';
733 print
'<td class="liste_titre maxwidthsearch">';
734 $searchpicto = $form->showFilterButtons(
'left');
738 if (!empty($arrayfields[
'sp.ref'][
'checked'])) {
739 print
'<td class="liste_titre">';
740 print
'<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
743 if (!empty($arrayfields[
's.nom'][
'checked'])) {
744 print
'<td class="liste_titre left">';
745 print
'<input class="flat" type="text" size="12" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'">';
748 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
749 print
'<td class="liste_titre left">';
750 print
'<input class="flat" type="text" size="12" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'">';
753 if (!empty($arrayfields[
's.town'][
'checked'])) {
754 print
'<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.
'"></td>';
756 if (!empty($arrayfields[
's.zip'][
'checked'])) {
757 print
'<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.$search_zip.
'"></td>';
760 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
761 print
'<td class="liste_titre">';
762 print
'<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
766 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
767 print
'<td class="liste_titre center">';
768 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
772 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
773 print
'<td class="liste_titre maxwidthonsmartphone center">';
774 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);
778 if (!empty($arrayfields[
'sp.date_valid'][
'checked'])) {
779 print
'<td class="liste_titre center">';
780 print
'<div class="nowrapfordate">';
781 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'));
783 print
'<div class="nowrapfordate">';
784 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'));
789 if (!empty($arrayfields[
'sp.date_livraison'][
'checked'])) {
790 print
'<td class="liste_titre center">';
791 print
'<div class="nowrapfordate">';
792 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
794 print
'<div class="nowrapfordate">';
795 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
800 if (!empty($arrayfields[
'sp.total_ht'][
'checked'])) {
802 print
'<td class="liste_titre right">';
803 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
806 if (!empty($arrayfields[
'sp.total_tva'][
'checked'])) {
808 print
'<td class="liste_titre right">';
809 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
812 if (!empty($arrayfields[
'sp.total_ttc'][
'checked'])) {
814 print
'<td class="liste_titre right">';
815 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
818 if (!empty($arrayfields[
'sp.multicurrency_code'][
'checked'])) {
820 print
'<td class="liste_titre">';
821 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
824 if (!empty($arrayfields[
'sp.multicurrency_tx'][
'checked'])) {
826 print
'<td class="liste_titre">';
827 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
830 if (!empty($arrayfields[
'sp.multicurrency_total_ht'][
'checked'])) {
832 print
'<td class="liste_titre right">';
833 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
836 if (!empty($arrayfields[
'sp.multicurrency_total_vat'][
'checked'])) {
838 print
'<td class="liste_titre right">';
839 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
842 if (!empty($arrayfields[
'sp.multicurrency_total_ttc'][
'checked'])) {
844 print
'<td class="liste_titre right">';
845 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
848 if (!empty($arrayfields[
'u.login'][
'checked'])) {
850 print
'<td class="liste_titre center">';
851 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
855 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
857 $parameters = array(
'arrayfields' => $arrayfields);
858 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
859 print $hookmanager->resPrint;
861 if (!empty($arrayfields[
'sp.datec'][
'checked'])) {
862 print
'<td class="liste_titre">';
866 if (!empty($arrayfields[
'sp.tms'][
'checked'])) {
867 print
'<td class="liste_titre">';
871 if (!empty($arrayfields[
'sp.fk_statut'][
'checked'])) {
872 print
'<td class="liste_titre center parentonrightofpage">';
873 $formpropal->selectProposalStatus($search_status, 1, 0, 1,
'supplier',
'search_status',
'search_status width100 onrightofpage');
878 print
'<td class="liste_titre maxwidthsearch">';
879 $searchpicto = $form->showFilterButtons();
886 $totalarray = array();
887 $totalarray[
'nbfield'] = 0;
890 print
'<tr class="liste_titre">';
892 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
893 $totalarray[
'nbfield']++;
895 if (!empty($arrayfields[
'sp.ref'][
'checked'])) {
896 print_liste_field_titre($arrayfields[
'sp.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.ref',
'', $param,
'', $sortfield, $sortorder);
897 $totalarray[
'nbfield']++;
899 if (!empty($arrayfields[
's.nom'][
'checked'])) {
900 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
901 $totalarray[
'nbfield']++;
903 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
904 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
905 $totalarray[
'nbfield']++;
907 if (!empty($arrayfields[
's.town'][
'checked'])) {
908 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
909 $totalarray[
'nbfield']++;
911 if (!empty($arrayfields[
's.zip'][
'checked'])) {
912 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
913 $totalarray[
'nbfield']++;
915 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
916 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
917 $totalarray[
'nbfield']++;
919 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
920 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
921 $totalarray[
'nbfield']++;
923 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
924 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
925 $totalarray[
'nbfield']++;
927 if (!empty($arrayfields[
'sp.date_valid'][
'checked'])) {
928 print_liste_field_titre($arrayfields[
'sp.date_valid'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.date_valid',
'', $param,
'', $sortfield, $sortorder,
'center ');
929 $totalarray[
'nbfield']++;
931 if (!empty($arrayfields[
'sp.date_livraison'][
'checked'])) {
932 print_liste_field_titre($arrayfields[
'sp.date_livraison'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
933 $totalarray[
'nbfield']++;
935 if (!empty($arrayfields[
'sp.total_ht'][
'checked'])) {
936 print_liste_field_titre($arrayfields[
'sp.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
937 $totalarray[
'nbfield']++;
939 if (!empty($arrayfields[
'sp.total_tva'][
'checked'])) {
940 print_liste_field_titre($arrayfields[
'sp.total_tva'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
941 $totalarray[
'nbfield']++;
943 if (!empty($arrayfields[
'sp.total_ttc'][
'checked'])) {
944 print_liste_field_titre($arrayfields[
'sp.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
945 $totalarray[
'nbfield']++;
947 if (!empty($arrayfields[
'sp.multicurrency_code'][
'checked'])) {
948 print_liste_field_titre($arrayfields[
'sp.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
949 $totalarray[
'nbfield']++;
951 if (!empty($arrayfields[
'sp.multicurrency_tx'][
'checked'])) {
952 print_liste_field_titre($arrayfields[
'sp.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
953 $totalarray[
'nbfield']++;
955 if (!empty($arrayfields[
'sp.multicurrency_total_ht'][
'checked'])) {
956 print_liste_field_titre($arrayfields[
'sp.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
957 $totalarray[
'nbfield']++;
959 if (!empty($arrayfields[
'sp.multicurrency_total_vat'][
'checked'])) {
960 print_liste_field_titre($arrayfields[
'sp.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
961 $totalarray[
'nbfield']++;
963 if (!empty($arrayfields[
'sp.multicurrency_total_ttc'][
'checked'])) {
964 print_liste_field_titre($arrayfields[
'sp.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
965 $totalarray[
'nbfield']++;
967 if (!empty($arrayfields[
'u.login'][
'checked'])) {
968 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder,
'center ');
969 $totalarray[
'nbfield']++;
972 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
974 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
975 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
976 print $hookmanager->resPrint;
977 if (!empty($arrayfields[
'sp.datec'][
'checked'])) {
978 print_liste_field_titre($arrayfields[
'sp.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
979 $totalarray[
'nbfield']++;
981 if (!empty($arrayfields[
'sp.tms'][
'checked'])) {
982 print_liste_field_titre($arrayfields[
'sp.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap');
983 $totalarray[
'nbfield']++;
985 if (!empty($arrayfields[
'sp.fk_statut'][
'checked'])) {
986 print_liste_field_titre($arrayfields[
'sp.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
987 $totalarray[
'nbfield']++;
991 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
992 $totalarray[
'nbfield']++;
1000 $savnbfield = $totalarray[
'nbfield'];
1001 $totalarray = array();
1002 $totalarray[
'nbfield'] = 0;
1003 $totalarray[
'val'] = array();
1004 $totalarray[
'val'][
'sp.total_ht'] = 0;
1005 $totalarray[
'val'][
'sp.total_tva'] = 0;
1006 $totalarray[
'val'][
'sp.total_ttc'] = 0;
1008 $imaxinloop = ($limit ? min($num, $limit) : $num);
1009 while ($i < $imaxinloop) {
1010 $obj = $db->fetch_object($resql);
1012 $objectstatic->id = $obj->rowid;
1013 $objectstatic->ref = $obj->ref;
1014 $objectstatic->note_public = $obj->note_public;
1015 $objectstatic->note_private = $obj->note_private;
1016 $objectstatic->status = $obj->status;
1019 $companystatic->id = $obj->socid;
1020 $companystatic->name = $obj->name;
1021 $companystatic->name_alias = $obj->alias;
1022 $companystatic->client = $obj->client;
1023 $companystatic->code_client = $obj->code_client;
1025 if ($mode ==
'kanban') {
1027 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1028 print
'<div class="box-flex-container kanban">';
1032 $userstatic->fetch($obj->fk_user_author);
1033 $objectstatic->delivery_date = $obj->dp;
1034 print $objectstatic->getKanbanView(
'', array(
'thirdparty' => $companystatic,
'userauthor' => $userstatic,
'selected' => in_array($obj->rowid, $arrayofselected)));
1035 if ($i == ($imaxinloop - 1)) {
1040 print
'<tr class="oddeven">';
1043 print
'<td class="nowrap center">';
1044 if ($massactionbutton || $massaction) {
1046 if (in_array($obj->rowid, $arrayofselected)) {
1049 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1053 if (!empty($arrayfields[
'sp.ref'][
'checked'])) {
1054 print
'<td class="nowraponall">';
1056 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1058 print
'<td class="nobordernopadding nowraponall">';
1059 print $objectstatic->getNomUrl(1,
'',
'', 0, -1, 1);
1065 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
1070 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
1073 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1074 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1075 print
'</td></tr></table>';
1079 $totalarray[
'nbfield']++;
1084 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1085 print
'<td class="tdoverflowmax200">';
1086 print $companystatic->getNomUrl(1,
'supplier', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1089 $totalarray[
'nbfield']++;
1094 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1095 print
'<td class="tdoverflowmax200">';
1096 print $companystatic->name_alias;
1099 $totalarray[
'nbfield']++;
1104 if (!empty($arrayfields[
's.town'][
'checked'])) {
1105 print
'<td class="nocellnopadd">';
1109 $totalarray[
'nbfield']++;
1113 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1114 print
'<td class="nocellnopadd">';
1118 $totalarray[
'nbfield']++;
1122 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1123 print
"<td>".$obj->state_name.
"</td>\n";
1125 $totalarray[
'nbfield']++;
1129 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1130 print
'<td class="center">';
1131 $tmparray =
getCountry($obj->fk_pays,
'all');
1132 print $tmparray[
'label'];
1135 $totalarray[
'nbfield']++;
1139 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1140 print
'<td class="center">';
1141 if (empty($typenArray) || !is_array($typenArray) || count($typenArray) == 0) {
1142 $typenArray = $formcompany->typent_array(1);
1144 print $typenArray[$obj->typent_code];
1147 $totalarray[
'nbfield']++;
1152 if (!empty($arrayfields[
'sp.date_valid'][
'checked'])) {
1153 print
'<td class="center">';
1157 $totalarray[
'nbfield']++;
1162 if (!empty($arrayfields[
'sp.date_livraison'][
'checked'])) {
1163 print
'<td class="center">';
1167 $totalarray[
'nbfield']++;
1172 if (!empty($arrayfields[
'sp.total_ht'][
'checked'])) {
1173 print
'<td class="right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
1175 $totalarray[
'nbfield']++;
1178 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'sp.total_ht';
1180 $totalarray[
'val'][
'sp.total_ht'] += $obj->total_ht;
1183 if (!empty($arrayfields[
'sp.total_tva'][
'checked'])) {
1184 print
'<td class="right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
1186 $totalarray[
'nbfield']++;
1189 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'sp.total_tva';
1191 $totalarray[
'val'][
'sp.total_tva'] += $obj->total_tva;
1194 if (!empty($arrayfields[
'sp.total_ttc'][
'checked'])) {
1195 print
'<td class="right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
1197 $totalarray[
'nbfield']++;
1200 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'sp.total_ttc';
1202 $totalarray[
'val'][
'sp.total_ttc'] += $obj->total_ttc;
1206 if (!empty($arrayfields[
'sp.multicurrency_code'][
'checked'])) {
1207 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
1209 $totalarray[
'nbfield']++;
1214 if (!empty($arrayfields[
'sp.multicurrency_tx'][
'checked'])) {
1215 print
'<td class="nowrap">';
1216 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
1219 $totalarray[
'nbfield']++;
1223 if (!empty($arrayfields[
'sp.multicurrency_total_ht'][
'checked'])) {
1224 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
1226 $totalarray[
'nbfield']++;
1230 if (!empty($arrayfields[
'sp.multicurrency_total_vat'][
'checked'])) {
1231 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
1233 $totalarray[
'nbfield']++;
1237 if (!empty($arrayfields[
'sp.multicurrency_total_ttc'][
'checked'])) {
1238 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
1240 $totalarray[
'nbfield']++;
1244 $userstatic->id = $obj->fk_user_author;
1245 $userstatic->login = $obj->login;
1246 $userstatic->status = $obj->ustatus;
1247 $userstatic->lastname = $obj->name;
1248 $userstatic->firstname = $obj->firstname;
1249 $userstatic->photo = $obj->photo;
1250 $userstatic->admin = $obj->admin;
1251 $userstatic->ref = $obj->fk_user_author;
1252 $userstatic->employee = $obj->employee;
1253 $userstatic->email = $obj->uemail;
1256 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1257 print
'<td class="tdoverflowmax125">';
1258 if ($userstatic->id > 0) {
1259 print $userstatic->getNomUrl(-1,
'', 0, 0, 24, 1,
'login',
'', 1);
1263 $totalarray[
'nbfield']++;
1268 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1270 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1271 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1272 print $hookmanager->resPrint;
1274 if (!empty($arrayfields[
'sp.datec'][
'checked'])) {
1275 print
'<td class="center nowraponall">';
1276 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1279 $totalarray[
'nbfield']++;
1283 if (!empty($arrayfields[
'sp.tms'][
'checked'])) {
1284 print
'<td class="center nowraponall">';
1285 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
1288 $totalarray[
'nbfield']++;
1292 if (!empty($arrayfields[
'sp.fk_statut'][
'checked'])) {
1293 print
'<td class="center">'.$objectstatic->getLibStatut(5).
"</td>\n";
1295 $totalarray[
'nbfield']++;
1301 print
'<td class="nowrap center">';
1302 if ($massactionbutton || $massaction) {
1304 if (in_array($obj->rowid, $arrayofselected)) {
1307 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1312 $totalarray[
'nbfield']++;
1317 $total += $obj->total_ht;
1318 $subtotal += $obj->total_ht;
1324 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1329 foreach ($arrayfields as $key => $val) {
1330 if (!empty($val[
'checked'])) {
1334 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1339 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1340 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
1341 print $hookmanager->resPrint;
1343 print
'</table>'.
"\n";
1344 print
'</div>'.
"\n";
1346 print
'</form>'.
"\n";
1348 $hidegeneratedfilelistifempty = 1;
1349 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1350 $hidegeneratedfilelistifempty = 0;
1354 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1355 $urlsource .= str_replace(
'&',
'&', $param);
1357 $filedir = $diroutputmassaction;
1359 $genallowed = $user->hasRight(
'supplier_proposal',
'lire');
1360 $delallowed = $user->hasRight(
'supplier_proposal',
'creer');
1362 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()
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...
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.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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 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.