40require
'../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formpropal.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
59$langs->loadLangs(array(
'companies',
'propal',
'supplier_proposal',
'compta',
'bills',
'orders',
'products',
'projects'));
63$action =
GETPOST(
'action',
'aZ09');
64$massaction =
GETPOST(
'massaction',
'alpha');
66$confirm =
GETPOST(
'confirm',
'alpha');
67$toselect =
GETPOST(
'toselect',
'array:int');
68$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'supplierproposallist';
69$optioncss =
GETPOST(
'optioncss',
'alpha');
70$mode =
GETPOST(
'mode',
'alpha');
72$search_user =
GETPOST(
'search_user',
'intcomma');
73$search_sale =
GETPOST(
'search_sale',
'intcomma');
75$search_company =
GETPOST(
'search_company',
'alpha');
76$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
77$search_login =
GETPOST(
'search_login',
'alpha');
78$search_town =
GETPOST(
'search_town',
'alpha');
79$search_zip =
GETPOST(
'search_zip',
'alpha');
80$search_state =
GETPOST(
"search_state");
81$search_country =
GETPOST(
"search_country",
'aZ09');
82$search_date_startday =
GETPOSTINT(
'search_date_startday');
83$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
84$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
85$search_date_endday =
GETPOSTINT(
'search_date_endday');
86$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
87$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
88$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
89$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
90$search_date_valid_startday =
GETPOSTINT(
'search_date_valid_startday');
91$search_date_valid_startmonth =
GETPOSTINT(
'search_date_valid_startmonth');
92$search_date_valid_startyear =
GETPOSTINT(
'search_date_valid_startyear');
93$search_date_valid_endday =
GETPOSTINT(
'search_date_valid_endday');
94$search_date_valid_endmonth =
GETPOSTINT(
'search_date_valid_endmonth');
95$search_date_valid_endyear =
GETPOSTINT(
'search_date_valid_endyear');
96$search_date_valid_start =
dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear);
97$search_date_valid_end =
dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear);
98$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
99$search_montant_ht =
GETPOST(
'search_montant_ht',
'alpha');
100$search_montant_vat =
GETPOST(
'search_montant_vat',
'alpha');
101$search_montant_ttc =
GETPOST(
'search_montant_ttc',
'alpha');
102$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
103$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
104$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
105$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
106$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
107$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
108$search_status =
GETPOST(
'search_status',
'intcomma');
109$search_note_private =
GETPOST(
'search_note_private',
'alpha');
110$search_note_public =
GETPOST(
'search_note_public',
'alpha');
111$search_product_category =
GETPOST(
'search_product_category',
'int');
112$searchCategorySupplierPropalList =
GETPOST(
'search_category_supplier_proposal_list',
'array:int');
113$searchCategorySupplierPropalOperator = 0;
114if (GETPOSTISSET(
'formfilteraction')) {
115 $searchCategorySupplierPropalOperator =
GETPOSTINT(
'search_category_supplier_proposal_operator');
117 $searchCategorySupplierPropalOperator =
getDolGlobalString(
'MAIN_SEARCH_CAT_OR_BY_DEFAULT');
119$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
121$object_statut =
GETPOST(
'supplier_proposal_statut',
'intcomma');
122$search_btn =
GETPOST(
'button_search',
'alpha');
123$search_remove_btn =
GETPOST(
'button_removefilter',
'alpha');
126$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
127$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
129if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
133$offset = $limit * $page;
134$pageprev = $page - 1;
135$pagenext = $page + 1;
137 $sortfield =
'sp.ref';
143if ($object_statut !=
'') {
144 $search_status = $object_statut;
151$module =
'supplier_proposal';
154if (!empty($user->socid)) {
155 $socid = $user->socid;
160 $dbtable =
'&societe';
163$diroutputmassaction =
$conf->supplier_proposal->dir_output.
'/temp/massgeneration/'.$user->id;
167$hookmanager->initHooks(array(
'supplier_proposallist'));
171$extrafields->fetch_name_optionals_label(
$object->table_element);
173$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
177$fieldstosearchall = array();
178foreach (
$object->fields as $key => $val) {
179 if (!empty($val[
'searchall'])) {
180 $fieldstosearchall[
'sp.'.$key] = $val[
'label'];
183$fieldstosearchall[
'pd.description'] =
'Description';
184$fieldstosearchall[
's.nom'] =
"ThirdParty";
185$fieldstosearchall[
's.name_alias'] =
"AliasNameShort";
186$fieldstosearchall[
's.zip'] =
"Zip";
187$fieldstosearchall[
's.town'] =
"Town";
188if (empty($user->socid)) {
189 $fieldstosearchall[
"p.note_private"] =
"NotePrivate";
192$checkedtypetiers =
'0';
194 'sp.ref' => array(
'label' => $langs->trans(
"Ref"),
'checked' =>
'1'),
195 's.nom' => array(
'label' => $langs->trans(
"Supplier"),
'checked' =>
'1'),
196 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' =>
'0'),
197 's.town' => array(
'label' => $langs->trans(
"Town"),
'checked' =>
'1'),
198 's.zip' => array(
'label' => $langs->trans(
"Zip"),
'checked' =>
'1'),
199 'state.nom' => array(
'label' => $langs->trans(
"StateShort"),
'checked' =>
'0'),
200 'country.code_iso' => array(
'label' => $langs->trans(
"Country"),
'checked' =>
'0'),
201 'typent.code' => array(
'label' => $langs->trans(
"ThirdPartyType"),
'checked' => $checkedtypetiers),
202 'sp.date_valid' => array(
'label' => $langs->trans(
"DateValidation"),
'checked' =>
'1'),
203 'sp.date_livraison' => array(
'label' => $langs->trans(
"DateEnd"),
'checked' =>
'1'),
204 'sp.total_ht' => array(
'label' => $langs->trans(
"AmountHT"),
'checked' =>
'1'),
205 'sp.total_tva' => array(
'label' => $langs->trans(
"AmountVAT"),
'checked' =>
'0'),
206 'sp.total_ttc' => array(
'label' => $langs->trans(
"AmountTTC"),
'checked' =>
'0'),
207 'sp.multicurrency_code' => array(
'label' =>
'Currency',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
208 'sp.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
209 'sp.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
210 'sp.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
211 'sp.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1')),
212 'sp.fk_projet' => array(
'label' => $langs->trans(
"RefProject"),
'checked' =>
'1',
'enabled' => (!
isModEnabled(
"project") ?
'0' :
'1')),
213 'u.login' => array(
'label' => $langs->trans(
"Author"),
'checked' =>
'1',
'position' => 10),
214 'sp.datec' => array(
'label' => $langs->trans(
"DateCreation"),
'checked' =>
'0',
'position' => 500),
215 'sp.tms' => array(
'label' => $langs->trans(
"DateModificationShort"),
'checked' =>
'0',
'position' => 500),
216 'sp.note_public' => array(
'label' =>
'NotePublic',
'checked' =>
'0',
'position' => 520,
'enabled' => (
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES') ?
'0' :
'1')),
217 'sp.note_private' => array(
'label' =>
'NotePrivate',
'checked' =>
'0',
'position' => 521,
'enabled' => (
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES') ?
'0' :
'1')),
218 'sp.fk_statut' => array(
'label' => $langs->trans(
"Status"),
'checked' =>
'1',
'position' => 1000),
221include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
223$parameters = array(
'arrayfields' => &$arrayfields);
224$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
230if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
231 $search_sale = $user->id;
236$permissiontoread = $user->hasRight(
'supplier_proposal',
'lire');
237$permissiontodelete = $user->hasRight(
'supplier_proposal',
'supprimer');
238$permissiontoadd = $user->hasRight(
'supplier_proposal',
'creer');
244if (
GETPOST(
'cancel',
'alpha')) {
248if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
252$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
253$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
258if (empty($reshook)) {
260 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
263 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
268 $search_company =
'';
269 $search_company_alias =
'';
270 $search_montant_ht =
'';
271 $search_montant_vat =
'';
272 $search_montant_ttc =
'';
273 $search_multicurrency_code =
'';
274 $search_multicurrency_tx =
'';
275 $search_multicurrency_montant_ht =
'';
276 $search_multicurrency_montant_vat =
'';
277 $search_multicurrency_montant_ttc =
'';
278 $search_project_ref =
'';
280 $search_product_category =
'';
281 $searchCategorySupplierPropalList = array();
286 $search_country =
'';
287 $search_type_thirdparty =
'';
288 $search_date_startday =
'';
289 $search_date_startmonth =
'';
290 $search_date_startyear =
'';
291 $search_date_endday =
'';
292 $search_date_endmonth =
'';
293 $search_date_endyear =
'';
294 $search_date_start =
'';
295 $search_date_end =
'';
296 $search_date_valid_startday =
'';
297 $search_date_valid_startmonth =
'';
298 $search_date_valid_startyear =
'';
299 $search_date_valid_endday =
'';
300 $search_date_valid_endmonth =
'';
301 $search_date_valid_endyear =
'';
302 $search_date_valid_start =
'';
303 $search_date_valid_end =
'';
308 $objectclass =
'SupplierProposal';
309 $objectlabel =
'SupplierProposals';
310 $uploaddir =
$conf->supplier_proposal->dir_output;
311 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
331 if (empty($search_company)) {
332 $search_company = $soc->name;
336$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
337$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
339$title = $langs->trans(
'ListOfSupplierProposals');
340$help_url =
'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur';
346if ($search_all || $search_user > 0) {
347 $sql =
'SELECT DISTINCT';
349$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,';
350$sql .=
" typent.code as typent_code,";
351$sql .=
" state.code_departement as state_code, state.nom as state_name,";
352$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,';
353$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,';
354$sql .=
' sp.datec as date_creation, sp.tms as date_modification,';
355$sql .=
" p.rowid as project_id, p.ref as project_ref, p.title as project_title,";
356$sql .=
" u.firstname, u.lastname, u.photo, u.login, u.statut as ustatus, u.admin, u.employee, u.email as uemail";
358if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
359 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
360 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
364$parameters = array();
365$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
366$sql .= $hookmanager->resPrint;
367$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
368$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
369$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
370$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
371$sql .=
', '.MAIN_DB_PREFIX.
'supplier_proposal as sp';
372if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
373 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (sp.rowid = ef.fk_object)";
376 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'supplier_proposaldet as pd ON sp.rowid=pd.fk_supplier_proposal';
378$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON sp.fk_user_author = u.rowid';
379$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = sp.fk_projet";
380if ($search_user > 0) {
381 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as c";
382 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
384$sql .=
' WHERE sp.fk_soc = s.rowid';
385$sql .=
' AND sp.entity IN ('.getEntity(
'supplier_proposal').
')';
395if ($search_country) {
396 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
398if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
399 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
404if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
405 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
407 if ($search_company) {
410 if ($search_company_alias) {
415 $sql .=
natural_search(array(
'u.lastname',
'u.firstname',
'u.login'), $search_login);
417if ($search_montant_ht) {
420if ($search_montant_vat !=
'') {
423if ($search_montant_ttc !=
'') {
426if ($search_multicurrency_code !=
'') {
427 $sql .=
" AND sp.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
429if ($search_multicurrency_tx !=
'') {
430 $sql .=
natural_search(
'sp.multicurrency_tx', $search_multicurrency_tx, 1);
432if ($search_multicurrency_montant_ht !=
'') {
433 $sql .=
natural_search(
'sp.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
435if ($search_multicurrency_montant_vat !=
'') {
436 $sql .=
natural_search(
'sp.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
438if ($search_multicurrency_montant_ttc !=
'') {
439 $sql .=
natural_search(
'sp.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
441if ($search_project_ref !=
'') {
445 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
448 $sql .=
' AND s.rowid = '.((int) $socid);
450if ($search_status >= 0 && $search_status !=
'') {
451 $sql .=
' AND sp.fk_statut IN ('.$db->sanitize(
$db->escape($search_status)).
')';
453if ($search_date_start) {
454 $sql .=
" AND sp.date_livraison >= '".$db->idate($search_date_start).
"'";
456if ($search_date_end) {
457 $sql .=
" AND sp.date_livraison <= '".$db->idate($search_date_end).
"'";
459if ($search_date_valid_start) {
460 $sql .=
" AND sp.date_valid >= '".$db->idate($search_date_valid_start).
"'";
462if ($search_note_public) {
463 $sql .=
" AND p.note_public LIKE '%".$db->escape(
$db->escapeforlike($search_note_public)).
"%'";
465if ($search_note_private) {
466 $sql .=
" AND p.note_private LIKE '%".$db->escape(
$db->escapeforlike($search_note_private)).
"%'";
468if ($search_date_valid_end) {
469 $sql .=
" AND sp.date_valid <= '".$db->idate($search_date_valid_end).
"'";
475if ($search_user > 0) {
476 $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);
479if ($search_sale && $search_sale !=
'-1') {
480 if ($search_sale == -2) {
481 $sql .=
" AND ".getSalesRepresentativeSqlFilter(
'sp.fk_soc', 0, 1);
482 } elseif ($search_sale > 0) {
483 $sql .=
" AND ".getSalesRepresentativeSqlFilter(
'sp.fk_soc', (
int) $search_sale);
487if (!empty($searchCategorySupplierPropalList)) {
488 $searchCategorySupplierPropalSqlList = array();
489 $listofcategoryid =
'';
490 foreach ($searchCategorySupplierPropalList as $searchCategorySupplierPropal) {
491 if (intval($searchCategorySupplierPropal) == -2) {
492 $searchCategorySupplierPropalSqlList[] =
"NOT EXISTS (SELECT ck.fk_supplier_proposal FROM ".MAIN_DB_PREFIX.
"categorie_supplier_proposal as ck WHERE sp.rowid = ck.fk_supplier_proposal)";
493 } elseif (intval($searchCategorySupplierPropal) > 0) {
494 if ($searchCategorySupplierPropalOperator == 0) {
495 $searchCategorySupplierPropalSqlList[] =
" EXISTS (SELECT ck.fk_supplier_proposal FROM ".MAIN_DB_PREFIX.
"categorie_supplier_proposal as ck WHERE sp.rowid = ck.fk_supplier_proposal AND ck.fk_categorie = ".((int) $searchCategorySupplierPropal).
")";
497 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplierPropal);
501 if ($listofcategoryid) {
502 $searchCategorySupplierPropalSqlList[] =
" EXISTS (SELECT ck.fk_supplier_proposal FROM ".MAIN_DB_PREFIX.
"categorie_supplier_proposal as ck WHERE sp.rowid = ck.fk_supplier_proposal AND ck.fk_categorie IN (".
$db->sanitize($listofcategoryid).
"))";
504 if ($searchCategorySupplierPropalOperator == 1) {
505 if (!empty($searchCategorySupplierPropalSqlList)) {
506 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierPropalSqlList).
")";
509 if (!empty($searchCategorySupplierPropalSqlList)) {
510 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierPropalSqlList).
")";
515$searchCategoryProductOperator =
GETPOSTINT(
'search_category_product_operator');
516$searchCategoryProductList = array($search_product_category);
517if (!empty($searchCategoryProductList)) {
518 $searchCategoryProductSqlList = array();
519 $listofcategoryid =
'';
520 foreach ($searchCategoryProductList as $searchCategoryProduct) {
521 if (intval($searchCategoryProduct) == -2) {
522 $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)";
523 } elseif (intval($searchCategoryProduct) > 0) {
524 if ($searchCategoryProductOperator == 0) {
525 $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).
")";
527 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
531 if ($listofcategoryid) {
532 $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).
"))";
534 if ($searchCategoryProductOperator == 1) {
535 if (!empty($searchCategoryProductSqlList)) {
536 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
539 if (!empty($searchCategoryProductSqlList)) {
540 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
545include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
547$parameters = array();
548$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
549$sql .= $hookmanager->resPrint;
551$sql .=
$db->order($sortfield, $sortorder);
552$sql .=
', sp.ref DESC';
555$nbtotalofrecords =
'';
557 $resql =
$db->query($sql);
558 $nbtotalofrecords =
$db->num_rows($resql);
559 if (($page * $limit) > (
int) $nbtotalofrecords) {
565$sql .=
$db->plimit($limit + 1, $offset);
567$resql =
$db->query($sql);
575 $title = $langs->trans(
'SupplierProposals').
' - '.$soc->name;
577 $title = $langs->trans(
'SupplierProposals');
580 $num =
$db->num_rows($resql);
582 $arrayofselected = is_array($toselect) ? $toselect : array();
584 if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
585 $obj =
$db->fetch_object($resql);
589 header(
"Location: ".DOL_URL_ROOT.
'/supplier_proposal/card.php?id='.
$id);
596 llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-supplierproposal page-list');
600 $param .=
'&mode='.urlencode($mode);
602 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
603 $param .=
'&contextpage='.urlencode($contextpage);
605 if ($limit > 0 && $limit !=
$conf->liste_limit) {
606 $param .=
'&limit='.((int) $limit);
609 $param .=
'&search_all='.urlencode($search_all);
611 if ($search_date_startday) {
612 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
614 if ($search_date_startmonth) {
615 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
617 if ($search_date_startyear) {
618 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
620 if ($search_date_endday) {
621 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
623 if ($search_date_endmonth) {
624 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
626 if ($search_date_endyear) {
627 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
629 if ($search_date_valid_startday) {
630 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
632 if ($search_date_valid_startmonth) {
633 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
635 if ($search_date_valid_startyear) {
636 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
638 if ($search_date_valid_endday) {
639 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
641 if ($search_date_valid_endmonth) {
642 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
644 if ($search_date_valid_endyear) {
645 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
648 $param .=
'&search_ref='.urlencode($search_ref);
650 if ($search_company) {
651 $param .=
'&search_company='.urlencode($search_company);
653 if ($search_company_alias) {
654 $param .=
'&search_company_alias='.urlencode($search_company_alias);
656 if ($search_user > 0) {
657 $param .=
'&search_user='.urlencode((
string) ($search_user));
659 if ($search_sale > 0) {
660 $param .=
'&search_sale='.urlencode($search_sale);
662 if ($search_montant_ht) {
663 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
665 if ($search_multicurrency_code !=
'') {
666 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
668 if ($search_multicurrency_tx !=
'') {
669 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
671 if ($search_multicurrency_montant_ht !=
'') {
672 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
674 if ($search_multicurrency_montant_vat !=
'') {
675 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
677 if ($search_multicurrency_montant_ttc !=
'') {
678 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
681 $param .=
'&search_login='.urlencode($search_login);
683 if ($searchCategorySupplierPropalOperator == 1) {
684 $param .=
"&search_category_supplier_propal_operator=".urlencode((
string) ($searchCategorySupplierPropalOperator));
686 foreach ($searchCategorySupplierPropalList as $searchCategorySupplierPropal) {
687 $param .=
"&search_category_supplier_invoice_list[]=".urlencode($searchCategorySupplierPropal);
690 $param .=
'&search_town='.urlencode($search_town);
693 $param .=
'&search_zip='.urlencode($search_zip);
696 $param .=
'&socid='.urlencode((
string) ($socid));
698 if ($search_status !=
'') {
699 $param .=
'&search_status='.urlencode($search_status);
701 if ($search_project_ref >= 0) {
702 $param .=
"&search_project_ref=".urlencode($search_project_ref);
704 if ($optioncss !=
'') {
705 $param .=
'&optioncss='.urlencode($optioncss);
707 if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
708 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
711 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
714 $arrayofmassactions = array(
715 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
716 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
719 if (
isModEnabled(
'category') && $user->hasRight(
'supplier_proposal',
'lire')) {
720 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
722 if ($user->hasRight(
'supplier_proposal',
'supprimer')) {
723 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
725 if (in_array($massaction, array(
'presend',
'predelete'))) {
726 $arrayofmassactions = array();
728 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
730 $url = DOL_URL_ROOT.
'/supplier_proposal/card.php?action=create';
731 if (!empty($socid)) {
732 $url .=
'&socid='.$socid;
735 $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'));
736 $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'));
737 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'Statistics'),
'',
'fa fa-chart-bar imgforviewmode', DOL_URL_ROOT.
'/comm/propal/stats/index.php?mode=supplier'.preg_replace(
'/(&|\?)*(mode|groupby)=[^&]+/',
'', $param),
'', ($mode ==
'statistics' ? 2 : 1), array(
'morecss' =>
'reposition'));
739 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewAskPrice'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'supplier_proposal',
'creer'));
742 print
'<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
743 if ($optioncss !=
'') {
744 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
746 print
'<input type="hidden" name="token" value="'.newToken().
'">';
747 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
748 print
'<input type="hidden" name="action" value="list">';
749 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
750 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
751 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
753 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'supplier_proposal', 0, $newcardbutton,
'', $limit, 0, 0, 1);
755 $topicmail =
"SendSupplierProposalRef";
756 $modelmail =
"supplier_proposal_send";
758 $trackid =
'spro'.$object->id;
759 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
762 foreach ($fieldstosearchall as $key => $val) {
763 $fieldstosearchall[$key] = $langs->trans($val);
765 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
771 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'read')) {
772 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
774 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_SUPPLIER_PROPOSAL, $searchCategorySupplierPropalList,
'minwidth300', $searchCategorySupplierPropalOperator ? $searchCategorySupplierPropalOperator : 0);
777 if ($user->hasRight(
'user',
'user',
'lire')) {
778 $langs->load(
"commercial");
779 $moreforfilter .=
'<div class="divsearchfield">';
780 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
781 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
782 $moreforfilter .=
'</div>';
785 if ($user->hasRight(
'user',
'user',
'lire')) {
786 $moreforfilter .=
'<div class="divsearchfield">';
787 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
788 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
789 $moreforfilter .=
'</div>';
792 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
793 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
794 $moreforfilter .=
'<div class="divsearchfield">';
795 $tmptitle = $langs->trans(
'IncludingProductWithTag');
796 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 0, 0, 1);
797 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$form->selectarray(
'search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0,
'', 0, 0, 0,
'',
'maxwidth300 widthcentpercentminusx', 1);
798 $moreforfilter .=
'</div>';
800 $parameters = array();
801 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
802 if (empty($reshook)) {
803 $moreforfilter .= $hookmanager->resPrint;
805 $moreforfilter = $hookmanager->resPrint;
808 if (!empty($moreforfilter)) {
809 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
810 print $moreforfilter;
814 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
815 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
816 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
818 print
'<div class="div-table-responsive">';
819 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
823 print
'<tr class="liste_titre_filter">';
825 if (
$conf->main_checkbox_left_column) {
826 print
'<td class="liste_titre maxwidthsearch">';
827 $searchpicto = $form->showFilterButtons(
'left');
831 if (!empty($arrayfields[
'sp.ref'][
'checked'])) {
832 print
'<td class="liste_titre">';
833 print
'<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
837 if (!empty($arrayfields[
'sp.fk_projet'][
'checked'])) {
838 print
'<td class="liste_titre">';
839 print
'<input type="text" class="flat" name="search_project_ref" value="'.$search_project_ref.
'">';
842 if (!empty($arrayfields[
's.nom'][
'checked'])) {
843 print
'<td class="liste_titre left">';
844 print
'<input class="flat" type="text" size="12" name="search_company" value="'.dol_escape_htmltag((
string) $search_company).
'">';
847 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
848 print
'<td class="liste_titre left">';
849 print
'<input class="flat" type="text" size="12" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'">';
852 if (!empty($arrayfields[
's.town'][
'checked'])) {
853 print
'<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.
'"></td>';
855 if (!empty($arrayfields[
's.zip'][
'checked'])) {
856 print
'<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.$search_zip.
'"></td>';
859 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
860 print
'<td class="liste_titre">';
861 print
'<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
865 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
866 print
'<td class="liste_titre center">';
867 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
871 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
872 print
'<td class="liste_titre maxwidthonsmartphone center">';
873 print $form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0,
'', 0, 0, 0,
getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT',
'ASC'),
'', 1);
877 if (!empty($arrayfields[
'sp.date_valid'][
'checked'])) {
878 print
'<td class="liste_titre center">';
879 print
'<div class="nowrapfordate">';
880 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'));
882 print
'<div class="nowrapfordate">';
883 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'));
888 if (!empty($arrayfields[
'sp.date_livraison'][
'checked'])) {
889 print
'<td class="liste_titre center">';
890 print
'<div class="nowrapfordate">';
891 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
893 print
'<div class="nowrapfordate">';
894 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
899 if (!empty($arrayfields[
'sp.total_ht'][
'checked'])) {
901 print
'<td class="liste_titre right">';
902 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
905 if (!empty($arrayfields[
'sp.total_tva'][
'checked'])) {
907 print
'<td class="liste_titre right">';
908 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
911 if (!empty($arrayfields[
'sp.total_ttc'][
'checked'])) {
913 print
'<td class="liste_titre right">';
914 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
917 if (!empty($arrayfields[
'sp.multicurrency_code'][
'checked'])) {
919 print
'<td class="liste_titre">';
920 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
923 if (!empty($arrayfields[
'sp.multicurrency_tx'][
'checked'])) {
925 print
'<td class="liste_titre">';
926 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
929 if (!empty($arrayfields[
'sp.multicurrency_total_ht'][
'checked'])) {
931 print
'<td class="liste_titre right">';
932 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
935 if (!empty($arrayfields[
'sp.multicurrency_total_vat'][
'checked'])) {
937 print
'<td class="liste_titre right">';
938 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
941 if (!empty($arrayfields[
'sp.multicurrency_total_ttc'][
'checked'])) {
943 print
'<td class="liste_titre right">';
944 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
947 if (!empty($arrayfields[
'u.login'][
'checked'])) {
949 print
'<td class="liste_titre center">';
950 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
954 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
956 $parameters = array(
'arrayfields' => $arrayfields);
957 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
958 print $hookmanager->resPrint;
960 if (!empty($arrayfields[
'sp.datec'][
'checked'])) {
961 print
'<td class="liste_titre">';
965 if (!empty($arrayfields[
'sp.tms'][
'checked'])) {
966 print
'<td class="liste_titre">';
969 if (!empty($arrayfields[
'sp.note_public'][
'checked'])) {
971 print
'<td class="liste_titre">';
972 print
'<input class="flat maxwidth75" type="text" name="search_note_public" value="'.dol_escape_htmltag($search_note_public).
'">';
975 if (!empty($arrayfields[
'sp.note_private'][
'checked'])) {
977 print
'<td class="liste_titre">';
978 print
'<input class="flat maxwidth75" type="text" name="search_note_private" value="'.dol_escape_htmltag($search_note_private).
'">';
982 if (!empty($arrayfields[
'sp.fk_statut'][
'checked'])) {
983 print
'<td class="liste_titre center parentonrightofpage">';
984 $formpropal->selectProposalStatus($search_status, 1, 0, 1,
'supplier',
'search_status',
'search_status width100 onrightofpage');
988 if (!
$conf->main_checkbox_left_column) {
989 print
'<td class="liste_titre maxwidthsearch">';
990 $searchpicto = $form->showFilterButtons();
1001 print
'<tr class="liste_titre">';
1002 if (
$conf->main_checkbox_left_column) {
1003 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1006 if (!empty($arrayfields[
'sp.ref'][
'checked'])) {
1007 print_liste_field_titre($arrayfields[
'sp.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.ref',
'', $param,
'', $sortfield, $sortorder);
1011 if (!empty($arrayfields[
'sp.fk_projet'][
'checked'])) {
1012 print_liste_field_titre($arrayfields[
'sp.fk_projet'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
1016 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1017 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1020 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1022 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1025 if (!empty($arrayfields[
's.town'][
'checked'])) {
1026 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1029 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1030 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1033 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1034 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1037 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1038 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1041 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1042 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1045 if (!empty($arrayfields[
'sp.date_valid'][
'checked'])) {
1046 print_liste_field_titre($arrayfields[
'sp.date_valid'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.date_valid',
'', $param,
'', $sortfield, $sortorder,
'center ');
1049 if (!empty($arrayfields[
'sp.date_livraison'][
'checked'])) {
1050 print_liste_field_titre($arrayfields[
'sp.date_livraison'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1053 if (!empty($arrayfields[
'sp.total_ht'][
'checked'])) {
1054 print_liste_field_titre($arrayfields[
'sp.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1057 if (!empty($arrayfields[
'sp.total_tva'][
'checked'])) {
1058 print_liste_field_titre($arrayfields[
'sp.total_tva'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1061 if (!empty($arrayfields[
'sp.total_ttc'][
'checked'])) {
1062 print_liste_field_titre($arrayfields[
'sp.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1065 if (!empty($arrayfields[
'sp.multicurrency_code'][
'checked'])) {
1066 print_liste_field_titre($arrayfields[
'sp.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1069 if (!empty($arrayfields[
'sp.multicurrency_tx'][
'checked'])) {
1070 print_liste_field_titre($arrayfields[
'sp.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1073 if (!empty($arrayfields[
'sp.multicurrency_total_ht'][
'checked'])) {
1074 print_liste_field_titre($arrayfields[
'sp.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1077 if (!empty($arrayfields[
'sp.multicurrency_total_vat'][
'checked'])) {
1078 print_liste_field_titre($arrayfields[
'sp.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1081 if (!empty($arrayfields[
'sp.multicurrency_total_ttc'][
'checked'])) {
1082 print_liste_field_titre($arrayfields[
'sp.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1085 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1086 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder,
'center ');
1090 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1092 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
1093 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1094 print $hookmanager->resPrint;
1095 if (!empty($arrayfields[
'sp.datec'][
'checked'])) {
1096 print_liste_field_titre($arrayfields[
'sp.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1099 if (!empty($arrayfields[
'sp.tms'][
'checked'])) {
1100 print_liste_field_titre($arrayfields[
'sp.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap');
1103 if (!empty($arrayfields[
'sp.note_public'][
'checked'])) {
1104 print_liste_field_titre($arrayfields[
'sp.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1107 if (!empty($arrayfields[
'sp.note_private'][
'checked'])) {
1108 print_liste_field_titre($arrayfields[
'sp.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1111 if (!empty($arrayfields[
'sp.fk_statut'][
'checked'])) {
1112 print_liste_field_titre($arrayfields[
'sp.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1116 if (!
$conf->main_checkbox_left_column) {
1117 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1132 $totalarray = array(
'nbfield' => 0,
'val' => array(),
'pos' => array());
1137 $imaxinloop = ($limit ? min($num, $limit) : $num);
1138 while ($i < $imaxinloop) {
1139 $obj =
$db->fetch_object($resql);
1141 $objectstatic->id = $obj->rowid;
1142 $objectstatic->ref = $obj->ref;
1143 $objectstatic->note_public = $obj->note_public;
1144 $objectstatic->note_private = $obj->note_private;
1145 $objectstatic->status = $obj->status;
1148 $companystatic->id = $obj->socid;
1149 $companystatic->name = $obj->name;
1150 $companystatic->name_alias = $obj->alias;
1151 $companystatic->client = $obj->client;
1152 $companystatic->code_client = $obj->code_client;
1154 if ($mode ==
'kanban') {
1156 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1157 print
'<div class="box-flex-container kanban">';
1161 $userstatic->fetch($obj->fk_user_author);
1162 $objectstatic->delivery_date = $obj->dp;
1163 print $objectstatic->getKanbanView(
'', array(
'thirdparty' => $companystatic,
'userauthor' => $userstatic,
'selected' => in_array($obj->rowid, $arrayofselected)));
1164 if ($i == ($imaxinloop - 1)) {
1169 print
'<tr class="oddeven row-with-select '.((getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->status > 1) ?
'opacitymedium' :
'').
'">';
1171 if (
$conf->main_checkbox_left_column) {
1172 print
'<td class="nowrap center">';
1173 if ($massactionbutton || $massaction) {
1175 if (in_array($obj->rowid, $arrayofselected)) {
1178 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1182 if (!empty($arrayfields[
'sp.ref'][
'checked'])) {
1183 print
'<td class="nowraponall">';
1185 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1187 print
'<td class="nobordernopadding nowraponall">';
1188 print $objectstatic->getNomUrl(1,
'',
'', 0, -1, 1);
1194 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
1199 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
1202 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1203 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1204 print
'</td></tr></table>';
1213 if (!empty($arrayfields[
'sp.fk_projet'][
'checked'])) {
1214 $projectstatic->id = $obj->project_id;
1215 $projectstatic->ref = $obj->project_ref;
1216 $projectstatic->title = $obj->project_title;
1218 if ($obj->project_id > 0) {
1219 print $projectstatic->getNomUrl(1);
1228 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1229 print
'<td class="tdoverflowmax150">';
1230 print $companystatic->getNomUrl(1,
'supplier', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1238 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1239 print
'<td class="tdoverflowmax200">';
1240 print $companystatic->name_alias;
1248 if (!empty($arrayfields[
's.town'][
'checked'])) {
1249 print
'<td class="nocellnopadd">';
1257 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1258 print
'<td class="nocellnopadd">';
1266 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1267 print
"<td>".$obj->state_name.
"</td>\n";
1273 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1274 print
'<td class="center">';
1275 $tmparray =
getCountry($obj->fk_pays,
'all');
1276 print $tmparray[
'label'];
1283 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1284 print
'<td class="center">';
1285 if (empty($typenArray) || !is_array($typenArray) || count($typenArray) == 0) {
1286 $typenArray = $formcompany->typent_array(1);
1288 print $typenArray[$obj->typent_code];
1296 if (!empty($arrayfields[
'sp.date_valid'][
'checked'])) {
1297 print
'<td class="center">';
1306 if (!empty($arrayfields[
'sp.date_livraison'][
'checked'])) {
1307 print
'<td class="center">';
1316 if (!empty($arrayfields[
'sp.total_ht'][
'checked'])) {
1317 print
'<td class="right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
1324 $totalarray[
'val'][
'sp.total_ht'] += $obj->total_ht;
1327 if (!empty($arrayfields[
'sp.total_tva'][
'checked'])) {
1328 print
'<td class="right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
1335 $totalarray[
'val'][
'sp.total_tva'] += $obj->total_tva;
1338 if (!empty($arrayfields[
'sp.total_ttc'][
'checked'])) {
1339 print
'<td class="right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
1346 $totalarray[
'val'][
'sp.total_ttc'] += $obj->total_ttc;
1350 if (!empty($arrayfields[
'sp.multicurrency_code'][
'checked'])) {
1351 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
1358 if (!empty($arrayfields[
'sp.multicurrency_tx'][
'checked'])) {
1359 print
'<td class="nowrap">';
1360 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
1367 if (!empty($arrayfields[
'sp.multicurrency_total_ht'][
'checked'])) {
1368 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
1374 if (!empty($arrayfields[
'sp.multicurrency_total_vat'][
'checked'])) {
1375 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
1381 if (!empty($arrayfields[
'sp.multicurrency_total_ttc'][
'checked'])) {
1382 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
1388 $userstatic->id = $obj->fk_user_author;
1389 $userstatic->login = $obj->login;
1390 $userstatic->status = $obj->ustatus;
1391 $userstatic->lastname = $obj->name;
1392 $userstatic->firstname = $obj->firstname;
1393 $userstatic->photo = $obj->photo;
1394 $userstatic->admin = $obj->admin;
1395 $userstatic->ref = $obj->fk_user_author;
1396 $userstatic->employee = $obj->employee;
1397 $userstatic->email = $obj->uemail;
1400 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1401 print
'<td class="tdoverflowmax125">';
1402 if ($userstatic->id > 0) {
1403 print $userstatic->getNomUrl(-1,
'', 0, 0, 24, 1,
'login',
'', 1);
1412 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1414 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &
$totalarray);
1415 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1416 print $hookmanager->resPrint;
1418 if (!empty($arrayfields[
'sp.datec'][
'checked'])) {
1419 print
'<td class="center nowraponall">';
1427 if (!empty($arrayfields[
'sp.tms'][
'checked'])) {
1428 print
'<td class="center nowraponall">';
1436 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1437 print
'<td class="sensiblehtmlcontent center">';
1438 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_public, 5)).
'</div>';
1445 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1446 print
'<td class="sensiblehtmlcontent center">';
1447 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_private, 5)).
'</div>';
1454 if (!empty($arrayfields[
'sp.fk_statut'][
'checked'])) {
1455 print
'<td class="center">'.$objectstatic->getLibStatut(5).
"</td>\n";
1462 if (!
$conf->main_checkbox_left_column) {
1463 print
'<td class="nowrap center">';
1464 if ($massactionbutton || $massaction) {
1466 if (in_array($obj->rowid, $arrayofselected)) {
1469 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1479 $total += $obj->total_ht;
1480 $subtotal += $obj->total_ht;
1486 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1491 foreach ($arrayfields as $key => $val) {
1492 if (!empty($val[
'checked'])) {
1496 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1501 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1502 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
1503 print $hookmanager->resPrint;
1505 print
'</table>'.
"\n";
1506 print
'</div>'.
"\n";
1508 print
'</form>'.
"\n";
1510 $hidegeneratedfilelistifempty = 1;
1511 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1512 $hidegeneratedfilelistifempty = 0;
1516 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1517 $urlsource .= str_replace(
'&',
'&', $param);
1519 $filedir = $diroutputmassaction;
1521 $genallowed = $user->hasRight(
'supplier_proposal',
'lire');
1522 $delallowed = $user->hasRight(
'supplier_proposal',
'creer');
1524 print $formfile->showdocuments(
'massfilesarea_supplier_proposal',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage price ask supplier.
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
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.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.