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';
227if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
228 $search_sale = $user->id;
233$permissiontoread = $user->hasRight(
'supplier_proposal',
'lire');
234$permissiontodelete = $user->hasRight(
'supplier_proposal',
'supprimer');
235$permissiontoadd = $user->hasRight(
'supplier_proposal',
'creer');
241if (
GETPOST(
'cancel',
'alpha')) {
245if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
249$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
250$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
255if (empty($reshook)) {
257 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
260 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
265 $search_company =
'';
266 $search_company_alias =
'';
267 $search_montant_ht =
'';
268 $search_montant_vat =
'';
269 $search_montant_ttc =
'';
270 $search_multicurrency_code =
'';
271 $search_multicurrency_tx =
'';
272 $search_multicurrency_montant_ht =
'';
273 $search_multicurrency_montant_vat =
'';
274 $search_multicurrency_montant_ttc =
'';
275 $search_project_ref =
'';
277 $search_product_category =
'';
278 $searchCategorySupplierPropalList = array();
283 $search_country =
'';
284 $search_type_thirdparty =
'';
285 $search_date_startday =
'';
286 $search_date_startmonth =
'';
287 $search_date_startyear =
'';
288 $search_date_endday =
'';
289 $search_date_endmonth =
'';
290 $search_date_endyear =
'';
291 $search_date_start =
'';
292 $search_date_end =
'';
293 $search_date_valid_startday =
'';
294 $search_date_valid_startmonth =
'';
295 $search_date_valid_startyear =
'';
296 $search_date_valid_endday =
'';
297 $search_date_valid_endmonth =
'';
298 $search_date_valid_endyear =
'';
299 $search_date_valid_start =
'';
300 $search_date_valid_end =
'';
305 $objectclass =
'SupplierProposal';
306 $objectlabel =
'SupplierProposals';
307 $uploaddir = $conf->supplier_proposal->dir_output;
308 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
316$form =
new Form($db);
320$companystatic =
new Societe($db);
328 if (empty($search_company)) {
329 $search_company = $soc->name;
333$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
334$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
336$title = $langs->trans(
'ListOfSupplierProposals');
337$help_url =
'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur';
343if ($search_all || $search_user > 0) {
344 $sql =
'SELECT DISTINCT';
346$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,';
347$sql .=
" typent.code as typent_code,";
348$sql .=
" state.code_departement as state_code, state.nom as state_name,";
349$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,';
350$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,';
351$sql .=
' sp.datec as date_creation, sp.tms as date_modification,';
352$sql .=
" p.rowid as project_id, p.ref as project_ref, p.title as project_title,";
353$sql .=
" u.firstname, u.lastname, u.photo, u.login, u.statut as ustatus, u.admin, u.employee, u.email as uemail";
355if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
356 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
357 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
361$parameters = array();
362$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
363$sql .= $hookmanager->resPrint;
364$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
365$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
366$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
367$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
368$sql .=
', '.MAIN_DB_PREFIX.
'supplier_proposal as sp';
369if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
370 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (sp.rowid = ef.fk_object)";
373 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'supplier_proposaldet as pd ON sp.rowid=pd.fk_supplier_proposal';
375$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON sp.fk_user_author = u.rowid';
376$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = sp.fk_projet";
377if ($search_user > 0) {
378 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as c";
379 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
381$sql .=
' WHERE sp.fk_soc = s.rowid';
382$sql .=
' AND sp.entity IN ('.getEntity(
'supplier_proposal').
')';
392if ($search_country) {
393 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
395if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
396 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
401if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
402 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
404 if ($search_company) {
407 if ($search_company_alias) {
412 $sql .=
natural_search(array(
'u.lastname',
'u.firstname',
'u.login'), $search_login);
414if ($search_montant_ht) {
417if ($search_montant_vat !=
'') {
420if ($search_montant_ttc !=
'') {
423if ($search_multicurrency_code !=
'') {
424 $sql .=
" AND sp.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
426if ($search_multicurrency_tx !=
'') {
427 $sql .=
natural_search(
'sp.multicurrency_tx', $search_multicurrency_tx, 1);
429if ($search_multicurrency_montant_ht !=
'') {
430 $sql .=
natural_search(
'sp.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
432if ($search_multicurrency_montant_vat !=
'') {
433 $sql .=
natural_search(
'sp.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
435if ($search_multicurrency_montant_ttc !=
'') {
436 $sql .=
natural_search(
'sp.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
438if ($search_project_ref !=
'') {
442 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
445 $sql .=
' AND s.rowid = '.((int) $socid);
447if ($search_status >= 0 && $search_status !=
'') {
448 $sql .=
' AND sp.fk_statut IN ('.$db->sanitize($db->escape($search_status)).
')';
450if ($search_date_start) {
451 $sql .=
" AND sp.date_livraison >= '".$db->idate($search_date_start).
"'";
453if ($search_date_end) {
454 $sql .=
" AND sp.date_livraison <= '".$db->idate($search_date_end).
"'";
456if ($search_date_valid_start) {
457 $sql .=
" AND sp.date_valid >= '".$db->idate($search_date_valid_start).
"'";
459if ($search_note_public) {
460 $sql .=
" AND p.note_public LIKE '%".$db->escape($db->escapeforlike($search_note_public)).
"%'";
462if ($search_note_private) {
463 $sql .=
" AND p.note_private LIKE '%".$db->escape($db->escapeforlike($search_note_private)).
"%'";
465if ($search_date_valid_end) {
466 $sql .=
" AND sp.date_valid <= '".$db->idate($search_date_valid_end).
"'";
472if ($search_user > 0) {
473 $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);
476if ($search_sale && $search_sale !=
'-1') {
477 if ($search_sale == -2) {
478 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = sp.fk_soc)";
479 } elseif ($search_sale > 0) {
480 $sql .=
" AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = sp.fk_soc AND sc.fk_user = ".((int) $search_sale).
")";
484if (!empty($searchCategorySupplierPropalList)) {
485 $searchCategorySupplierPropalSqlList = array();
486 $listofcategoryid =
'';
487 foreach ($searchCategorySupplierPropalList as $searchCategorySupplierPropal) {
488 if (intval($searchCategorySupplierPropal) == -2) {
489 $searchCategorySupplierPropalSqlList[] =
"NOT EXISTS (SELECT ck.fk_supplier_proposal FROM ".MAIN_DB_PREFIX.
"categorie_supplier_proposal as ck WHERE sp.rowid = ck.fk_supplier_proposal)";
490 } elseif (intval($searchCategorySupplierPropal) > 0) {
491 if ($searchCategorySupplierPropalOperator == 0) {
492 $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).
")";
494 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategorySupplierPropal);
498 if ($listofcategoryid) {
499 $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).
"))";
501 if ($searchCategorySupplierPropalOperator == 1) {
502 if (!empty($searchCategorySupplierPropalSqlList)) {
503 $sql .=
" AND (".implode(
' OR ', $searchCategorySupplierPropalSqlList).
")";
506 if (!empty($searchCategorySupplierPropalSqlList)) {
507 $sql .=
" AND (".implode(
' AND ', $searchCategorySupplierPropalSqlList).
")";
512$searchCategoryProductOperator =
GETPOSTINT(
'search_category_product_operator');
513$searchCategoryProductList = array($search_product_category);
514if (!empty($searchCategoryProductList)) {
515 $searchCategoryProductSqlList = array();
516 $listofcategoryid =
'';
517 foreach ($searchCategoryProductList as $searchCategoryProduct) {
518 if (intval($searchCategoryProduct) == -2) {
519 $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)";
520 } elseif (intval($searchCategoryProduct) > 0) {
521 if ($searchCategoryProductOperator == 0) {
522 $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).
")";
524 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
528 if ($listofcategoryid) {
529 $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).
"))";
531 if ($searchCategoryProductOperator == 1) {
532 if (!empty($searchCategoryProductSqlList)) {
533 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
536 if (!empty($searchCategoryProductSqlList)) {
537 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
542include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
544$parameters = array();
545$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
546$sql .= $hookmanager->resPrint;
548$sql .= $db->order($sortfield, $sortorder);
549$sql .=
', sp.ref DESC';
552$nbtotalofrecords =
'';
554 $resql = $db->query($sql);
555 $nbtotalofrecords = $db->num_rows($resql);
556 if (($page * $limit) > (
int) $nbtotalofrecords) {
562$sql .= $db->plimit($limit + 1, $offset);
564$resql = $db->query($sql);
567 $userstatic =
new User($db);
572 $title = $langs->trans(
'SupplierProposals').
' - '.$soc->name;
574 $title = $langs->trans(
'SupplierProposals');
577 $num = $db->num_rows($resql);
579 $arrayofselected = is_array($toselect) ? $toselect : array();
581 if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
582 $obj = $db->fetch_object($resql);
586 header(
"Location: ".DOL_URL_ROOT.
'/supplier_proposal/card.php?id='.
$id);
593 llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-supplierproposal page-list');
597 $param .=
'&mode='.urlencode($mode);
599 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
600 $param .=
'&contextpage='.urlencode($contextpage);
602 if ($limit > 0 && $limit != $conf->liste_limit) {
603 $param .=
'&limit='.((int) $limit);
606 $param .=
'&search_all='.urlencode($search_all);
608 if ($search_date_startday) {
609 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
611 if ($search_date_startmonth) {
612 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
614 if ($search_date_startyear) {
615 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
617 if ($search_date_endday) {
618 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
620 if ($search_date_endmonth) {
621 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
623 if ($search_date_endyear) {
624 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
626 if ($search_date_valid_startday) {
627 $param .=
'&search_date_valid_startday='.urlencode((
string) ($search_date_valid_startday));
629 if ($search_date_valid_startmonth) {
630 $param .=
'&search_date_valid_startmonth='.urlencode((
string) ($search_date_valid_startmonth));
632 if ($search_date_valid_startyear) {
633 $param .=
'&search_date_valid_startyear='.urlencode((
string) ($search_date_valid_startyear));
635 if ($search_date_valid_endday) {
636 $param .=
'&search_date_valid_endday='.urlencode((
string) ($search_date_valid_endday));
638 if ($search_date_valid_endmonth) {
639 $param .=
'&search_date_valid_endmonth='.urlencode((
string) ($search_date_valid_endmonth));
641 if ($search_date_valid_endyear) {
642 $param .=
'&search_date_valid_endyear='.urlencode((
string) ($search_date_valid_endyear));
645 $param .=
'&search_ref='.urlencode($search_ref);
647 if ($search_company) {
648 $param .=
'&search_company='.urlencode($search_company);
650 if ($search_company_alias) {
651 $param .=
'&search_company_alias='.urlencode($search_company_alias);
653 if ($search_user > 0) {
654 $param .=
'&search_user='.urlencode((
string) ($search_user));
656 if ($search_sale > 0) {
657 $param .=
'&search_sale='.urlencode($search_sale);
659 if ($search_montant_ht) {
660 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
662 if ($search_multicurrency_code !=
'') {
663 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
665 if ($search_multicurrency_tx !=
'') {
666 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
668 if ($search_multicurrency_montant_ht !=
'') {
669 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
671 if ($search_multicurrency_montant_vat !=
'') {
672 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
674 if ($search_multicurrency_montant_ttc !=
'') {
675 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
678 $param .=
'&search_login='.urlencode($search_login);
680 if ($searchCategorySupplierPropalOperator == 1) {
681 $param .=
"&search_category_supplier_propal_operator=".urlencode((
string) ($searchCategorySupplierPropalOperator));
683 foreach ($searchCategorySupplierPropalList as $searchCategorySupplierPropal) {
684 $param .=
"&search_category_supplier_invoice_list[]=".urlencode($searchCategorySupplierPropal);
687 $param .=
'&search_town='.urlencode($search_town);
690 $param .=
'&search_zip='.urlencode($search_zip);
693 $param .=
'&socid='.urlencode((
string) ($socid));
695 if ($search_status !=
'') {
696 $param .=
'&search_status='.urlencode($search_status);
698 if ($search_project_ref >= 0) {
699 $param .=
"&search_project_ref=".urlencode($search_project_ref);
701 if ($optioncss !=
'') {
702 $param .=
'&optioncss='.urlencode($optioncss);
704 if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
705 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
708 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
711 $arrayofmassactions = array(
712 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
713 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
716 if (
isModEnabled(
'category') && $user->hasRight(
'supplier_proposal',
'lire')) {
717 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
719 if ($user->hasRight(
'supplier_proposal',
'supprimer')) {
720 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
722 if (in_array($massaction, array(
'presend',
'predelete'))) {
723 $arrayofmassactions = array();
725 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
727 $url = DOL_URL_ROOT.
'/supplier_proposal/card.php?action=create';
728 if (!empty($socid)) {
729 $url .=
'&socid='.$socid;
732 $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'));
733 $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'));
735 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewAskPrice'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'supplier_proposal',
'creer'));
738 print
'<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
739 if ($optioncss !=
'') {
740 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
742 print
'<input type="hidden" name="token" value="'.newToken().
'">';
743 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
744 print
'<input type="hidden" name="action" value="list">';
745 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
746 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
747 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
749 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'supplier_proposal', 0, $newcardbutton,
'', $limit, 0, 0, 1);
751 $topicmail =
"SendSupplierProposalRef";
752 $modelmail =
"supplier_proposal_send";
754 $trackid =
'spro'.$object->id;
755 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
758 foreach ($fieldstosearchall as $key => $val) {
759 $fieldstosearchall[$key] = $langs->trans($val);
761 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
767 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'read')) {
768 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
770 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_SUPPLIER_PROPOSAL, $searchCategorySupplierPropalList,
'minwidth300', $searchCategorySupplierPropalOperator ? $searchCategorySupplierPropalOperator : 0);
773 if ($user->hasRight(
'user',
'user',
'lire')) {
774 $langs->load(
"commercial");
775 $moreforfilter .=
'<div class="divsearchfield">';
776 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
777 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
778 $moreforfilter .=
'</div>';
781 if ($user->hasRight(
'user',
'user',
'lire')) {
782 $moreforfilter .=
'<div class="divsearchfield">';
783 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
784 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
785 $moreforfilter .=
'</div>';
788 if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
789 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
790 $moreforfilter .=
'<div class="divsearchfield">';
791 $tmptitle = $langs->trans(
'IncludingProductWithTag');
792 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 0, 0, 1);
793 $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);
794 $moreforfilter .=
'</div>';
796 $parameters = array();
797 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
798 if (empty($reshook)) {
799 $moreforfilter .= $hookmanager->resPrint;
801 $moreforfilter = $hookmanager->resPrint;
804 if (!empty($moreforfilter)) {
805 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
806 print $moreforfilter;
810 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
811 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
812 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
814 print
'<div class="div-table-responsive">';
815 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
819 print
'<tr class="liste_titre_filter">';
822 print
'<td class="liste_titre maxwidthsearch">';
823 $searchpicto = $form->showFilterButtons(
'left');
827 if (!empty($arrayfields[
'sp.ref'][
'checked'])) {
828 print
'<td class="liste_titre">';
829 print
'<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
833 if (!empty($arrayfields[
'sp.fk_projet'][
'checked'])) {
834 print
'<td class="liste_titre">';
835 print
'<input type="text" class="flat" name="search_project_ref" value="'.$search_project_ref.
'">';
838 if (!empty($arrayfields[
's.nom'][
'checked'])) {
839 print
'<td class="liste_titre left">';
840 print
'<input class="flat" type="text" size="12" name="search_company" value="'.dol_escape_htmltag((
string) $search_company).
'">';
843 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
844 print
'<td class="liste_titre left">';
845 print
'<input class="flat" type="text" size="12" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'">';
848 if (!empty($arrayfields[
's.town'][
'checked'])) {
849 print
'<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.
'"></td>';
851 if (!empty($arrayfields[
's.zip'][
'checked'])) {
852 print
'<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.$search_zip.
'"></td>';
855 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
856 print
'<td class="liste_titre">';
857 print
'<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
861 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
862 print
'<td class="liste_titre center">';
863 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
867 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
868 print
'<td class="liste_titre maxwidthonsmartphone center">';
869 print $form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0,
'', 0, 0, 0, (!
getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT') ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT),
'', 1);
873 if (!empty($arrayfields[
'sp.date_valid'][
'checked'])) {
874 print
'<td class="liste_titre center">';
875 print
'<div class="nowrapfordate">';
876 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'));
878 print
'<div class="nowrapfordate">';
879 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'));
884 if (!empty($arrayfields[
'sp.date_livraison'][
'checked'])) {
885 print
'<td class="liste_titre center">';
886 print
'<div class="nowrapfordate">';
887 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
889 print
'<div class="nowrapfordate">';
890 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
895 if (!empty($arrayfields[
'sp.total_ht'][
'checked'])) {
897 print
'<td class="liste_titre right">';
898 print
'<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
901 if (!empty($arrayfields[
'sp.total_tva'][
'checked'])) {
903 print
'<td class="liste_titre right">';
904 print
'<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
907 if (!empty($arrayfields[
'sp.total_ttc'][
'checked'])) {
909 print
'<td class="liste_titre right">';
910 print
'<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
913 if (!empty($arrayfields[
'sp.multicurrency_code'][
'checked'])) {
915 print
'<td class="liste_titre">';
916 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
919 if (!empty($arrayfields[
'sp.multicurrency_tx'][
'checked'])) {
921 print
'<td class="liste_titre">';
922 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
925 if (!empty($arrayfields[
'sp.multicurrency_total_ht'][
'checked'])) {
927 print
'<td class="liste_titre right">';
928 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
931 if (!empty($arrayfields[
'sp.multicurrency_total_vat'][
'checked'])) {
933 print
'<td class="liste_titre right">';
934 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
937 if (!empty($arrayfields[
'sp.multicurrency_total_ttc'][
'checked'])) {
939 print
'<td class="liste_titre right">';
940 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
943 if (!empty($arrayfields[
'u.login'][
'checked'])) {
945 print
'<td class="liste_titre center">';
946 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
950 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
952 $parameters = array(
'arrayfields' => $arrayfields);
953 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
954 print $hookmanager->resPrint;
956 if (!empty($arrayfields[
'sp.datec'][
'checked'])) {
957 print
'<td class="liste_titre">';
961 if (!empty($arrayfields[
'sp.tms'][
'checked'])) {
962 print
'<td class="liste_titre">';
965 if (!empty($arrayfields[
'sp.note_public'][
'checked'])) {
967 print
'<td class="liste_titre">';
968 print
'<input class="flat maxwidth75" type="text" name="search_note_public" value="'.dol_escape_htmltag($search_note_public).
'">';
971 if (!empty($arrayfields[
'sp.note_private'][
'checked'])) {
973 print
'<td class="liste_titre">';
974 print
'<input class="flat maxwidth75" type="text" name="search_note_private" value="'.dol_escape_htmltag($search_note_private).
'">';
978 if (!empty($arrayfields[
'sp.fk_statut'][
'checked'])) {
979 print
'<td class="liste_titre center parentonrightofpage">';
980 $formpropal->selectProposalStatus($search_status, 1, 0, 1,
'supplier',
'search_status',
'search_status width100 onrightofpage');
985 print
'<td class="liste_titre maxwidthsearch">';
986 $searchpicto = $form->showFilterButtons();
997 print
'<tr class="liste_titre">';
999 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1002 if (!empty($arrayfields[
'sp.ref'][
'checked'])) {
1003 print_liste_field_titre($arrayfields[
'sp.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.ref',
'', $param,
'', $sortfield, $sortorder);
1007 if (!empty($arrayfields[
'sp.fk_projet'][
'checked'])) {
1008 print_liste_field_titre($arrayfields[
'sp.fk_projet'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
1012 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1013 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1016 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1018 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1021 if (!empty($arrayfields[
's.town'][
'checked'])) {
1022 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1025 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1026 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1029 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1030 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1033 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1034 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1037 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1038 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1041 if (!empty($arrayfields[
'sp.date_valid'][
'checked'])) {
1042 print_liste_field_titre($arrayfields[
'sp.date_valid'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.date_valid',
'', $param,
'', $sortfield, $sortorder,
'center ');
1045 if (!empty($arrayfields[
'sp.date_livraison'][
'checked'])) {
1046 print_liste_field_titre($arrayfields[
'sp.date_livraison'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1049 if (!empty($arrayfields[
'sp.total_ht'][
'checked'])) {
1050 print_liste_field_titre($arrayfields[
'sp.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1053 if (!empty($arrayfields[
'sp.total_tva'][
'checked'])) {
1054 print_liste_field_titre($arrayfields[
'sp.total_tva'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1057 if (!empty($arrayfields[
'sp.total_ttc'][
'checked'])) {
1058 print_liste_field_titre($arrayfields[
'sp.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'sp.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1061 if (!empty($arrayfields[
'sp.multicurrency_code'][
'checked'])) {
1062 print_liste_field_titre($arrayfields[
'sp.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1065 if (!empty($arrayfields[
'sp.multicurrency_tx'][
'checked'])) {
1066 print_liste_field_titre($arrayfields[
'sp.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1069 if (!empty($arrayfields[
'sp.multicurrency_total_ht'][
'checked'])) {
1070 print_liste_field_titre($arrayfields[
'sp.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1073 if (!empty($arrayfields[
'sp.multicurrency_total_vat'][
'checked'])) {
1074 print_liste_field_titre($arrayfields[
'sp.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1077 if (!empty($arrayfields[
'sp.multicurrency_total_ttc'][
'checked'])) {
1078 print_liste_field_titre($arrayfields[
'sp.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'sp.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1081 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1082 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder,
'center ');
1086 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1088 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
1089 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1090 print $hookmanager->resPrint;
1091 if (!empty($arrayfields[
'sp.datec'][
'checked'])) {
1092 print_liste_field_titre($arrayfields[
'sp.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1095 if (!empty($arrayfields[
'sp.tms'][
'checked'])) {
1096 print_liste_field_titre($arrayfields[
'sp.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap');
1099 if (!empty($arrayfields[
'sp.note_public'][
'checked'])) {
1100 print_liste_field_titre($arrayfields[
'sp.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1103 if (!empty($arrayfields[
'sp.note_private'][
'checked'])) {
1104 print_liste_field_titre($arrayfields[
'sp.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1107 if (!empty($arrayfields[
'sp.fk_statut'][
'checked'])) {
1108 print_liste_field_titre($arrayfields[
'sp.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"sp.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1113 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1123 $userstatic =
new User($db);
1125 $projectstatic =
new Project($db);
1128 $totalarray = array(
'nbfield' => 0,
'val' => array(),
'pos' => array());
1133 $imaxinloop = ($limit ? min($num, $limit) : $num);
1134 while ($i < $imaxinloop) {
1135 $obj = $db->fetch_object($resql);
1137 $objectstatic->id = $obj->rowid;
1138 $objectstatic->ref = $obj->ref;
1139 $objectstatic->note_public = $obj->note_public;
1140 $objectstatic->note_private = $obj->note_private;
1141 $objectstatic->status = $obj->status;
1144 $companystatic->id = $obj->socid;
1145 $companystatic->name = $obj->name;
1146 $companystatic->name_alias = $obj->alias;
1147 $companystatic->client = $obj->client;
1148 $companystatic->code_client = $obj->code_client;
1150 if ($mode ==
'kanban') {
1152 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1153 print
'<div class="box-flex-container kanban">';
1157 $userstatic->fetch($obj->fk_user_author);
1158 $objectstatic->delivery_date = $obj->dp;
1159 print $objectstatic->getKanbanView(
'', array(
'thirdparty' => $companystatic,
'userauthor' => $userstatic,
'selected' => in_array($obj->rowid, $arrayofselected)));
1160 if ($i == ($imaxinloop - 1)) {
1165 print
'<tr class="oddeven row-with-select '.((getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->status > 1) ?
'opacitymedium' :
'').
'">';
1168 print
'<td class="nowrap center">';
1169 if ($massactionbutton || $massaction) {
1171 if (in_array($obj->rowid, $arrayofselected)) {
1174 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1178 if (!empty($arrayfields[
'sp.ref'][
'checked'])) {
1179 print
'<td class="nowraponall">';
1181 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1183 print
'<td class="nobordernopadding nowraponall">';
1184 print $objectstatic->getNomUrl(1,
'',
'', 0, -1, 1);
1190 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
1195 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
1198 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1199 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1200 print
'</td></tr></table>';
1209 if (!empty($arrayfields[
'sp.fk_projet'][
'checked'])) {
1210 $projectstatic->id = $obj->project_id;
1211 $projectstatic->ref = $obj->project_ref;
1212 $projectstatic->title = $obj->project_title;
1214 if ($obj->project_id > 0) {
1215 print $projectstatic->getNomUrl(1);
1224 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1225 print
'<td class="tdoverflowmax150">';
1226 print $companystatic->getNomUrl(1,
'supplier', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1234 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1235 print
'<td class="tdoverflowmax200">';
1236 print $companystatic->name_alias;
1244 if (!empty($arrayfields[
's.town'][
'checked'])) {
1245 print
'<td class="nocellnopadd">';
1253 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1254 print
'<td class="nocellnopadd">';
1262 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1263 print
"<td>".$obj->state_name.
"</td>\n";
1269 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1270 print
'<td class="center">';
1271 $tmparray =
getCountry($obj->fk_pays,
'all');
1272 print $tmparray[
'label'];
1279 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1280 print
'<td class="center">';
1281 if (empty($typenArray) || !is_array($typenArray) || count($typenArray) == 0) {
1282 $typenArray = $formcompany->typent_array(1);
1284 print $typenArray[$obj->typent_code];
1292 if (!empty($arrayfields[
'sp.date_valid'][
'checked'])) {
1293 print
'<td class="center">';
1302 if (!empty($arrayfields[
'sp.date_livraison'][
'checked'])) {
1303 print
'<td class="center">';
1312 if (!empty($arrayfields[
'sp.total_ht'][
'checked'])) {
1313 print
'<td class="right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
1320 $totalarray[
'val'][
'sp.total_ht'] += $obj->total_ht;
1323 if (!empty($arrayfields[
'sp.total_tva'][
'checked'])) {
1324 print
'<td class="right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
1331 $totalarray[
'val'][
'sp.total_tva'] += $obj->total_tva;
1334 if (!empty($arrayfields[
'sp.total_ttc'][
'checked'])) {
1335 print
'<td class="right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
1342 $totalarray[
'val'][
'sp.total_ttc'] += $obj->total_ttc;
1346 if (!empty($arrayfields[
'sp.multicurrency_code'][
'checked'])) {
1347 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
1354 if (!empty($arrayfields[
'sp.multicurrency_tx'][
'checked'])) {
1355 print
'<td class="nowrap">';
1356 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
1363 if (!empty($arrayfields[
'sp.multicurrency_total_ht'][
'checked'])) {
1364 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
1370 if (!empty($arrayfields[
'sp.multicurrency_total_vat'][
'checked'])) {
1371 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
1377 if (!empty($arrayfields[
'sp.multicurrency_total_ttc'][
'checked'])) {
1378 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
1384 $userstatic->id = $obj->fk_user_author;
1385 $userstatic->login = $obj->login;
1386 $userstatic->status = $obj->ustatus;
1387 $userstatic->lastname = $obj->name;
1388 $userstatic->firstname = $obj->firstname;
1389 $userstatic->photo = $obj->photo;
1390 $userstatic->admin = $obj->admin;
1391 $userstatic->ref = $obj->fk_user_author;
1392 $userstatic->employee = $obj->employee;
1393 $userstatic->email = $obj->uemail;
1396 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1397 print
'<td class="tdoverflowmax125">';
1398 if ($userstatic->id > 0) {
1399 print $userstatic->getNomUrl(-1,
'', 0, 0, 24, 1,
'login',
'', 1);
1408 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1410 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1411 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1412 print $hookmanager->resPrint;
1414 if (!empty($arrayfields[
'sp.datec'][
'checked'])) {
1415 print
'<td class="center nowraponall">';
1416 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1423 if (!empty($arrayfields[
'sp.tms'][
'checked'])) {
1424 print
'<td class="center nowraponall">';
1425 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
1432 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1433 print
'<td class="sensiblehtmlcontent center">';
1434 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_public, 5)).
'</div>';
1441 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1442 print
'<td class="sensiblehtmlcontent center">';
1443 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_private, 5)).
'</div>';
1450 if (!empty($arrayfields[
'sp.fk_statut'][
'checked'])) {
1451 print
'<td class="center">'.$objectstatic->getLibStatut(5).
"</td>\n";
1459 print
'<td class="nowrap center">';
1460 if ($massactionbutton || $massaction) {
1462 if (in_array($obj->rowid, $arrayofselected)) {
1465 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1475 $total += $obj->total_ht;
1476 $subtotal += $obj->total_ht;
1482 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1487 foreach ($arrayfields as $key => $val) {
1488 if (!empty($val[
'checked'])) {
1492 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1497 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1498 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
1499 print $hookmanager->resPrint;
1501 print
'</table>'.
"\n";
1502 print
'</div>'.
"\n";
1504 print
'</form>'.
"\n";
1506 $hidegeneratedfilelistifempty = 1;
1507 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1508 $hidegeneratedfilelistifempty = 0;
1512 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1513 $urlsource .= str_replace(
'&',
'&', $param);
1515 $filedir = $diroutputmassaction;
1517 $genallowed = $user->hasRight(
'supplier_proposal',
'lire');
1518 $delallowed = $user->hasRight(
'supplier_proposal',
'creer');
1520 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...
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)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
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.
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...
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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.