37 require
'../main.inc.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
41 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
42 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formpropal.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
45 if (!empty($conf->project->enabled)) {
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';
61 $search_user =
GETPOST(
'search_user',
'int');
62 $search_sale =
GETPOST(
'search_sale',
'int');
64 $search_societe =
GETPOST(
'search_societe',
'alpha');
65 $search_societe_alias =
GETPOST(
'search_societe_alias',
'alpha');
66 $search_login =
GETPOST(
'search_login',
'alpha');
67 $search_town =
GETPOST(
'search_town',
'alpha');
68 $search_zip =
GETPOST(
'search_zip',
'alpha');
69 $search_state =
GETPOST(
"search_state");
70 $search_country =
GETPOST(
"search_country",
'int');
71 $search_date_startday =
GETPOST(
'search_date_startday',
'int');
72 $search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
73 $search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
74 $search_date_endday =
GETPOST(
'search_date_endday',
'int');
75 $search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
76 $search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
77 $search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
78 $search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
79 $search_date_valid_startday =
GETPOST(
'search_date_valid_startday',
'int');
80 $search_date_valid_startmonth =
GETPOST(
'search_date_valid_startmonth',
'int');
81 $search_date_valid_startyear =
GETPOST(
'search_date_valid_startyear',
'int');
82 $search_date_valid_endday =
GETPOST(
'search_date_valid_endday',
'int');
83 $search_date_valid_endmonth =
GETPOST(
'search_date_valid_endmonth',
'int');
84 $search_date_valid_endyear =
GETPOST(
'search_date_valid_endyear',
'int');
85 $search_date_valid_start =
dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear);
86 $search_date_valid_end =
dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear);
87 $search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'int');
88 $search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
89 $search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
90 $search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
91 $search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
92 $search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
93 $search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
94 $search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
95 $search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
96 $search_status =
GETPOST(
'search_status',
'int');
97 $search_product_category =
GETPOST(
'search_product_category',
'int');
99 $object_statut = $db->escape(
GETPOST(
'supplier_proposal_statut'));
100 $search_btn =
GETPOST(
'button_search',
'alpha');
101 $search_remove_btn =
GETPOST(
'button_removefilter',
'alpha');
103 $sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
107 $optioncss =
GETPOST(
'optioncss',
'alpha');
108 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
109 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
110 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
112 if (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';
125 if ($object_statut !=
'') {
126 $search_status = $object_statut;
133 $module =
'supplier_proposal';
136 if (!empty($user->socid)) {
137 $socid = $user->socid;
139 if (!empty($socid)) {
142 $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',
166 if (empty($user->socid)) {
167 $fieldstosearchall[
"p.note_private"] =
"NotePrivate";
170 $checkedtypetiers = 0;
171 $arrayfields = array(
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),
196 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
207 if (
GETPOST(
'cancel',
'alpha')) {
208 $action =
'list'; $massaction =
'';
210 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
214 $parameters = array(
'socid'=>$socid);
215 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
220 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
223 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
228 $search_societe =
'';
229 $search_societe_alias =
'';
230 $search_montant_ht =
'';
231 $search_montant_vat =
'';
232 $search_montant_ttc =
'';
233 $search_multicurrency_code =
'';
234 $search_multicurrency_tx =
'';
235 $search_multicurrency_montant_ht =
'';
236 $search_multicurrency_montant_vat =
'';
237 $search_multicurrency_montant_ttc =
'';
239 $search_product_category =
'';
244 $search_country =
'';
245 $search_type_thirdparty =
'';
246 $search_date_startday =
'';
247 $search_date_startmonth =
'';
248 $search_date_startyear =
'';
249 $search_date_endday =
'';
250 $search_date_endmonth =
'';
251 $search_date_endyear =
'';
252 $search_date_start =
'';
253 $search_date_end =
'';
254 $search_date_valid_startday =
'';
255 $search_date_valid_startmonth =
'';
256 $search_date_valid_startyear =
'';
257 $search_date_valid_endday =
'';
258 $search_date_valid_endmonth =
'';
259 $search_date_valid_endyear =
'';
260 $search_date_valid_start =
'';
261 $search_date_valid_end =
'';
266 if (empty($reshook)) {
267 $objectclass =
'SupplierProposal';
268 $objectlabel =
'SupplierProposals';
269 $permissiontoread = $user->rights->supplier_proposal->lire;
270 $permissiontodelete = $user->rights->supplier_proposal->supprimer;
271 $uploaddir = $conf->supplier_proposal->dir_output;
272 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
288 $companystatic =
new Societe($db);
291 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
292 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
294 $title = $langs->trans(
'ListOfSupplierProposals');
295 $help_url =
'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur';
300 if ($sall || $search_user > 0) {
301 $sql =
'SELECT DISTINCT';
303 $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,';
304 $sql .=
" typent.code as typent_code,";
305 $sql .=
" state.code_departement as state_code, state.nom as state_name,";
306 $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,';
307 $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,';
308 $sql .=
' sp.datec as date_creation, sp.tms as date_update,';
309 $sql .=
" p.rowid as project_id, p.ref as project_ref,";
310 if (empty($user->rights->societe->client->voir) && !$socid) {
311 $sql .=
" sc.fk_soc, sc.fk_user,";
313 $sql .=
" u.firstname, u.lastname, u.photo, u.login, u.statut as ustatus, u.admin, u.employee, u.email as uemail";
315 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
316 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
317 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
321 $parameters = array();
322 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
323 $sql .= $hookmanager->resPrint;
324 $sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
325 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
326 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
327 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
328 $sql .=
', '.MAIN_DB_PREFIX.
'supplier_proposal as sp';
329 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
330 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (sp.rowid = ef.fk_object)";
333 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'supplier_proposaldet as pd ON sp.rowid=pd.fk_supplier_proposal';
335 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON sp.fk_user_author = u.rowid';
336 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = sp.fk_projet";
338 if ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid)) {
339 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
341 if ($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').
')';
347 if (empty($user->rights->societe->client->voir) && !$socid) {
348 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
359 if ($search_country) {
360 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
362 if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
363 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
368 if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
369 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
371 if ($search_societe) {
374 if ($search_societe_alias) {
379 $sql .=
natural_search(array(
'u.lastname',
'u.firstname',
'u.login'), $search_login);
381 if ($search_montant_ht) {
384 if ($search_montant_vat !=
'') {
387 if ($search_montant_ttc !=
'') {
390 if ($search_multicurrency_code !=
'') {
391 $sql .=
" AND sp.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
393 if ($search_multicurrency_tx !=
'') {
394 $sql .=
natural_search(
'sp.multicurrency_tx', $search_multicurrency_tx, 1);
396 if ($search_multicurrency_montant_ht !=
'') {
397 $sql .=
natural_search(
'sp.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
399 if ($search_multicurrency_montant_vat !=
'') {
400 $sql .=
natural_search(
'sp.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
402 if ($search_multicurrency_montant_ttc !=
'') {
403 $sql .=
natural_search(
'sp.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
409 $sql .=
' AND s.rowid = '.((int) $socid);
411 if ($search_status >= 0 && $search_status !=
'') {
412 $sql .=
' AND sp.fk_statut IN ('.$db->sanitize($db->escape($search_status)).
')';
414 if ($search_date_start) {
415 $sql .=
" AND sp.date_livraison >= '".$db->idate($search_date_start).
"'";
417 if ($search_date_end) {
418 $sql .=
" AND sp.date_livraison <= '".$db->idate($search_date_end).
"'";
420 if ($search_date_valid_start) {
421 $sql .=
" AND sp.date_valid >= '".$db->idate($search_date_valid_start).
"'";
423 if ($search_date_valid_end) {
424 $sql .=
" AND sp.date_valid <= '".$db->idate($search_date_valid_end).
"'";
426 if ($search_sale > 0) {
427 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
429 if ($search_user > 0) {
430 $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);
433 $searchCategoryProductOperator = -1;
434 $searchCategoryProductList = array($search_product_category);
435 if (!empty($searchCategoryProductList)) {
436 $searchCategoryProductSqlList = array();
437 $listofcategoryid =
'';
438 foreach ($searchCategoryProductList as $searchCategoryProduct) {
439 if (intval($searchCategoryProduct) == -2) {
440 $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)";
441 } elseif (intval($searchCategoryProduct) > 0) {
442 if ($searchCategoryProductOperator == 0) {
443 $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).
")";
445 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
449 if ($listofcategoryid) {
450 $searchCategoryProductSqlList[] =
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"supplier_proposaldet as sd WHERE sd.fk_supplier_proposal = sp.rowid AND sd.fk_product = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
452 if ($searchCategoryProductOperator == 1) {
453 if (!empty($searchCategoryProductSqlList)) {
454 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
457 if (!empty($searchCategoryProductSqlList)) {
458 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
463 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
465 $parameters = array();
466 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
467 $sql .= $hookmanager->resPrint;
469 $sql .= $db->order($sortfield, $sortorder);
470 $sql .=
', sp.ref DESC';
474 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
475 $resql = $db->query($sql);
483 $sql .= $db->plimit($limit + 1, $offset);
485 $resql = $db->query($sql);
488 $userstatic =
new User($db);
493 $title = $langs->trans(
'SupplierProposals').
' - '.$soc->name;
495 $title = $langs->trans(
'SupplierProposals');
498 $num = $db->num_rows(
$resql);
500 $arrayofselected = is_array($toselect) ? $toselect : array();
502 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
503 $obj = $db->fetch_object(
$resql);
507 header(
"Location: ".DOL_URL_ROOT.
'/supplier_proposal/card.php?id='.$id);
513 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
514 $param .=
'&contextpage='.urlencode($contextpage);
516 if ($limit > 0 && $limit != $conf->liste_limit) {
517 $param .=
'&limit='.urlencode($limit);
520 $param .=
'&sall='.urlencode($sall);
522 if ($search_date_startday) {
523 $param .=
'&search_date_startday='.urlencode($search_date_startday);
525 if ($search_date_startmonth) {
526 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
528 if ($search_date_startyear) {
529 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
531 if ($search_date_endday) {
532 $param .=
'&search_date_endday='.urlencode($search_date_endday);
534 if ($search_date_endmonth) {
535 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
537 if ($search_date_endyear) {
538 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
540 if ($search_date_valid_startday) {
541 $param .=
'&search_date_valid_startday='.urlencode($search_date_valid_startday);
543 if ($search_date_valid_startmonth) {
544 $param .=
'&search_date_valid_startmonth='.urlencode($search_date_valid_startmonth);
546 if ($search_date_valid_startyear) {
547 $param .=
'&search_date_valid_startyear='.urlencode($search_date_valid_startyear);
549 if ($search_date_valid_endday) {
550 $param .=
'&search_date_valid_endday='.urlencode($search_date_valid_endday);
552 if ($search_date_valid_endmonth) {
553 $param .=
'&search_date_valid_endmonth='.urlencode($search_date_valid_endmonth);
555 if ($search_date_valid_endyear) {
556 $param .=
'&search_date_valid_endyear='.urlencode($search_date_valid_endyear);
559 $param .=
'&search_ref='.urlencode($search_ref);
561 if ($search_societe) {
562 $param .=
'&search_societe='.urlencode($search_societe);
564 if ($search_societe_alias) {
565 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
567 if ($search_user > 0) {
568 $param .=
'&search_user='.urlencode($search_user);
570 if ($search_sale > 0) {
571 $param .=
'&search_sale='.urlencode($search_sale);
573 if ($search_montant_ht) {
574 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
576 if ($search_multicurrency_code !=
'') {
577 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
579 if ($search_multicurrency_tx !=
'') {
580 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
582 if ($search_multicurrency_montant_ht !=
'') {
583 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
585 if ($search_multicurrency_montant_vat !=
'') {
586 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
588 if ($search_multicurrency_montant_ttc !=
'') {
589 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
592 $param .=
'&search_login='.urlencode($search_login);
595 $param .=
'&search_town='.urlencode($search_town);
598 $param .=
'&search_zip='.urlencode($search_zip);
601 $param .=
'&socid='.urlencode($socid);
603 if ($search_status !=
'') {
604 $param .=
'&search_status='.urlencode($search_status);
606 if ($optioncss !=
'') {
607 $param .=
'&optioncss='.urlencode($optioncss);
609 if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
610 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
613 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
616 $arrayofmassactions = array(
617 'generate_doc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
618 'builddoc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
621 if ($user->rights->supplier_proposal->supprimer) {
622 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
624 if (in_array($massaction, array(
'presend',
'predelete'))) {
625 $arrayofmassactions = array();
627 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
629 $url = DOL_URL_ROOT.
'/supplier_proposal/card.php?action=create';
630 if (!empty($socid)) {
631 $url .=
'&socid='.$socid;
633 $newcardbutton =
dolGetButtonTitle($langs->trans(
'NewAskPrice'),
'',
'fa fa-plus-circle', $url,
'', $user->rights->supplier_proposal->creer);
636 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
637 if ($optioncss !=
'') {
638 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
640 print
'<input type="hidden" name="token" value="'.newToken().
'">';
641 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
642 print
'<input type="hidden" name="action" value="list">';
643 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
644 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
646 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num,
$nbtotalofrecords,
'supplier_proposal', 0, $newcardbutton,
'', $limit, 0, 0, 1);
648 $topicmail =
"SendSupplierProposalRef";
649 $modelmail =
"supplier_proposal_send";
651 $trackid =
'spro'.$object->id;
652 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
655 foreach ($fieldstosearchall as $key => $val) {
656 $fieldstosearchall[$key] = $langs->trans($val);
658 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
666 if ($user->rights->user->user->lire) {
667 $langs->load(
"commercial");
668 $moreforfilter .=
'<div class="divsearchfield">';
669 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
670 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
671 $moreforfilter .=
'</div>';
674 if ($user->rights->user->user->lire) {
675 $moreforfilter .=
'<div class="divsearchfield">';
676 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
677 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
678 $moreforfilter .=
'</div>';
681 if (
isModEnabled(
'categorie') && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) {
682 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
683 $moreforfilter .=
'<div class="divsearchfield">';
684 $tmptitle = $langs->trans(
'IncludingProductWithTag');
685 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_PRODUCT,
null,
'parent',
null,
null, 1);
686 $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);
687 $moreforfilter .=
'</div>';
689 $parameters = array();
690 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
691 if (empty($reshook)) {
692 $moreforfilter .= $hookmanager->resPrint;
694 $moreforfilter = $hookmanager->resPrint;
697 if (!empty($moreforfilter)) {
698 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
699 print $moreforfilter;
703 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
704 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
705 if ($massactionbutton) {
706 $selectedfields .=
$form->showCheckAddButtons(
'checkforselect', 1);
709 print
'<div class="div-table-responsive">';
710 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
712 print
'<tr class="liste_titre_filter">';
715 print
'<td class="liste_titre middle">';
716 $searchpicto =
$form->showFilterButtons(
'left');
720 if (!empty($arrayfields[
'sp.ref'][
'checked'])) {
721 print
'<td class="liste_titre">';
722 print
'<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
725 if (!empty($arrayfields[
's.nom'][
'checked'])) {
726 print
'<td class="liste_titre left">';
727 print
'<input class="flat" type="text" size="12" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'">';
730 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
731 print
'<td class="liste_titre left">';
732 print
'<input class="flat" type="text" size="12" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'">';
735 if (!empty($arrayfields[
's.town'][
'checked'])) {
736 print
'<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.
'"></td>';
738 if (!empty($arrayfields[
's.zip'][
'checked'])) {
739 print
'<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.$search_zip.
'"></td>';
742 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
743 print
'<td class="liste_titre">';
744 print
'<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
748 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
749 print
'<td class="liste_titre center">';
750 print
$form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
754 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
755 print
'<td class="liste_titre maxwidthonsmartphone center">';
756 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);
760 if (!empty($arrayfields[
'sp.date_valid'][
'checked'])) {
761 print
'<td class="liste_titre center">';
762 print
'<div class="nowrap">';
763 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'));
765 print
'<div class="nowrap">';
766 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'));
771 if (!empty($arrayfields[
'sp.date_livraison'][
'checked'])) {
772 print
'<td class="liste_titre center">';
773 print
'<div class="nowrap">';
774 print
$form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
776 print
'<div class="nowrap">';
777 print
$form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
782 if (!empty($arrayfields[
'sp.total_ht'][
'checked'])) {
784 print
'<td class="liste_titre right">';
785 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
788 if (!empty($arrayfields[
'sp.total_tva'][
'checked'])) {
790 print
'<td class="liste_titre right">';
791 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
794 if (!empty($arrayfields[
'sp.total_ttc'][
'checked'])) {
796 print
'<td class="liste_titre right">';
797 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
800 if (!empty($arrayfields[
'sp.multicurrency_code'][
'checked'])) {
802 print
'<td class="liste_titre">';
803 print
$form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
806 if (!empty($arrayfields[
'sp.multicurrency_tx'][
'checked'])) {
808 print
'<td class="liste_titre">';
809 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
812 if (!empty($arrayfields[
'sp.multicurrency_total_ht'][
'checked'])) {
814 print
'<td class="liste_titre right">';
815 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
818 if (!empty($arrayfields[
'sp.multicurrency_total_vat'][
'checked'])) {
820 print
'<td class="liste_titre right">';
821 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
824 if (!empty($arrayfields[
'sp.multicurrency_total_ttc'][
'checked'])) {
826 print
'<td class="liste_titre right">';
827 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
830 if (!empty($arrayfields[
'u.login'][
'checked'])) {
832 print
'<td class="liste_titre center">';
833 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
837 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
839 $parameters = array(
'arrayfields'=>$arrayfields);
840 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
841 print $hookmanager->resPrint;
843 if (!empty($arrayfields[
'sp.datec'][
'checked'])) {
844 print
'<td class="liste_titre">';
848 if (!empty($arrayfields[
'sp.tms'][
'checked'])) {
849 print
'<td class="liste_titre">';
853 if (!empty($arrayfields[
'sp.fk_statut'][
'checked'])) {
854 print
'<td class="liste_titre right">';
855 $formpropal->selectProposalStatus($search_status, 1, 0, 1,
'supplier',
'search_status',
'minwidth75imp onrightofpage');
860 print
'<td class="liste_titre middle">';
861 $searchpicto =
$form->showFilterButtons();
869 print
'<tr class="liste_titre">';
871 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
873 if (!empty($arrayfields[
'sp.ref'][
'checked'])) {
874 print_liste_field_titre($arrayfields[
'sp.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.ref',
'', $param,
'', $sortfield, $sortorder);
876 if (!empty($arrayfields[
's.nom'][
'checked'])) {
877 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
879 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
880 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
882 if (!empty($arrayfields[
's.town'][
'checked'])) {
883 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
885 if (!empty($arrayfields[
's.zip'][
'checked'])) {
886 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
888 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
889 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
891 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
892 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
894 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
895 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
897 if (!empty($arrayfields[
'sp.date_valid'][
'checked'])) {
898 print_liste_field_titre($arrayfields[
'sp.date_valid'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.date_valid',
'', $param,
'', $sortfield, $sortorder,
'center ');
900 if (!empty($arrayfields[
'sp.date_livraison'][
'checked'])) {
901 print_liste_field_titre($arrayfields[
'sp.date_livraison'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
903 if (!empty($arrayfields[
'sp.total_ht'][
'checked'])) {
904 print_liste_field_titre($arrayfields[
'sp.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
906 if (!empty($arrayfields[
'sp.total_tva'][
'checked'])) {
907 print_liste_field_titre($arrayfields[
'sp.total_tva'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
909 if (!empty($arrayfields[
'sp.total_ttc'][
'checked'])) {
910 print_liste_field_titre($arrayfields[
'sp.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
912 if (!empty($arrayfields[
'sp.multicurrency_code'][
'checked'])) {
913 print_liste_field_titre($arrayfields[
'sp.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
915 if (!empty($arrayfields[
'sp.multicurrency_tx'][
'checked'])) {
916 print_liste_field_titre($arrayfields[
'sp.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
918 if (!empty($arrayfields[
'sp.multicurrency_total_ht'][
'checked'])) {
919 print_liste_field_titre($arrayfields[
'sp.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
921 if (!empty($arrayfields[
'sp.multicurrency_total_vat'][
'checked'])) {
922 print_liste_field_titre($arrayfields[
'sp.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
924 if (!empty($arrayfields[
'sp.multicurrency_total_ttc'][
'checked'])) {
925 print_liste_field_titre($arrayfields[
'sp.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
927 if (!empty($arrayfields[
'u.login'][
'checked'])) {
928 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder,
'center ');
931 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
933 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
934 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
935 print $hookmanager->resPrint;
936 if (!empty($arrayfields[
'sp.datec'][
'checked'])) {
937 print_liste_field_titre($arrayfields[
'sp.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
939 if (!empty($arrayfields[
'sp.tms'][
'checked'])) {
940 print_liste_field_titre($arrayfields[
'sp.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap');
942 if (!empty($arrayfields[
'sp.fk_statut'][
'checked'])) {
943 print_liste_field_titre($arrayfields[
'sp.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'right ');
946 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
954 $totalarray = array();
955 $totalarray[
'nbfield'] = 0;
956 $totalarray[
'val'] = array();
957 $totalarray[
'val'][
'sp.total_ht'] = 0;
958 $totalarray[
'val'][
'sp.total_tva'] = 0;
959 $totalarray[
'val'][
'sp.total_ttc'] = 0;
960 while ($i < min($num, $limit)) {
961 $obj = $db->fetch_object(
$resql);
963 $objectstatic->id = $obj->rowid;
964 $objectstatic->ref = $obj->ref;
965 $objectstatic->note_public = $obj->note_public;
966 $objectstatic->note_private = $obj->note_private;
967 $objectstatic->status = $obj->status;
970 $companystatic->id = $obj->socid;
971 $companystatic->name = $obj->name;
972 $companystatic->name_alias = $obj->alias;
973 $companystatic->client = $obj->client;
974 $companystatic->code_client = $obj->code_client;
976 print
'<tr class="oddeven">';
979 print
'<td class="nowrap center">';
980 if ($massactionbutton || $massaction) {
982 if (in_array($obj->rowid, $arrayofselected)) {
985 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
989 if (!empty($arrayfields[
'sp.ref'][
'checked'])) {
990 print
'<td class="nowraponall">';
992 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
994 print
'<td class="nobordernopadding nowraponall">';
995 print $objectstatic->getNomUrl(1,
'',
'', 0, -1, 1);
1001 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
1006 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
1009 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1010 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1011 print
'</td></tr></table>';
1015 $totalarray[
'nbfield']++;
1020 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1021 print
'<td class="tdoverflowmax200">';
1022 print $companystatic->getNomUrl(1,
'supplier', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1025 $totalarray[
'nbfield']++;
1030 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1031 print
'<td class="tdoverflowmax200">';
1032 print $companystatic->name_alias;
1035 $totalarray[
'nbfield']++;
1040 if (!empty($arrayfields[
's.town'][
'checked'])) {
1041 print
'<td class="nocellnopadd">';
1045 $totalarray[
'nbfield']++;
1049 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1050 print
'<td class="nocellnopadd">';
1054 $totalarray[
'nbfield']++;
1058 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1059 print
"<td>".$obj->state_name.
"</td>\n";
1061 $totalarray[
'nbfield']++;
1065 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1066 print
'<td class="center">';
1067 $tmparray =
getCountry($obj->fk_pays,
'all');
1068 print $tmparray[
'label'];
1071 $totalarray[
'nbfield']++;
1075 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1076 print
'<td class="center">';
1077 if (empty($typenArray) || !is_array($typenArray) || count($typenArray) == 0) {
1078 $typenArray = $formcompany->typent_array(1);
1080 print $typenArray[$obj->typent_code];
1083 $totalarray[
'nbfield']++;
1088 if (!empty($arrayfields[
'sp.date_valid'][
'checked'])) {
1089 print
'<td class="center">';
1093 $totalarray[
'nbfield']++;
1098 if (!empty($arrayfields[
'sp.date_livraison'][
'checked'])) {
1099 print
'<td class="center">';
1103 $totalarray[
'nbfield']++;
1108 if (!empty($arrayfields[
'sp.total_ht'][
'checked'])) {
1109 print
'<td class="right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
1111 $totalarray[
'nbfield']++;
1114 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'sp.total_ht';
1116 $totalarray[
'val'][
'sp.total_ht'] += $obj->total_ht;
1119 if (!empty($arrayfields[
'sp.total_tva'][
'checked'])) {
1120 print
'<td class="right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
1122 $totalarray[
'nbfield']++;
1125 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'sp.total_tva';
1127 $totalarray[
'val'][
'sp.total_tva'] += $obj->total_tva;
1130 if (!empty($arrayfields[
'sp.total_ttc'][
'checked'])) {
1131 print
'<td class="right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
1133 $totalarray[
'nbfield']++;
1136 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'sp.total_ttc';
1138 $totalarray[
'val'][
'sp.total_ttc'] += $obj->total_ttc;
1142 if (!empty($arrayfields[
'sp.multicurrency_code'][
'checked'])) {
1143 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
1145 $totalarray[
'nbfield']++;
1150 if (!empty($arrayfields[
'sp.multicurrency_tx'][
'checked'])) {
1151 print
'<td class="nowrap">';
1152 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
1155 $totalarray[
'nbfield']++;
1159 if (!empty($arrayfields[
'sp.multicurrency_total_ht'][
'checked'])) {
1160 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
1162 $totalarray[
'nbfield']++;
1166 if (!empty($arrayfields[
'sp.multicurrency_total_vat'][
'checked'])) {
1167 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
1169 $totalarray[
'nbfield']++;
1173 if (!empty($arrayfields[
'sp.multicurrency_total_ttc'][
'checked'])) {
1174 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
1176 $totalarray[
'nbfield']++;
1180 $userstatic->id = $obj->fk_user_author;
1181 $userstatic->login = $obj->login;
1182 $userstatic->status = $obj->ustatus;
1183 $userstatic->lastname = $obj->name;
1184 $userstatic->firstname = $obj->firstname;
1185 $userstatic->photo = $obj->photo;
1186 $userstatic->admin = $obj->admin;
1187 $userstatic->ref = $obj->fk_user_author;
1188 $userstatic->employee = $obj->employee;
1189 $userstatic->email = $obj->uemail;
1192 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1193 print
'<td class="center">';
1194 if ($userstatic->id > 0) {
1195 print $userstatic->getNomUrl(-1,
'', 0, 0, 24, 1,
'login',
'', 1);
1201 $totalarray[
'nbfield']++;
1206 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1208 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
1209 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1210 print $hookmanager->resPrint;
1212 if (!empty($arrayfields[
'sp.datec'][
'checked'])) {
1213 print
'<td class="center nowrap">';
1214 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1217 $totalarray[
'nbfield']++;
1221 if (!empty($arrayfields[
'sp.tms'][
'checked'])) {
1222 print
'<td class="center nowrap">';
1223 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
1226 $totalarray[
'nbfield']++;
1230 if (!empty($arrayfields[
'sp.fk_statut'][
'checked'])) {
1231 print
'<td class="right">'.$objectstatic->getLibStatut(5).
"</td>\n";
1233 $totalarray[
'nbfield']++;
1239 print
'<td class="nowrap center">';
1240 if ($massactionbutton || $massaction) {
1242 if (in_array($obj->rowid, $arrayofselected)) {
1245 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1250 $totalarray[
'nbfield']++;
1255 $total += $obj->total_ht;
1256 $subtotal += $obj->total_ht;
1262 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1267 foreach ($arrayfields as $key => $val) {
1268 if (!empty($val[
'checked'])) {
1272 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1277 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
1278 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
1279 print $hookmanager->resPrint;
1281 print
'</table>'.
"\n";
1282 print
'</div>'.
"\n";
1284 print
'</form>'.
"\n";
1286 $hidegeneratedfilelistifempty = 1;
1287 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1288 $hidegeneratedfilelistifempty = 0;
1292 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1293 $urlsource .= str_replace(
'&',
'&', $param);
1295 $filedir = $diroutputmassaction;
1297 $genallowed = $user->rights->supplier_proposal->lire;
1298 $delallowed = $user->rights->supplier_proposal->creer;
1300 print $formfile->showdocuments(
'massfilesarea_supplier_proposal',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
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.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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.
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.
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.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
$nbtotalofrecords
Count total nb of records.
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.