From b34c0beddc18c210cb7619b1b8e5694a90821f34 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 16 Dec 2024 13:45:48 +0100 Subject: [PATCH 1/3] Debug v21 - filter import id --- htdocs/comm/propal/list.php | 48 ++++++++++++++++++++++++++++------ htdocs/commande/list.php | 33 ++++++++++++++++------- htdocs/compta/facture/list.php | 46 +++++++++++++++++++++++++++----- 3 files changed, 103 insertions(+), 24 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 2cc4be7ed80..37d49be32a2 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -154,6 +154,7 @@ $search_date_signature_start = dol_mktime(0, 0, 0, $search_date_signature_startm $search_date_signature_end = dol_mktime(23, 59, 59, $search_date_signature_endmonth, $search_date_signature_endday, $search_date_signature_endyear); $search_status = GETPOST('search_status', 'alpha'); $search_note_public = GETPOST('search_note_public', 'alpha'); +$search_import_key = trim(GETPOST("search_import_key", "alpha")); $search_option = GETPOST('search_option', 'alpha'); if ($search_option == 'late') { @@ -267,6 +268,7 @@ $arrayfields = array( 'p.date_cloture' => array('label' => "DateClosing", 'checked' => 0, 'position' => 500), 'p.note_public' => array('label' => 'NotePublic', 'checked' => 0, 'position' => 510, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES'))), 'p.note_private' => array('label' => 'NotePrivate', 'checked' => 0, 'position' => 511, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES'))), + 'p.import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 999), 'p.fk_statut' => array('label' => "Status", 'checked' => 1, 'position' => 1000), ); @@ -396,7 +398,6 @@ if (empty($reshook)) { $search_availability = ''; $search_option = ''; $search_status = ''; - $search_categ_cus = 0; $search_fk_cond_reglement = ''; $search_fk_shipping_method = ''; $search_fk_input_reason = ''; @@ -409,8 +410,13 @@ if (empty($reshook)) { $search_date_signature_endyear = ''; $search_date_signature_start = ''; $search_date_signature_end = ''; + $search_import_key = ''; + $search_categ_cus = 0; + + $search_all = ''; $toselect = array(); $search_array_options = array(); + $socid = 0; } @@ -578,7 +584,7 @@ $sql .= " typent.code as typent_code,"; $sql .= " ava.rowid as availability,"; $sql .= " country.code as country_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; -$sql .= ' p.rowid, p.entity as propal_entity, p.note_private, p.total_ht, p.total_tva, p.total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut as status, p.fk_user_author, p.datep as dp, p.fin_validite as dfv, p.date_livraison as ddelivery,'; +$sql .= ' p.rowid, p.entity as propal_entity, p.note_private, p.total_ht, p.total_tva, p.total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut as status, p.import_key, p.fk_user_author, p.datep as dp, p.fin_validite as dfv, p.date_livraison as ddelivery,'; $sql .= ' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,'; $sql .= ' p.datec as date_creation, p.tms as date_modification, p.date_cloture as date_cloture,'; $sql .= ' p.date_signature as dsignature,'; @@ -753,6 +759,9 @@ if ($search_date_signature_end) { if ($search_note_public) { $sql .= " AND p.note_public LIKE '%".$db->escape($db->escapeforlike($search_note_public))."%'"; } +if ($search_import_key) { + $sql .= natural_search("s.import_key", $search_import_key); +} // Search on user if ($search_user > 0) { $sql .= " AND EXISTS ("; @@ -921,6 +930,12 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } +if ($optioncss != '') { + $param .= '&optioncss='.urlencode($optioncss); +} +if ($socid > 0) { + $param .= '&socid='.urlencode((string) ($socid)); +} if ($search_all) { $param .= '&search_all='.urlencode($search_all); } @@ -1026,12 +1041,6 @@ if ($search_town) { if ($search_zip) { $param .= '&search_zip='.urlencode($search_zip); } -if ($socid > 0) { - $param .= '&socid='.urlencode((string) ($socid)); -} -if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); -} if ($search_categ_cus > 0) { $param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus)); } @@ -1086,6 +1095,9 @@ if ($search_date_signature_endmonth) { if ($search_date_signature_endyear) { $param .= '&search_date_signature_endyear='.urlencode((string) ($search_date_signature_endyear)); } +if ($search_import_key != '') { + $param .= '&search_import_key='.urlencode($search_import_key); +} // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -1499,6 +1511,12 @@ if (!empty($arrayfields['p.note_private']['checked'])) { print ''; print ''; } +// Import key +if (!empty($arrayfields['p.import_key']['checked'])) { + print ''; + print ''; + print ''; +} // Status if (!empty($arrayfields['p.fk_statut']['checked'])) { print ''; @@ -1715,6 +1733,11 @@ if (!empty($arrayfields['p.note_private']['checked'])) { print_liste_field_titre($arrayfields['p.note_private']['label'], $_SERVER["PHP_SELF"], "p.note_private", "", $param, '', $sortfield, $sortorder, 'center nowrap '); $totalarray['nbfield']++; } +// Import key +if (!empty($arrayfields['p.import_key']['checked'])) { + print_liste_field_titre($arrayfields['p.import_key']['label'], $_SERVER["PHP_SELF"], "p.import_key", "", $param, '', $sortfield, $sortorder, 'center '); +} +// Status if (!empty($arrayfields['p.fk_statut']['checked'])) { print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; @@ -2375,6 +2398,15 @@ while ($i < $imaxinloop) { $totalarray['nbfield']++; } } + + // Import key + if (!empty($arrayfields['p.import_key']['checked'])) { + print ''.dol_escape_htmltag($obj->import_key).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status if (!empty($arrayfields['p.fk_statut']['checked'])) { print ''.$objectstatic->getLibStatut(5).''; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 06806021db2..4797d6635db 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -148,6 +148,8 @@ $search_deliveryday = ''; $search_deliverymonth = ''; $search_deliveryyear = ''; +$search_import_key = trim(GETPOST("search_import_key", "alpha")); + $diroutputmassaction = $conf->commande->multidir_output[$conf->entity].'/temp/massgeneration/'.$user->id; // Load variable for pagination @@ -335,9 +337,6 @@ if (empty($reshook)) { $search_project = ''; $search_status = ''; $search_billed = ''; - $toselect = array(); - $search_array_options = array(); - $search_categ_cus = 0; $search_datecloture_start = ''; $search_datecloture_end = ''; $search_fk_cond_reglement = ''; @@ -345,6 +344,12 @@ if (empty($reshook)) { $search_fk_mode_reglement = ''; $search_fk_input_reason = ''; $search_option = ''; + $search_import_key = ''; + $search_categ_cus = 0; + + $search_all = ''; + $toselect = array(); + $search_array_options = array(); } if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) { @@ -1080,6 +1085,9 @@ if ($search_fk_mode_reglement > 0) { if ($search_fk_input_reason > 0) { $sql .= " AND c.fk_input_reason = ".((int) $search_fk_input_reason); } +if ($search_import_key) { + $sql .= natural_search("s.import_key", $search_import_key); +} // Search on user if ($search_user > 0) { $sql .= " AND EXISTS ("; @@ -1266,6 +1274,12 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } +if ($optioncss != '') { + $param .= '&optioncss='.urlencode($optioncss); +} +if ($show_files) { + $param .= '&show_files='.urlencode((string) ($show_files)); +} if ($search_all) { $param .= '&search_all='.urlencode($search_all); } @@ -1374,12 +1388,6 @@ if ($search_product_category != '') { if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { $param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus)); } -if ($show_files) { - $param .= '&show_files='.urlencode((string) ($show_files)); -} -if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); -} if ($search_billed != '') { $param .= '&search_billed='.urlencode($search_billed); } @@ -1395,6 +1403,9 @@ if ($search_fk_mode_reglement > 0) { if ($search_fk_input_reason > 0) { $param .= '&search_fk_input_reason='.urlencode((string) ($search_fk_input_reason)); } +if ($search_import_key != '') { + $param .= '&search_import_key='.urlencode($search_import_key); +} // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -1876,6 +1887,7 @@ if (!empty($arrayfields['c.facture']['checked'])) { // Import key if (!empty($arrayfields['c.import_key']['checked'])) { print ''; + print ''; print ''; } @@ -2090,14 +2102,17 @@ $parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; +// Status billed if (!empty($arrayfields['c.facture']['checked'])) { print_liste_field_titre($arrayfields['c.facture']['label'], $_SERVER["PHP_SELF"], 'c.facture', '', $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } +// Import key if (!empty($arrayfields['c.import_key']['checked'])) { print_liste_field_titre($arrayfields['c.import_key']['label'], $_SERVER["PHP_SELF"], "c.import_key", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } +// Status if (!empty($arrayfields['c.fk_statut']['checked'])) { print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index a13fce05ea5..a17d7309b15 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -158,6 +158,7 @@ $search_categ_cus = GETPOST("search_categ_cus", 'intcomma'); $search_product_category = GETPOST('search_product_category', 'intcomma'); $search_fac_rec_source_title = GETPOST("search_fac_rec_source_title", 'alpha'); $search_fk_fac_rec_source = GETPOST('search_fk_fac_rec_source', 'int'); +$search_import_key = trim(GETPOST("search_import_key", "alpha")); $search_option = GETPOST('search_option'); if ($search_option == 'late') { @@ -269,6 +270,7 @@ $arrayfields = array( 'f.note_public' => array('label' => 'NotePublic', 'checked' => 0, 'position' => 520, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES'))), 'f.note_private' => array('label' => 'NotePrivate', 'checked' => 0, 'position' => 521, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES'))), 'f.fk_fac_rec_source' => array('label' => 'GeneratedFromTemplate', 'checked' => 0, 'position' => 530, 'enabled' => '1'), + 'f.import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 999), 'f.fk_statut' => array('label' => "Status", 'checked' => 1, 'position' => 1000), ); @@ -408,7 +410,10 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', $search_datelimit_end = ''; $search_fac_rec_source_title = ''; $search_option = ''; + $search_import_key = ''; $search_categ_cus = 0; + + $search_all = ''; $toselect = array(); $search_array_options = array(); } @@ -656,7 +661,7 @@ $sql .= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,'; $sql .= ' f.fk_user_author,'; $sql .= ' f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva as multicurrency_total_vat, f.multicurrency_total_ttc,'; $sql .= ' f.datef, f.date_valid, f.date_lim_reglement as datelimite, f.module_source, f.pos_source,'; -$sql .= ' f.paye as paye, f.fk_statut, f.close_code,'; +$sql .= ' f.paye as paye, f.fk_statut, f.import_key, f.close_code,'; $sql .= ' f.datec as date_creation, f.tms as date_modification, f.date_closing as date_closing,'; $sql .= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,'; $sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,'; @@ -888,6 +893,9 @@ if (!empty($search_fac_rec_source_title)) { if ($search_fk_fac_rec_source) { $sql .= ' AND f.fk_fac_rec_source = ' . (int) $search_fk_fac_rec_source; } +if ($search_import_key) { + $sql .= natural_search("s.import_key", $search_import_key); +} // Search on user if ($search_user > 0) { $sql .= " AND EXISTS ("; @@ -1052,6 +1060,12 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } +if ($optioncss != '') { + $param .= '&optioncss='.urlencode($optioncss); +} +if ($show_files) { + $param .= '&show_files='.urlencode((string) ($show_files)); +} if ($search_all) { $param .= '&search_all='.urlencode($search_all); } @@ -1208,15 +1222,9 @@ if ($search_module_source) { if ($search_pos_source) { $param .= '&search_pos_source='.urlencode($search_pos_source); } -if ($show_files) { - $param .= '&show_files='.urlencode((string) ($show_files)); -} if ($search_option) { $param .= "&search_option=".urlencode($search_option); } -if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); -} if ($search_categ_cus > 0) { $param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus)); } @@ -1226,6 +1234,9 @@ if (!empty($search_fac_rec_source_title)) { if ($search_fk_fac_rec_source) { $param .= '&search_fk_fac_rec_source=' . (int) $search_fk_fac_rec_source; } +if ($search_import_key != '') { + $param .= '&search_import_key='.urlencode($search_import_key); +} // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -1690,6 +1701,12 @@ if (!empty($arrayfields['f.fk_fac_rec_source']['checked'])) { print ''; print ''; } +// Import key +if (!empty($arrayfields['f.import_key']['checked'])) { + print ''; + print ''; + print ''; +} // Status if (!empty($arrayfields['f.fk_statut']['checked'])) { print ''; @@ -1924,6 +1941,12 @@ if (!empty($arrayfields['f.fk_fac_rec_source']['checked'])) { print_liste_field_titre($arrayfields['f.fk_fac_rec_source']['label'], $_SERVER["PHP_SELF"], "facrec.titre", "", $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } +// Import key +if (!empty($arrayfields['f.import_key']['checked'])) { + print_liste_field_titre($arrayfields['f.import_key']['label'], $_SERVER["PHP_SELF"], "f.import_key", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +// Status if (!empty($arrayfields['f.fk_statut']['checked'])) { print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut,f.paye,f.type", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; @@ -2749,6 +2772,15 @@ if ($num > 0) { $totalarray['nbfield']++; } } + + // Import key + if (!empty($arrayfields['f.import_key']['checked'])) { + print ''.dol_escape_htmltag($obj->import_key).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status if (!empty($arrayfields['f.fk_statut']['checked'])) { print ''; From 69b30ac8c452f15507e7eb5edadc7837dd950821 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 16 Dec 2024 14:52:36 +0100 Subject: [PATCH 2/3] Debug v21 --- htdocs/theme/md/style.css.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 4f3b8732af4..c1c1ff04592 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -4760,7 +4760,6 @@ ul.noborder li:nth-child(odd):not(.liste_titre) { -webkit-box-shadow: unset; } .oddeven:hover:not(.nohover), .evenodd:hover:not(.nohover), .oddevenimport:hover:not(.nohover), .evenoddimport:hover:not(.nohover), .impair:hover:not(.nohover), .pair:hover:not(.nohover) { -{ background: rgb() !important; } From 07c2feb69caf380ba1c07600fbf9f50011a4bbe5 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 16 Dec 2024 18:34:21 +0100 Subject: [PATCH 3/3] Fix end date of survey (day must be included) --- htdocs/opensurvey/card.php | 2 +- htdocs/public/opensurvey/studs.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 3bd4f303daf..f1dcd56ce4e 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -321,7 +321,7 @@ if ($action == 'edit') { print $form->selectDate($expiredate ? $expiredate : $object->date_fin, 'expire', 0, 0, 0, '', 1, 0); } else { print dol_print_date($object->date_fin, 'day'); - if ($object->date_fin && $object->date_fin < dol_now() && $object->status == Opensurveysondage::STATUS_VALIDATED) { + if ($object->date_fin && dol_get_last_hour($object->date_fin) < dol_now() && $object->status == Opensurveysondage::STATUS_VALIDATED) { print img_warning($langs->trans("Expired")); } } diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index c7dfb5d3aa8..bd8e73efa7f 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -65,7 +65,7 @@ $result = $object->fetch(0, $numsondage); $nblines = $object->fetch_lines(); //If the survey has not yet finished, then it can be modified -$canbemodified = ((empty($object->date_fin) || $object->date_fin > dol_now()) && $object->status != Opensurveysondage::STATUS_CLOSED); +$canbemodified = ((empty($object->date_fin) || dol_get_last_hour($object->date_fin) > dol_now()) && $object->status != Opensurveysondage::STATUS_CLOSED); // Security check if (!isModEnabled('opensurvey')) {