37require
'../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formpropal.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
45if (isModEnabled(
'project')) {
46 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
50$langs->loadLangs(array(
'companies',
'propal',
'supplier_proposal',
'compta',
'bills',
'orders',
'products'));
52$socid =
GETPOST(
'socid',
'int');
54$action =
GETPOST(
'action',
'aZ09');
55$massaction =
GETPOST(
'massaction',
'alpha');
56$show_files =
GETPOST(
'show_files',
'int');
57$confirm =
GETPOST(
'confirm',
'alpha');
58$toselect =
GETPOST(
'toselect',
'array');
59$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'supplierproposallist';
60$mode =
GETPOST(
'mode',
'alpha');
62$search_user =
GETPOST(
'search_user',
'int');
63$search_sale =
GETPOST(
'search_sale',
'int');
65$search_societe =
GETPOST(
'search_societe',
'alpha');
66$search_societe_alias =
GETPOST(
'search_societe_alias',
'alpha');
67$search_login =
GETPOST(
'search_login',
'alpha');
68$search_town =
GETPOST(
'search_town',
'alpha');
69$search_zip =
GETPOST(
'search_zip',
'alpha');
70$search_state =
GETPOST(
"search_state");
71$search_country =
GETPOST(
"search_country",
'int');
72$search_date_startday =
GETPOST(
'search_date_startday',
'int');
73$search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
74$search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
75$search_date_endday =
GETPOST(
'search_date_endday',
'int');
76$search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
77$search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
78$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
79$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
80$search_date_valid_startday =
GETPOST(
'search_date_valid_startday',
'int');
81$search_date_valid_startmonth =
GETPOST(
'search_date_valid_startmonth',
'int');
82$search_date_valid_startyear =
GETPOST(
'search_date_valid_startyear',
'int');
83$search_date_valid_endday =
GETPOST(
'search_date_valid_endday',
'int');
84$search_date_valid_endmonth =
GETPOST(
'search_date_valid_endmonth',
'int');
85$search_date_valid_endyear =
GETPOST(
'search_date_valid_endyear',
'int');
86$search_date_valid_start =
dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear);
87$search_date_valid_end =
dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear);
88$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'int');
89$search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
90$search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
91$search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
92$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
93$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
94$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
95$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
96$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
97$search_status =
GETPOST(
'search_status',
'int');
98$search_product_category =
GETPOST(
'search_product_category',
'int');
100$object_statut = $db->escape(
GETPOST(
'supplier_proposal_statut'));
101$search_btn =
GETPOST(
'button_search',
'alpha');
102$search_remove_btn =
GETPOST(
'button_removefilter',
'alpha');
104$sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
108$optioncss =
GETPOST(
'optioncss',
'alpha');
109$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
110$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
111$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
112$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
113if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction ===
'0')) {
116$offset = $limit * $page;
117$pageprev = $page - 1;
118$pagenext = $page + 1;
120 $sortfield =
'sp.date_livraison';
126if ($object_statut !=
'') {
127 $search_status = $object_statut;
134$module =
'supplier_proposal';
137if (!empty($user->socid)) {
138 $socid = $user->socid;
143 $dbtable =
'&societe';
146$diroutputmassaction = $conf->supplier_proposal->dir_output.
'/temp/massgeneration/'.$user->id;
150$hookmanager->initHooks(array(
'supplier_proposallist'));
154$extrafields->fetch_name_optionals_label($object->table_element);
156$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
160$fieldstosearchall = array(
163 'pd.description'=>
'Description',
164 'sp.note_public'=>
'NotePublic',
166if (empty($user->socid)) {
167 $fieldstosearchall[
"p.note_private"] =
"NotePrivate";
170$checkedtypetiers = 0;
172 'sp.ref'=>array(
'label'=>$langs->trans(
"Ref"),
'checked'=>1),
173 's.nom'=>array(
'label'=>$langs->trans(
"Supplier"),
'checked'=>1),
174 's.name_alias'=>array(
'label'=>
"AliasNameShort",
'checked'=>0),
175 's.town'=>array(
'label'=>$langs->trans(
"Town"),
'checked'=>1),
176 's.zip'=>array(
'label'=>$langs->trans(
"Zip"),
'checked'=>1),
177 'state.nom'=>array(
'label'=>$langs->trans(
"StateShort"),
'checked'=>0),
178 'country.code_iso'=>array(
'label'=>$langs->trans(
"Country"),
'checked'=>0),
179 'typent.code'=>array(
'label'=>$langs->trans(
"ThirdPartyType"),
'checked'=>$checkedtypetiers),
180 'sp.date_valid'=>array(
'label'=>$langs->trans(
"DateValidation"),
'checked'=>1),
181 'sp.date_livraison'=>array(
'label'=>$langs->trans(
"DateEnd"),
'checked'=>1),
182 'sp.total_ht'=>array(
'label'=>$langs->trans(
"AmountHT"),
'checked'=>1),
183 'sp.total_tva'=>array(
'label'=>$langs->trans(
"AmountVAT"),
'checked'=>0),
184 'sp.total_ttc'=>array(
'label'=>$langs->trans(
"AmountTTC"),
'checked'=>0),
185 'sp.multicurrency_code'=>array(
'label'=>
'Currency',
'checked'=>0,
'enabled'=>(!isModEnabled(
"multicurrency") ? 0 : 1)),
186 'sp.multicurrency_tx'=>array(
'label'=>
'CurrencyRate',
'checked'=>0,
'enabled'=>(!isModEnabled(
"multicurrency") ? 0 : 1)),
187 'sp.multicurrency_total_ht'=>array(
'label'=>
'MulticurrencyAmountHT',
'checked'=>0,
'enabled'=>(!isModEnabled(
"multicurrency") ? 0 : 1)),
188 'sp.multicurrency_total_vat'=>array(
'label'=>
'MulticurrencyAmountVAT',
'checked'=>0,
'enabled'=>(!isModEnabled(
"multicurrency") ? 0 : 1)),
189 'sp.multicurrency_total_ttc'=>array(
'label'=>
'MulticurrencyAmountTTC',
'checked'=>0,
'enabled'=>(!isModEnabled(
"multicurrency") ? 0 : 1)),
190 'u.login'=>array(
'label'=>$langs->trans(
"Author"),
'checked'=>1,
'position'=>10),
191 'sp.datec'=>array(
'label'=>$langs->trans(
"DateCreation"),
'checked'=>0,
'position'=>500),
192 'sp.tms'=>array(
'label'=>$langs->trans(
"DateModificationShort"),
'checked'=>0,
'position'=>500),
193 'sp.fk_statut'=>array(
'label'=>$langs->trans(
"Status"),
'checked'=>1,
'position'=>1000),
196include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
203$permissiontoread = $user->rights->supplier_proposal->lire;
204$permissiontodelete = $user->rights->supplier_proposal->supprimer;
211if (
GETPOST(
'cancel',
'alpha')) {
215if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
219$parameters = array(
'socid'=>$socid);
220$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
225if (empty($reshook)) {
227 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
230 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
235 $search_societe =
'';
236 $search_societe_alias =
'';
237 $search_montant_ht =
'';
238 $search_montant_vat =
'';
239 $search_montant_ttc =
'';
240 $search_multicurrency_code =
'';
241 $search_multicurrency_tx =
'';
242 $search_multicurrency_montant_ht =
'';
243 $search_multicurrency_montant_vat =
'';
244 $search_multicurrency_montant_ttc =
'';
246 $search_product_category =
'';
251 $search_country =
'';
252 $search_type_thirdparty =
'';
253 $search_date_startday =
'';
254 $search_date_startmonth =
'';
255 $search_date_startyear =
'';
256 $search_date_endday =
'';
257 $search_date_endmonth =
'';
258 $search_date_endyear =
'';
259 $search_date_start =
'';
260 $search_date_end =
'';
261 $search_date_valid_startday =
'';
262 $search_date_valid_startmonth =
'';
263 $search_date_valid_startyear =
'';
264 $search_date_valid_endday =
'';
265 $search_date_valid_endmonth =
'';
266 $search_date_valid_endyear =
'';
267 $search_date_valid_start =
'';
268 $search_date_valid_end =
'';
273 $objectclass =
'SupplierProposal';
274 $objectlabel =
'SupplierProposals';
275 $uploaddir = $conf->supplier_proposal->dir_output;
276 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
284$form =
new Form($db);
288$companystatic =
new Societe($db);
293$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
294$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
296$title = $langs->trans(
'ListOfSupplierProposals');
297$help_url =
'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur';
303if ($sall || $search_user > 0) {
304 $sql =
'SELECT DISTINCT';
306$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,';
307$sql .=
" typent.code as typent_code,";
308$sql .=
" state.code_departement as state_code, state.nom as state_name,";
309$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,';
310$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,';
311$sql .=
' sp.datec as date_creation, sp.tms as date_update,';
312$sql .=
" p.rowid as project_id, p.ref as project_ref,";
313if (empty($user->rights->societe->client->voir) && !$socid) {
314 $sql .=
" sc.fk_soc, sc.fk_user,";
316$sql .=
" u.firstname, u.lastname, u.photo, u.login, u.statut as ustatus, u.admin, u.employee, u.email as uemail";
318if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
319 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
320 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
324$parameters = array();
325$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
326$sql .= $hookmanager->resPrint;
327$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
328$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
329$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
330$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
331$sql .=
', '.MAIN_DB_PREFIX.
'supplier_proposal as sp';
332if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
333 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (sp.rowid = ef.fk_object)";
336 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'supplier_proposaldet as pd ON sp.rowid=pd.fk_supplier_proposal';
338$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON sp.fk_user_author = u.rowid';
339$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = sp.fk_projet";
341if ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid)) {
342 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
344if ($search_user > 0) {
345 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as c";
346 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
348$sql .=
' WHERE sp.fk_soc = s.rowid';
349$sql .=
' AND sp.entity IN ('.getEntity(
'supplier_proposal').
')';
350if (empty($user->rights->societe->client->voir) && !$socid) {
351 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
362if ($search_country) {
363 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
365if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
366 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
371if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
372 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
374 if ($search_societe) {
377 if ($search_societe_alias) {
382 $sql .=
natural_search(array(
'u.lastname',
'u.firstname',
'u.login'), $search_login);
384if ($search_montant_ht) {
387if ($search_montant_vat !=
'') {
390if ($search_montant_ttc !=
'') {
393if ($search_multicurrency_code !=
'') {
394 $sql .=
" AND sp.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
396if ($search_multicurrency_tx !=
'') {
397 $sql .=
natural_search(
'sp.multicurrency_tx', $search_multicurrency_tx, 1);
399if ($search_multicurrency_montant_ht !=
'') {
400 $sql .=
natural_search(
'sp.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
402if ($search_multicurrency_montant_vat !=
'') {
403 $sql .=
natural_search(
'sp.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
405if ($search_multicurrency_montant_ttc !=
'') {
406 $sql .=
natural_search(
'sp.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
412 $sql .=
' AND s.rowid = '.((int) $socid);
414if ($search_status >= 0 && $search_status !=
'') {
415 $sql .=
' AND sp.fk_statut IN ('.$db->sanitize($db->escape($search_status)).
')';
417if ($search_date_start) {
418 $sql .=
" AND sp.date_livraison >= '".$db->idate($search_date_start).
"'";
420if ($search_date_end) {
421 $sql .=
" AND sp.date_livraison <= '".$db->idate($search_date_end).
"'";
423if ($search_date_valid_start) {
424 $sql .=
" AND sp.date_valid >= '".$db->idate($search_date_valid_start).
"'";
426if ($search_date_valid_end) {
427 $sql .=
" AND sp.date_valid <= '".$db->idate($search_date_valid_end).
"'";
429if ($search_sale > 0) {
430 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
432if ($search_user > 0) {
433 $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);
436$searchCategoryProductOperator = -1;
437$searchCategoryProductList = array($search_product_category);
438if (!empty($searchCategoryProductList)) {
439 $searchCategoryProductSqlList = array();
440 $listofcategoryid =
'';
441 foreach ($searchCategoryProductList as $searchCategoryProduct) {
442 if (intval($searchCategoryProduct) == -2) {
443 $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)";
444 } elseif (intval($searchCategoryProduct) > 0) {
445 if ($searchCategoryProductOperator == 0) {
446 $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).
")";
448 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
452 if ($listofcategoryid) {
453 $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).
"))";
455 if ($searchCategoryProductOperator == 1) {
456 if (!empty($searchCategoryProductSqlList)) {
457 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
460 if (!empty($searchCategoryProductSqlList)) {
461 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
466include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
468$parameters = array();
469$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
470$sql .= $hookmanager->resPrint;
472$sql .= $db->order($sortfield, $sortorder);
473$sql .=
', sp.ref DESC';
476$nbtotalofrecords =
'';
478 $resql = $db->query($sql);
479 $nbtotalofrecords = $db->num_rows($resql);
480 if (($page * $limit) > $nbtotalofrecords) {
486$sql .= $db->plimit($limit + 1, $offset);
488$resql = $db->query($sql);
491 $userstatic =
new User($db);
496 $title = $langs->trans(
'SupplierProposals').
' - '.$soc->name;
498 $title = $langs->trans(
'SupplierProposals');
501 $num = $db->num_rows($resql);
503 $arrayofselected = is_array($toselect) ? $toselect : array();
505 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
506 $obj = $db->fetch_object($resql);
510 header(
"Location: ".DOL_URL_ROOT.
'/supplier_proposal/card.php?id='.$id);
521 $param .=
'&mode='.urlencode($mode);
523 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
524 $param .=
'&contextpage='.urlencode($contextpage);
526 if ($limit > 0 && $limit != $conf->liste_limit) {
527 $param .=
'&limit='.((int) $limit);
530 $param .=
'&sall='.urlencode($sall);
532 if ($search_date_startday) {
533 $param .=
'&search_date_startday='.urlencode($search_date_startday);
535 if ($search_date_startmonth) {
536 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
538 if ($search_date_startyear) {
539 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
541 if ($search_date_endday) {
542 $param .=
'&search_date_endday='.urlencode($search_date_endday);
544 if ($search_date_endmonth) {
545 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
547 if ($search_date_endyear) {
548 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
550 if ($search_date_valid_startday) {
551 $param .=
'&search_date_valid_startday='.urlencode($search_date_valid_startday);
553 if ($search_date_valid_startmonth) {
554 $param .=
'&search_date_valid_startmonth='.urlencode($search_date_valid_startmonth);
556 if ($search_date_valid_startyear) {
557 $param .=
'&search_date_valid_startyear='.urlencode($search_date_valid_startyear);
559 if ($search_date_valid_endday) {
560 $param .=
'&search_date_valid_endday='.urlencode($search_date_valid_endday);
562 if ($search_date_valid_endmonth) {
563 $param .=
'&search_date_valid_endmonth='.urlencode($search_date_valid_endmonth);
565 if ($search_date_valid_endyear) {
566 $param .=
'&search_date_valid_endyear='.urlencode($search_date_valid_endyear);
569 $param .=
'&search_ref='.urlencode($search_ref);
571 if ($search_societe) {
572 $param .=
'&search_societe='.urlencode($search_societe);
574 if ($search_societe_alias) {
575 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
577 if ($search_user > 0) {
578 $param .=
'&search_user='.urlencode($search_user);
580 if ($search_sale > 0) {
581 $param .=
'&search_sale='.urlencode($search_sale);
583 if ($search_montant_ht) {
584 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
586 if ($search_multicurrency_code !=
'') {
587 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
589 if ($search_multicurrency_tx !=
'') {
590 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
592 if ($search_multicurrency_montant_ht !=
'') {
593 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
595 if ($search_multicurrency_montant_vat !=
'') {
596 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
598 if ($search_multicurrency_montant_ttc !=
'') {
599 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
602 $param .=
'&search_login='.urlencode($search_login);
605 $param .=
'&search_town='.urlencode($search_town);
608 $param .=
'&search_zip='.urlencode($search_zip);
611 $param .=
'&socid='.urlencode($socid);
613 if ($search_status !=
'') {
614 $param .=
'&search_status='.urlencode($search_status);
616 if ($optioncss !=
'') {
617 $param .=
'&optioncss='.urlencode($optioncss);
619 if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
620 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
623 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
626 $arrayofmassactions = array(
627 'generate_doc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
628 'builddoc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
631 if ($user->rights->supplier_proposal->supprimer) {
632 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
634 if (in_array($massaction, array(
'presend',
'predelete'))) {
635 $arrayofmassactions = array();
637 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
639 $url = DOL_URL_ROOT.
'/supplier_proposal/card.php?action=create';
640 if (!empty($socid)) {
641 $url .=
'&socid='.$socid;
644 $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'));
645 $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'));
646 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewAskPrice'),
'',
'fa fa-plus-circle', $url,
'', $user->rights->supplier_proposal->creer);
649 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
650 if ($optioncss !=
'') {
651 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
653 print
'<input type="hidden" name="token" value="'.newToken().
'">';
654 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
655 print
'<input type="hidden" name="action" value="list">';
656 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
657 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
658 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
660 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'supplier_proposal', 0, $newcardbutton,
'', $limit, 0, 0, 1);
662 $topicmail =
"SendSupplierProposalRef";
663 $modelmail =
"supplier_proposal_send";
665 $trackid =
'spro'.$object->id;
666 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
669 foreach ($fieldstosearchall as $key => $val) {
670 $fieldstosearchall[$key] = $langs->trans($val);
672 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
680 if ($user->rights->user->user->lire) {
681 $langs->load(
"commercial");
682 $moreforfilter .=
'<div class="divsearchfield">';
683 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
684 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
685 $moreforfilter .=
'</div>';
688 if ($user->rights->user->user->lire) {
689 $moreforfilter .=
'<div class="divsearchfield">';
690 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
691 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
692 $moreforfilter .=
'</div>';
695 if (isModEnabled(
'categorie') && $user->hasRight(
'categorie',
'lire') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
696 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
697 $moreforfilter .=
'<div class="divsearchfield">';
698 $tmptitle = $langs->trans(
'IncludingProductWithTag');
699 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
null,
'parent',
null,
null, 1);
700 $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);
701 $moreforfilter .=
'</div>';
703 $parameters = array();
704 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
705 if (empty($reshook)) {
706 $moreforfilter .= $hookmanager->resPrint;
708 $moreforfilter = $hookmanager->resPrint;
711 if (!empty($moreforfilter)) {
712 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
713 print $moreforfilter;
717 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
718 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
719 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
721 print
'<div class="div-table-responsive">';
722 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
726 print
'<tr class="liste_titre_filter">';
729 print
'<td class="liste_titre maxwidthsearch">';
730 $searchpicto = $form->showFilterButtons(
'left');
734 if (!empty($arrayfields[
'sp.ref'][
'checked'])) {
735 print
'<td class="liste_titre">';
736 print
'<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
739 if (!empty($arrayfields[
's.nom'][
'checked'])) {
740 print
'<td class="liste_titre left">';
741 print
'<input class="flat" type="text" size="12" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'">';
744 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
745 print
'<td class="liste_titre left">';
746 print
'<input class="flat" type="text" size="12" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'">';
749 if (!empty($arrayfields[
's.town'][
'checked'])) {
750 print
'<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.
'"></td>';
752 if (!empty($arrayfields[
's.zip'][
'checked'])) {
753 print
'<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.$search_zip.
'"></td>';
756 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
757 print
'<td class="liste_titre">';
758 print
'<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
762 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
763 print
'<td class="liste_titre center">';
764 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
768 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
769 print
'<td class="liste_titre maxwidthonsmartphone center">';
770 print $form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0,
'', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT),
'', 1);
774 if (!empty($arrayfields[
'sp.date_valid'][
'checked'])) {
775 print
'<td class="liste_titre center">';
776 print
'<div class="nowrap">';
777 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'));
779 print
'<div class="nowrap">';
780 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'));
785 if (!empty($arrayfields[
'sp.date_livraison'][
'checked'])) {
786 print
'<td class="liste_titre center">';
787 print
'<div class="nowrap">';
788 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
790 print
'<div class="nowrap">';
791 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
796 if (!empty($arrayfields[
'sp.total_ht'][
'checked'])) {
798 print
'<td class="liste_titre right">';
799 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
802 if (!empty($arrayfields[
'sp.total_tva'][
'checked'])) {
804 print
'<td class="liste_titre right">';
805 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
808 if (!empty($arrayfields[
'sp.total_ttc'][
'checked'])) {
810 print
'<td class="liste_titre right">';
811 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
814 if (!empty($arrayfields[
'sp.multicurrency_code'][
'checked'])) {
816 print
'<td class="liste_titre">';
817 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
820 if (!empty($arrayfields[
'sp.multicurrency_tx'][
'checked'])) {
822 print
'<td class="liste_titre">';
823 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
826 if (!empty($arrayfields[
'sp.multicurrency_total_ht'][
'checked'])) {
828 print
'<td class="liste_titre right">';
829 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
832 if (!empty($arrayfields[
'sp.multicurrency_total_vat'][
'checked'])) {
834 print
'<td class="liste_titre right">';
835 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
838 if (!empty($arrayfields[
'sp.multicurrency_total_ttc'][
'checked'])) {
840 print
'<td class="liste_titre right">';
841 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
844 if (!empty($arrayfields[
'u.login'][
'checked'])) {
846 print
'<td class="liste_titre center">';
847 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
851 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
853 $parameters = array(
'arrayfields'=>$arrayfields);
854 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
855 print $hookmanager->resPrint;
857 if (!empty($arrayfields[
'sp.datec'][
'checked'])) {
858 print
'<td class="liste_titre">';
862 if (!empty($arrayfields[
'sp.tms'][
'checked'])) {
863 print
'<td class="liste_titre">';
867 if (!empty($arrayfields[
'sp.fk_statut'][
'checked'])) {
868 print
'<td class="liste_titre right parentonrightofpage">';
869 $formpropal->selectProposalStatus($search_status, 1, 0, 1,
'supplier',
'search_status',
'search_status width100 onrightofpage');
874 print
'<td class="liste_titre maxwidthsearch">';
875 $searchpicto = $form->showFilterButtons();
882 $totalarray = array();
883 $totalarray[
'nbfield'] = 0;
886 print
'<tr class="liste_titre">';
888 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
889 $totalarray[
'nbfield']++;
891 if (!empty($arrayfields[
'sp.ref'][
'checked'])) {
892 print_liste_field_titre($arrayfields[
'sp.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.ref',
'', $param,
'', $sortfield, $sortorder);
893 $totalarray[
'nbfield']++;
895 if (!empty($arrayfields[
's.nom'][
'checked'])) {
896 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
897 $totalarray[
'nbfield']++;
899 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
900 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
901 $totalarray[
'nbfield']++;
903 if (!empty($arrayfields[
's.town'][
'checked'])) {
904 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
905 $totalarray[
'nbfield']++;
907 if (!empty($arrayfields[
's.zip'][
'checked'])) {
908 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
909 $totalarray[
'nbfield']++;
911 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
912 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
913 $totalarray[
'nbfield']++;
915 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
916 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
917 $totalarray[
'nbfield']++;
919 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
920 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
921 $totalarray[
'nbfield']++;
923 if (!empty($arrayfields[
'sp.date_valid'][
'checked'])) {
924 print_liste_field_titre($arrayfields[
'sp.date_valid'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.date_valid',
'', $param,
'', $sortfield, $sortorder,
'center ');
925 $totalarray[
'nbfield']++;
927 if (!empty($arrayfields[
'sp.date_livraison'][
'checked'])) {
928 print_liste_field_titre($arrayfields[
'sp.date_livraison'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
929 $totalarray[
'nbfield']++;
931 if (!empty($arrayfields[
'sp.total_ht'][
'checked'])) {
932 print_liste_field_titre($arrayfields[
'sp.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
933 $totalarray[
'nbfield']++;
935 if (!empty($arrayfields[
'sp.total_tva'][
'checked'])) {
936 print_liste_field_titre($arrayfields[
'sp.total_tva'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
937 $totalarray[
'nbfield']++;
939 if (!empty($arrayfields[
'sp.total_ttc'][
'checked'])) {
940 print_liste_field_titre($arrayfields[
'sp.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
941 $totalarray[
'nbfield']++;
943 if (!empty($arrayfields[
'sp.multicurrency_code'][
'checked'])) {
944 print_liste_field_titre($arrayfields[
'sp.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
945 $totalarray[
'nbfield']++;
947 if (!empty($arrayfields[
'sp.multicurrency_tx'][
'checked'])) {
948 print_liste_field_titre($arrayfields[
'sp.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
949 $totalarray[
'nbfield']++;
951 if (!empty($arrayfields[
'sp.multicurrency_total_ht'][
'checked'])) {
952 print_liste_field_titre($arrayfields[
'sp.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
953 $totalarray[
'nbfield']++;
955 if (!empty($arrayfields[
'sp.multicurrency_total_vat'][
'checked'])) {
956 print_liste_field_titre($arrayfields[
'sp.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
957 $totalarray[
'nbfield']++;
959 if (!empty($arrayfields[
'sp.multicurrency_total_ttc'][
'checked'])) {
960 print_liste_field_titre($arrayfields[
'sp.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
961 $totalarray[
'nbfield']++;
963 if (!empty($arrayfields[
'u.login'][
'checked'])) {
964 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder,
'center ');
965 $totalarray[
'nbfield']++;
968 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
970 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
971 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
972 print $hookmanager->resPrint;
973 if (!empty($arrayfields[
'sp.datec'][
'checked'])) {
974 print_liste_field_titre($arrayfields[
'sp.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
975 $totalarray[
'nbfield']++;
977 if (!empty($arrayfields[
'sp.tms'][
'checked'])) {
978 print_liste_field_titre($arrayfields[
'sp.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap');
979 $totalarray[
'nbfield']++;
981 if (!empty($arrayfields[
'sp.fk_statut'][
'checked'])) {
982 print_liste_field_titre($arrayfields[
'sp.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'right ');
983 $totalarray[
'nbfield']++;
987 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
988 $totalarray[
'nbfield']++;
996 $savnbfield = $totalarray[
'nbfield'];
997 $totalarray = array();
998 $totalarray[
'nbfield'] = 0;
999 $totalarray[
'val'] = array();
1000 $totalarray[
'val'][
'sp.total_ht'] = 0;
1001 $totalarray[
'val'][
'sp.total_tva'] = 0;
1002 $totalarray[
'val'][
'sp.total_ttc'] = 0;
1004 $imaxinloop = ($limit ? min($num, $limit) : $num);
1005 while ($i < $imaxinloop) {
1006 $obj = $db->fetch_object($resql);
1008 $objectstatic->id = $obj->rowid;
1009 $objectstatic->ref = $obj->ref;
1010 $objectstatic->note_public = $obj->note_public;
1011 $objectstatic->note_private = $obj->note_private;
1012 $objectstatic->status = $obj->status;
1015 $companystatic->id = $obj->socid;
1016 $companystatic->name = $obj->name;
1017 $companystatic->name_alias = $obj->alias;
1018 $companystatic->client = $obj->client;
1019 $companystatic->code_client = $obj->code_client;
1021 if ($mode ==
'kanban') {
1023 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1024 print
'<div class="box-flex-container kanban">';
1028 $userstatic->fetch($obj->fk_user_author);
1029 $objectstatic->delivery_date = $obj->dp;
1030 print $objectstatic->getKanbanView(
'', array(
'thirdparty'=>$companystatic,
'userauthor'=>$userstatic,
'selected' => in_array($obj->id, $arrayofselected)));
1031 if ($i == ($imaxinloop - 1)) {
1036 print
'<tr class="oddeven">';
1039 print
'<td class="nowrap center">';
1040 if ($massactionbutton || $massaction) {
1042 if (in_array($obj->rowid, $arrayofselected)) {
1045 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1049 if (!empty($arrayfields[
'sp.ref'][
'checked'])) {
1050 print
'<td class="nowraponall">';
1052 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1054 print
'<td class="nobordernopadding nowraponall">';
1055 print $objectstatic->getNomUrl(1,
'',
'', 0, -1, 1);
1061 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
1066 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
1069 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1070 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1071 print
'</td></tr></table>';
1075 $totalarray[
'nbfield']++;
1080 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1081 print
'<td class="tdoverflowmax200">';
1082 print $companystatic->getNomUrl(1,
'supplier', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1085 $totalarray[
'nbfield']++;
1090 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1091 print
'<td class="tdoverflowmax200">';
1092 print $companystatic->name_alias;
1095 $totalarray[
'nbfield']++;
1100 if (!empty($arrayfields[
's.town'][
'checked'])) {
1101 print
'<td class="nocellnopadd">';
1105 $totalarray[
'nbfield']++;
1109 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1110 print
'<td class="nocellnopadd">';
1114 $totalarray[
'nbfield']++;
1118 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1119 print
"<td>".$obj->state_name.
"</td>\n";
1121 $totalarray[
'nbfield']++;
1125 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1126 print
'<td class="center">';
1127 $tmparray =
getCountry($obj->fk_pays,
'all');
1128 print $tmparray[
'label'];
1131 $totalarray[
'nbfield']++;
1135 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1136 print
'<td class="center">';
1137 if (empty($typenArray) || !is_array($typenArray) || count($typenArray) == 0) {
1138 $typenArray = $formcompany->typent_array(1);
1140 print $typenArray[$obj->typent_code];
1143 $totalarray[
'nbfield']++;
1148 if (!empty($arrayfields[
'sp.date_valid'][
'checked'])) {
1149 print
'<td class="center">';
1153 $totalarray[
'nbfield']++;
1158 if (!empty($arrayfields[
'sp.date_livraison'][
'checked'])) {
1159 print
'<td class="center">';
1163 $totalarray[
'nbfield']++;
1168 if (!empty($arrayfields[
'sp.total_ht'][
'checked'])) {
1169 print
'<td class="right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
1171 $totalarray[
'nbfield']++;
1174 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'sp.total_ht';
1176 $totalarray[
'val'][
'sp.total_ht'] += $obj->total_ht;
1179 if (!empty($arrayfields[
'sp.total_tva'][
'checked'])) {
1180 print
'<td class="right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
1182 $totalarray[
'nbfield']++;
1185 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'sp.total_tva';
1187 $totalarray[
'val'][
'sp.total_tva'] += $obj->total_tva;
1190 if (!empty($arrayfields[
'sp.total_ttc'][
'checked'])) {
1191 print
'<td class="right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
1193 $totalarray[
'nbfield']++;
1196 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'sp.total_ttc';
1198 $totalarray[
'val'][
'sp.total_ttc'] += $obj->total_ttc;
1202 if (!empty($arrayfields[
'sp.multicurrency_code'][
'checked'])) {
1203 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
1205 $totalarray[
'nbfield']++;
1210 if (!empty($arrayfields[
'sp.multicurrency_tx'][
'checked'])) {
1211 print
'<td class="nowrap">';
1212 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
1215 $totalarray[
'nbfield']++;
1219 if (!empty($arrayfields[
'sp.multicurrency_total_ht'][
'checked'])) {
1220 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
1222 $totalarray[
'nbfield']++;
1226 if (!empty($arrayfields[
'sp.multicurrency_total_vat'][
'checked'])) {
1227 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
1229 $totalarray[
'nbfield']++;
1233 if (!empty($arrayfields[
'sp.multicurrency_total_ttc'][
'checked'])) {
1234 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
1236 $totalarray[
'nbfield']++;
1240 $userstatic->id = $obj->fk_user_author;
1241 $userstatic->login = $obj->login;
1242 $userstatic->status = $obj->ustatus;
1243 $userstatic->lastname = $obj->name;
1244 $userstatic->firstname = $obj->firstname;
1245 $userstatic->photo = $obj->photo;
1246 $userstatic->admin = $obj->admin;
1247 $userstatic->ref = $obj->fk_user_author;
1248 $userstatic->employee = $obj->employee;
1249 $userstatic->email = $obj->uemail;
1252 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1253 print
'<td class="center">';
1254 if ($userstatic->id > 0) {
1255 print $userstatic->getNomUrl(-1,
'', 0, 0, 24, 1,
'login',
'', 1);
1261 $totalarray[
'nbfield']++;
1266 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1268 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
1269 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1270 print $hookmanager->resPrint;
1272 if (!empty($arrayfields[
'sp.datec'][
'checked'])) {
1273 print
'<td class="center nowrap">';
1274 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1277 $totalarray[
'nbfield']++;
1281 if (!empty($arrayfields[
'sp.tms'][
'checked'])) {
1282 print
'<td class="center nowrap">';
1283 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
1286 $totalarray[
'nbfield']++;
1290 if (!empty($arrayfields[
'sp.fk_statut'][
'checked'])) {
1291 print
'<td class="right">'.$objectstatic->getLibStatut(5).
"</td>\n";
1293 $totalarray[
'nbfield']++;
1299 print
'<td class="nowrap center">';
1300 if ($massactionbutton || $massaction) {
1302 if (in_array($obj->rowid, $arrayofselected)) {
1305 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1310 $totalarray[
'nbfield']++;
1315 $total += $obj->total_ht;
1316 $subtotal += $obj->total_ht;
1322 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1327 foreach ($arrayfields as $key => $val) {
1328 if (!empty($val[
'checked'])) {
1332 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1337 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
1338 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
1339 print $hookmanager->resPrint;
1341 print
'</table>'.
"\n";
1342 print
'</div>'.
"\n";
1344 print
'</form>'.
"\n";
1346 $hidegeneratedfilelistifempty = 1;
1347 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1348 $hidegeneratedfilelistifempty = 0;
1352 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1353 $urlsource .= str_replace(
'&',
'&', $param);
1355 $filedir = $diroutputmassaction;
1357 $genallowed = $user->rights->supplier_proposal->lire;
1358 $delallowed = $user->rights->supplier_proposal->creer;
1360 print $formfile->showdocuments(
'massfilesarea_supplier_proposal',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
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=0, $outputlangs='', $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 informations (by default a local PHP server timestamp) Re...
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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.
print_barre_liste($titre, $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.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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.