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 mod-supplierproposal page-list');
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'])) {
905 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
906 $totalarray[
'nbfield']++;
908 if (!empty($arrayfields[
's.town'][
'checked'])) {
909 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
910 $totalarray[
'nbfield']++;
912 if (!empty($arrayfields[
's.zip'][
'checked'])) {
913 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
914 $totalarray[
'nbfield']++;
916 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
917 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
918 $totalarray[
'nbfield']++;
920 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
921 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
922 $totalarray[
'nbfield']++;
924 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
925 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
926 $totalarray[
'nbfield']++;
928 if (!empty($arrayfields[
'sp.date_valid'][
'checked'])) {
929 print_liste_field_titre($arrayfields[
'sp.date_valid'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.date_valid',
'', $param,
'', $sortfield, $sortorder,
'center ');
930 $totalarray[
'nbfield']++;
932 if (!empty($arrayfields[
'sp.date_livraison'][
'checked'])) {
933 print_liste_field_titre($arrayfields[
'sp.date_livraison'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
934 $totalarray[
'nbfield']++;
936 if (!empty($arrayfields[
'sp.total_ht'][
'checked'])) {
937 print_liste_field_titre($arrayfields[
'sp.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
938 $totalarray[
'nbfield']++;
940 if (!empty($arrayfields[
'sp.total_tva'][
'checked'])) {
941 print_liste_field_titre($arrayfields[
'sp.total_tva'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
942 $totalarray[
'nbfield']++;
944 if (!empty($arrayfields[
'sp.total_ttc'][
'checked'])) {
945 print_liste_field_titre($arrayfields[
'sp.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
946 $totalarray[
'nbfield']++;
948 if (!empty($arrayfields[
'sp.multicurrency_code'][
'checked'])) {
949 print_liste_field_titre($arrayfields[
'sp.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
950 $totalarray[
'nbfield']++;
952 if (!empty($arrayfields[
'sp.multicurrency_tx'][
'checked'])) {
953 print_liste_field_titre($arrayfields[
'sp.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
954 $totalarray[
'nbfield']++;
956 if (!empty($arrayfields[
'sp.multicurrency_total_ht'][
'checked'])) {
957 print_liste_field_titre($arrayfields[
'sp.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
958 $totalarray[
'nbfield']++;
960 if (!empty($arrayfields[
'sp.multicurrency_total_vat'][
'checked'])) {
961 print_liste_field_titre($arrayfields[
'sp.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
962 $totalarray[
'nbfield']++;
964 if (!empty($arrayfields[
'sp.multicurrency_total_ttc'][
'checked'])) {
965 print_liste_field_titre($arrayfields[
'sp.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
966 $totalarray[
'nbfield']++;
968 if (!empty($arrayfields[
'u.login'][
'checked'])) {
969 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder,
'center ');
970 $totalarray[
'nbfield']++;
973 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
975 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
976 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
977 print $hookmanager->resPrint;
978 if (!empty($arrayfields[
'sp.datec'][
'checked'])) {
979 print_liste_field_titre($arrayfields[
'sp.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
980 $totalarray[
'nbfield']++;
982 if (!empty($arrayfields[
'sp.tms'][
'checked'])) {
983 print_liste_field_titre($arrayfields[
'sp.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap');
984 $totalarray[
'nbfield']++;
986 if (!empty($arrayfields[
'sp.fk_statut'][
'checked'])) {
987 print_liste_field_titre($arrayfields[
'sp.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
988 $totalarray[
'nbfield']++;
992 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
993 $totalarray[
'nbfield']++;
1001 $savnbfield = $totalarray[
'nbfield'];
1002 $totalarray = array();
1003 $totalarray[
'nbfield'] = 0;
1004 $totalarray[
'val'] = array();
1005 $totalarray[
'val'][
'sp.total_ht'] = 0;
1006 $totalarray[
'val'][
'sp.total_tva'] = 0;
1007 $totalarray[
'val'][
'sp.total_ttc'] = 0;
1009 $imaxinloop = ($limit ? min($num, $limit) : $num);
1010 while ($i < $imaxinloop) {
1011 $obj = $db->fetch_object($resql);
1013 $objectstatic->id = $obj->rowid;
1014 $objectstatic->ref = $obj->ref;
1015 $objectstatic->note_public = $obj->note_public;
1016 $objectstatic->note_private = $obj->note_private;
1017 $objectstatic->status = $obj->status;
1020 $companystatic->id = $obj->socid;
1021 $companystatic->name = $obj->name;
1022 $companystatic->name_alias = $obj->alias;
1023 $companystatic->client = $obj->client;
1024 $companystatic->code_client = $obj->code_client;
1026 if ($mode ==
'kanban') {
1028 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1029 print
'<div class="box-flex-container kanban">';
1033 $userstatic->fetch($obj->fk_user_author);
1034 $objectstatic->delivery_date = $obj->dp;
1035 print $objectstatic->getKanbanView(
'', array(
'thirdparty' => $companystatic,
'userauthor' => $userstatic,
'selected' => in_array($obj->rowid, $arrayofselected)));
1036 if ($i == ($imaxinloop - 1)) {
1041 print
'<tr class="oddeven '.((getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->status > 1) ?
'opacitymedium' :
'').
'">';
1044 print
'<td class="nowrap center">';
1045 if ($massactionbutton || $massaction) {
1047 if (in_array($obj->rowid, $arrayofselected)) {
1050 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1054 if (!empty($arrayfields[
'sp.ref'][
'checked'])) {
1055 print
'<td class="nowraponall">';
1057 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1059 print
'<td class="nobordernopadding nowraponall">';
1060 print $objectstatic->getNomUrl(1,
'',
'', 0, -1, 1);
1066 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
1071 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
1074 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1075 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1076 print
'</td></tr></table>';
1080 $totalarray[
'nbfield']++;
1085 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1086 print
'<td class="tdoverflowmax200">';
1087 print $companystatic->getNomUrl(1,
'supplier', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1090 $totalarray[
'nbfield']++;
1095 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1096 print
'<td class="tdoverflowmax200">';
1097 print $companystatic->name_alias;
1100 $totalarray[
'nbfield']++;
1105 if (!empty($arrayfields[
's.town'][
'checked'])) {
1106 print
'<td class="nocellnopadd">';
1110 $totalarray[
'nbfield']++;
1114 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1115 print
'<td class="nocellnopadd">';
1119 $totalarray[
'nbfield']++;
1123 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1124 print
"<td>".$obj->state_name.
"</td>\n";
1126 $totalarray[
'nbfield']++;
1130 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1131 print
'<td class="center">';
1132 $tmparray =
getCountry($obj->fk_pays,
'all');
1133 print $tmparray[
'label'];
1136 $totalarray[
'nbfield']++;
1140 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1141 print
'<td class="center">';
1142 if (empty($typenArray) || !is_array($typenArray) || count($typenArray) == 0) {
1143 $typenArray = $formcompany->typent_array(1);
1145 print $typenArray[$obj->typent_code];
1148 $totalarray[
'nbfield']++;
1153 if (!empty($arrayfields[
'sp.date_valid'][
'checked'])) {
1154 print
'<td class="center">';
1158 $totalarray[
'nbfield']++;
1163 if (!empty($arrayfields[
'sp.date_livraison'][
'checked'])) {
1164 print
'<td class="center">';
1168 $totalarray[
'nbfield']++;
1173 if (!empty($arrayfields[
'sp.total_ht'][
'checked'])) {
1174 print
'<td class="right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
1176 $totalarray[
'nbfield']++;
1179 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'sp.total_ht';
1181 $totalarray[
'val'][
'sp.total_ht'] += $obj->total_ht;
1184 if (!empty($arrayfields[
'sp.total_tva'][
'checked'])) {
1185 print
'<td class="right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
1187 $totalarray[
'nbfield']++;
1190 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'sp.total_tva';
1192 $totalarray[
'val'][
'sp.total_tva'] += $obj->total_tva;
1195 if (!empty($arrayfields[
'sp.total_ttc'][
'checked'])) {
1196 print
'<td class="right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
1198 $totalarray[
'nbfield']++;
1201 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'sp.total_ttc';
1203 $totalarray[
'val'][
'sp.total_ttc'] += $obj->total_ttc;
1207 if (!empty($arrayfields[
'sp.multicurrency_code'][
'checked'])) {
1208 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
1210 $totalarray[
'nbfield']++;
1215 if (!empty($arrayfields[
'sp.multicurrency_tx'][
'checked'])) {
1216 print
'<td class="nowrap">';
1217 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
1220 $totalarray[
'nbfield']++;
1224 if (!empty($arrayfields[
'sp.multicurrency_total_ht'][
'checked'])) {
1225 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
1227 $totalarray[
'nbfield']++;
1231 if (!empty($arrayfields[
'sp.multicurrency_total_vat'][
'checked'])) {
1232 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
1234 $totalarray[
'nbfield']++;
1238 if (!empty($arrayfields[
'sp.multicurrency_total_ttc'][
'checked'])) {
1239 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
1241 $totalarray[
'nbfield']++;
1245 $userstatic->id = $obj->fk_user_author;
1246 $userstatic->login = $obj->login;
1247 $userstatic->status = $obj->ustatus;
1248 $userstatic->lastname = $obj->name;
1249 $userstatic->firstname = $obj->firstname;
1250 $userstatic->photo = $obj->photo;
1251 $userstatic->admin = $obj->admin;
1252 $userstatic->ref = $obj->fk_user_author;
1253 $userstatic->employee = $obj->employee;
1254 $userstatic->email = $obj->uemail;
1257 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1258 print
'<td class="tdoverflowmax125">';
1259 if ($userstatic->id > 0) {
1260 print $userstatic->getNomUrl(-1,
'', 0, 0, 24, 1,
'login',
'', 1);
1264 $totalarray[
'nbfield']++;
1269 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1271 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1272 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1273 print $hookmanager->resPrint;
1275 if (!empty($arrayfields[
'sp.datec'][
'checked'])) {
1276 print
'<td class="center nowraponall">';
1277 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1280 $totalarray[
'nbfield']++;
1284 if (!empty($arrayfields[
'sp.tms'][
'checked'])) {
1285 print
'<td class="center nowraponall">';
1286 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
1289 $totalarray[
'nbfield']++;
1293 if (!empty($arrayfields[
'sp.fk_statut'][
'checked'])) {
1294 print
'<td class="center">'.$objectstatic->getLibStatut(5).
"</td>\n";
1296 $totalarray[
'nbfield']++;
1302 print
'<td class="nowrap center">';
1303 if ($massactionbutton || $massaction) {
1305 if (in_array($obj->rowid, $arrayofselected)) {
1308 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1313 $totalarray[
'nbfield']++;
1318 $total += $obj->total_ht;
1319 $subtotal += $obj->total_ht;
1325 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1330 foreach ($arrayfields as $key => $val) {
1331 if (!empty($val[
'checked'])) {
1335 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1340 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1341 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
1342 print $hookmanager->resPrint;
1344 print
'</table>'.
"\n";
1345 print
'</div>'.
"\n";
1347 print
'</form>'.
"\n";
1349 $hidegeneratedfilelistifempty = 1;
1350 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1351 $hidegeneratedfilelistifempty = 0;
1355 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1356 $urlsource .= str_replace(
'&',
'&', $param);
1358 $filedir = $diroutputmassaction;
1360 $genallowed = $user->hasRight(
'supplier_proposal',
'lire');
1361 $delallowed = $user->hasRight(
'supplier_proposal',
'creer');
1363 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.
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.
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.