diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index ec1b20b15e9..44c816530dd 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -27,9 +27,8 @@ * \ingroup Advanced accountancy * \brief Setup page to configure accounting expert module */ -require '../../main.inc.php'; -// Class +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; @@ -65,39 +64,23 @@ $accounting_mode = empty($conf->global->ACCOUNTING_MODE) ? 'RECETTES-DEPENSES' : if ($action == 'update') { $error = 0; - $accounting_modes = array ( - 'RECETTES-DEPENSES', - 'CREANCES-DETTES' - ); + if (! $error) + { + foreach ($list as $constname) + { + $constvalue = GETPOST($constname, 'alpha'); - $accounting_mode = GETPOST('accounting_mode', 'alpha'); - - if (in_array($accounting_mode, $accounting_modes)) { - - if (! dolibarr_set_const($db, 'ACCOUNTING_MODE', $accounting_mode, 'chaine', 0, '', $conf->entity)) { - $error ++; - } - } else { - $error ++; + if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { + $error++; + } + } + if ($error) { + setEventMessages($langs->trans("Error"), null, 'errors'); + } } - if ($error) { - setEventMessages($langs->trans("Error"), null, 'errors'); - } - - foreach ($list as $constname) - { - $constvalue = GETPOST($constname, 'alpha'); - - if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { - $error ++; - } - } - if (! $error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 0c1cdd324df..f655d245e86 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -36,26 +36,28 @@ $langs->load("accountancy"); $langs->load("bills"); $langs->load("compta"); +$action = GETPOST('action','aZ09'); + +$id = GETPOST('id', 'int'); // id of record +$mode = GETPOST('mode','aZ09'); // '' or 'tmp' +$piece_num = GETPOST("piece_num",'int'); // id of transaction (several lines share the same transaction id) + // Security check -$id = GETPOST('id', 'int'); if ($user->societe_id > 0) { accessforbidden(); } -$action = GETPOST('action','aZ09'); -$mode = GETPOST('mode','aZ09'); // '' or 'tmp' -$piece_num = GETPOST("piece_num"); $mesg = ''; -$account_number = GETPOST('account_number'); -$subledger_account = GETPOST('subledger_account'); +$account_number = GETPOST('account_number','alphanohtml'); +$subledger_account = GETPOST('subledger_account','alphanohtml'); if ($subledger_account == - 1) { $subledger_account = null; } -$label_compte = GETPOST('label_compte'); -$label_operation= GETPOST('label_operation'); -$debit = price2num(GETPOST('debit')); -$credit = price2num(GETPOST('credit')); +$label_compte = GETPOST('label_compte','alphanohtml'); +$label_operation= GETPOST('label_operation','alphanohtml'); +$debit = price2num(GETPOST('debit','alpha')); +$credit = price2num(GETPOST('credit','alpha')); $save = GETPOST('save','alpha'); if (! empty($save)) $action = 'add'; @@ -340,13 +342,14 @@ if ($action == 'create') dol_fiche_head(); print '
| ' . $langs->trans("NumPiece") . ' | '; print '' . $next_num_mvt . ' | '; - print '|||||
| ' . $langs->trans("Docdate") . ' | '; + print '' . $langs->trans("Docdate") . ' | '; print ''; print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1); print ' | '; @@ -389,7 +392,7 @@ if ($action == 'create') if (! empty($book->piece_num)) { - $backlink = '' . $langs->trans('BackToList') . ''; + $backlink = '' . $langs->trans('BackToList') . ''; print load_fiche_titre($langs->trans("UpdateMvts"), $backlink); @@ -594,7 +597,7 @@ if ($action == 'create') print "||||
| ';
print ' ';
print $langs->trans('From') . ' ';
- print $form->select_date($search_date_start?$search_date_start:-1, 'date_start', 0, 0, 1);
+ print $form->select_date($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1);
print ' ';
print '';
print $langs->trans('to') . ' ';
- print $form->select_date($search_date_end?$search_date_end:-1, 'date_end', 0, 0, 1);
+ print $form->select_date($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1);
print ' ';
print ' | ';
}
@@ -612,7 +614,12 @@ if ($num > 0)
// Piece number
if (! empty($arrayfields['t.piece_num']['checked']))
{
- print '' . $line->piece_num . ' | '; + print ''; + $object->id = $line->id; + $object->piece_num = $line->piece_num; + print $object->getNomUrl(1,'',0,'',1); + //print '' . $line->piece_num . ''; + print ' | '; if (! $i) $totalarray['nbfield']++; } diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 13b25599280..557c1c9ffde 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -354,6 +354,67 @@ class BookKeeping extends CommonObject } } + /** + * Return a link to the object card (with optionaly the picto) + * + * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) + * @param string $option On what the link point to ('nolink', ...) + * @param int $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with URL + */ + function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1) + { + global $db, $conf, $langs; + global $dolibarr_main_authentication, $dolibarr_main_demo; + global $menumanager; + + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + + $result = ''; + $companylink = ''; + + $label = '' . $langs->trans("Transaction") . ''; + $label.= ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($year?$year:-1,'year',1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; + $formother->select_year($search_year?$search_year:-1,'search_year',1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); print ' | '; } // Date due if (! empty($arrayfields['f.date_lim_reglement']['checked'])) { print '';
- if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '';
- print '';
- $formother->select_year($year_lim?$year_lim:-1,'year_lim',1, 20, 5, 0, 0, '', 'widthauto valignmiddle');
+ if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '';
+ print '';
+ $formother->select_year($search_year_lim?$search_year_lim:-1,'search_year_lim',1, 20, 5, 0, 0, '', 'widthauto valignmiddle');
print ' '.$langs->trans("Late"); print ' | ';
}
diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php
index 1fe8d82fa87..6f0b4899d6e 100644
--- a/htdocs/fourn/commande/list.php
+++ b/htdocs/fourn/commande/list.php
@@ -55,12 +55,12 @@ $confirm=GETPOST('confirm','alpha');
$toselect = GETPOST('toselect', 'array');
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'supplierorderlist';
-$orderyear=GETPOST("orderyear","int");
-$ordermonth=GETPOST("ordermonth","int");
-$orderday=GETPOST("orderday","int");
-$deliveryyear=GETPOST("deliveryyear","int");
-$deliverymonth=GETPOST("deliverymonth","int");
-$deliveryday=GETPOST("deliveryday","int");
+$search_orderyear=GETPOST("search_orderyear","int");
+$search_ordermonth=GETPOST("search_ordermonth","int");
+$search_orderday=GETPOST("search_orderday","int");
+$search_deliveryyear=GETPOST("search_deliveryyear","int");
+$search_deliverymonth=GETPOST("search_deliverymonth","int");
+$search_deliveryday=GETPOST("search_deliveryday","int");
$sall=GETPOST('search_all', 'alphanohtml');
$search_product_category=GETPOST('search_product_category','int');
@@ -181,9 +181,6 @@ if (empty($reshook))
// Purge search criteria
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{
- $ordermonth='';
- $orderyear='';
- $orderday='';
$search_categ='';
$search_user='';
$search_sale='';
@@ -203,12 +200,12 @@ if (empty($reshook))
$search_total_ttc='';
$search_project_ref='';
$search_status=-1;
- $orderyear='';
- $ordermonth='';
- $orderday='';
- $deliveryday='';
- $deliverymonth='';
- $deliveryyear='';
+ $search_orderyear='';
+ $search_ordermonth='';
+ $search_orderday='';
+ $search_deliveryday='';
+ $search_deliverymonth='';
+ $search_deliveryyear='';
$billed='';
$search_billed='';
$toselect='';
@@ -524,7 +521,7 @@ if ($search_refsupp) $sql.= natural_search("cf.ref_supplier", $search_refsupp);
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
if ($search_company) $sql .= natural_search('s.nom', $search_company);
if ($search_request_author) $sql.=natural_search(array('u.lastname','u.firstname','u.login'), $search_request_author) ;
-if ($search_billed != '' && $search_billed >= 0) $sql .= " AND cf.billed = ".$search_billed;
+if ($search_billed != '' && $search_billed >= 0) $sql .= " AND cf.billed = ".$db->escape($search_billed);
//Required triple check because statut=0 means draft filter
if (GETPOST('statut', 'intcomma') !== '')
@@ -535,31 +532,31 @@ if ($search_status != '' && $search_status >= 0)
{
$sql.=" AND cf.fk_statut IN (".$db->escape($search_status).")";
}
-if ($ordermonth > 0)
+if ($search_ordermonth > 0)
{
- if ($orderyear > 0 && empty($orderday))
- $sql.= " AND cf.date_commande BETWEEN '".$db->idate(dol_get_first_day($orderyear,$ordermonth,false))."' AND '".$db->idate(dol_get_last_day($orderyear,$ordermonth,false))."'";
- else if ($orderyear > 0 && ! empty($orderday))
- $sql.= " AND cf.date_commande BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $ordermonth, $orderday, $orderyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $ordermonth, $orderday, $orderyear))."'";
+ if ($search_orderyear > 0 && empty($search_orderday))
+ $sql.= " AND cf.date_commande BETWEEN '".$db->idate(dol_get_first_day($search_orderyear,$search_ordermonth,false))."' AND '".$db->idate(dol_get_last_day($search_orderyear,$search_ordermonth,false))."'";
+ else if ($search_orderyear > 0 && ! empty($search_orderday))
+ $sql.= " AND cf.date_commande BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_ordermonth, $search_orderday, $search_orderyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_ordermonth, $search_orderday, $search_orderyear))."'";
else
- $sql.= " AND date_format(cf.date_commande, '%m') = '".$ordermonth."'";
+ $sql.= " AND date_format(cf.date_commande, '%m') = '".$db->escape($search_ordermonth)."'";
}
-else if ($orderyear > 0)
+else if ($search_orderyear > 0)
{
- $sql.= " AND cf.date_commande BETWEEN '".$db->idate(dol_get_first_day($orderyear,1,false))."' AND '".$db->idate(dol_get_last_day($orderyear,12,false))."'";
+ $sql.= " AND cf.date_commande BETWEEN '".$db->idate(dol_get_first_day($search_orderyear,1,false))."' AND '".$db->idate(dol_get_last_day($search_orderyear,12,false))."'";
}
-if ($deliverymonth > 0)
+if ($search_deliverymonth > 0)
{
- if ($deliveryyear > 0 && empty($deliveryday))
- $sql.= " AND cf.date_livraison BETWEEN '".$db->idate(dol_get_first_day($deliveryyear,$deliverymonth,false))."' AND '".$db->idate(dol_get_last_day($deliveryyear,$deliverymonth,false))."'";
- else if ($deliveryyear > 0 && ! empty($deliveryday))
- $sql.= " AND cf.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $deliverymonth, $deliveryday, $deliveryyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $deliverymonth, $deliveryday, $deliveryyear))."'";
- else
- $sql.= " AND date_format(cf.date_livraison, '%m') = '".$deliverymonth."'";
+ if ($search_deliveryyear > 0 && empty($search_deliveryday))
+ $sql.= " AND cf.date_livraison BETWEEN '".$db->idate(dol_get_first_day($search_deliveryyear,$search_deliverymonth,false))."' AND '".$db->idate(dol_get_last_day($search_deliveryyear,$search_deliverymonth,false))."'";
+ else if ($search_deliveryyear > 0 && ! empty($search_deliveryday))
+ $sql.= " AND cf.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_eliverymonth, $search_deliveryday, $search_deliveryyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_deliverymonth, $search_deliveryday, $search_deliveryyear))."'";
+ else
+ $sql.= " AND date_format(cf.date_livraison, '%m') = '".$db->escape($search_deliverymonth)."'";
}
-else if ($deliveryyear > 0)
+else if ($search_deliveryyear > 0)
{
- $sql.= " AND cf.date_livraison BETWEEN '".$db->idate(dol_get_first_day($deliveryyear,1,false))."' AND '".$db->idate(dol_get_last_day($deliveryyear,12,false))."'";
+ $sql.= " AND cf.date_livraison BETWEEN '".$db->idate(dol_get_first_day($search_deliveryyear,1,false))."' AND '".$db->idate(dol_get_last_day($search_deliveryyear,12,false))."'";
}
if ($search_town) $sql.= natural_search('s.town', $search_town);
if ($search_zip) $sql.= natural_search("s.zip",$search_zip);
@@ -614,12 +611,12 @@ if ($resql)
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($sall) $param.="&search_all=".$sall;
- if ($orderday) $param.='&orderday='.$orderday;
- if ($ordermonth) $param.='&ordermonth='.$ordermonth;
- if ($orderyear) $param.='&orderyear='.$orderyear;
- if ($deliveryday) $param.='&deliveryday='.$deliveryday;
- if ($deliverymonth) $param.='&deliverymonth='.$deliverymonth;
- if ($deliveryyear) $param.='&deliveryyear='.$deliveryyear;
+ if ($search_orderday) $param.='&search_orderday='.$search_orderday;
+ if ($search_ordermonth) $param.='&search_ordermonth='.$search_ordermonth;
+ if ($search_orderyear) $param.='&search_orderyear='.$search_orderyear;
+ if ($search_deliveryday) $param.='&search_deliveryday='.$search_deliveryday;
+ if ($search_deliverymonth) $param.='&search_deliverymonth='.$search_deliverymonth;
+ if ($search_deliveryyear) $param.='&search_deliveryyear='.$search_deliveryyear;
if ($search_ref) $param.='&search_ref='.$search_ref;
if ($search_company) $param.='&search_company='.$search_company;
if ($search_user > 0) $param.='&search_user='.$search_user;
@@ -822,18 +819,18 @@ if ($resql)
if (! empty($arrayfields['cf.date_commande']['checked']))
{
print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($orderyear?$orderyear:-1,'orderyear',1, 20, 5); + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; + $formother->select_year($search_orderyear?$search_orderyear:-1,'search_orderyear',1, 20, 5); print ' | '; } // Date delivery if (! empty($arrayfields['cf.date_delivery']['checked'])) { print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($deliveryyear?$deliveryyear:-1,'deliveryyear',1, 20, 5); + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; + $formother->select_year($search_deliveryyear?$search_deliveryyear:-1,'search_deliveryyear',1, 20, 5); print ' | '; } if (! empty($arrayfields['cf.total_ht']['checked'])) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 168de0c8f57..359a7ea27a1 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -703,32 +703,33 @@ if (! defined('NOLOGIN')) } else { - // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context - $hookmanager->initHooks(array('main')); + // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context + $hookmanager->initHooks(array('main')); - // Code for search criteria persistence. - if (! empty($_GET['save_lastsearch_values'])) // Keep $_GET here - { - $relativepathstring = preg_replace('/\?.*$/','',$_SERVER["HTTP_REFERER"]); - $relativepathstring = preg_replace('/^https?:\/\/[^\/]*/','',$relativepathstring); // Get full path except host server - // Clean $relativepathstring - if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring); - $relativepathstring = preg_replace('/^\//', '', $relativepathstring); - $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); - //var_dump($relativepathstring); + // Code for search criteria persistence. + if (! empty($_GET['save_lastsearch_values'])) // Keep $_GET here + { + $relativepathstring = preg_replace('/\?.*$/','',$_SERVER["HTTP_REFERER"]); + $relativepathstring = preg_replace('/^https?:\/\/[^\/]*/','',$relativepathstring); // Get full path except host server + // Clean $relativepathstring + if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring); + $relativepathstring = preg_replace('/^\//', '', $relativepathstring); + $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); + //var_dump($relativepathstring); - if (! empty($_SESSION['lastsearch_values_tmp_'.$relativepathstring])) - { - $_SESSION['lastsearch_values_'.$relativepathstring]=$_SESSION['lastsearch_values_tmp_'.$relativepathstring]; - unset($_SESSION['lastsearch_values_tmp_'.$relativepathstring]); - } - } + // We click on a link that leave a page we have to save search criteria. We save them from tmp to no tmp + if (! empty($_SESSION['lastsearch_values_tmp_'.$relativepathstring])) + { + $_SESSION['lastsearch_values_'.$relativepathstring]=$_SESSION['lastsearch_values_tmp_'.$relativepathstring]; + unset($_SESSION['lastsearch_values_tmp_'.$relativepathstring]); + } + } - $action = ''; - $reshook = $hookmanager->executeHooks('updateSession', array(), $user, $action); - if ($reshook < 0) { - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - } + $action = ''; + $reshook = $hookmanager->executeHooks('updateSession', array(), $user, $action); + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } } } @@ -1900,8 +1901,8 @@ if (! function_exists("llxFooter")) // Clean data foreach($user->lastsearch_values_tmp as $key => $val) { - unset($_SESSION['lastsearch_values_tmp_'.$key]); - if (count($val)) + unset($_SESSION['lastsearch_values_tmp_'.$key]); // Clean arry to rebuild it just after + if (count($val) && empty($_POST['button_removefilter'])) // If there is search criteria to save and we did not click on 'Clear filter' button { if (empty($val['sortfield'])) unset($val['sortfield']); if (empty($val['sortorder'])) unset($val['sortorder']); diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 47369f7c92f..25bc95c4830 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -278,6 +278,7 @@ input.select2-input { .liste_titre input[name=month_date_when], .liste_titre input[name=monthvalid], .liste_titre input[name=search_ordermonth], .liste_titre input[name=search_deliverymonth], .liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre select[name=month], .liste_titre input[name=month_lim], .liste_titre input[name=month_start], .liste_titre input[name=month_end], .liste_titre input[name=month_create], +.liste_titre input[name=search_month_lim], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end], .liste_titre input[name=search_month_create], .liste_titre input[name=search_day_date_when], .liste_titre input[name=search_month_date_when], .liste_titre input[name=search_year_date_when], .liste_titre input[name=search_month_create], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end] { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 3b3f0ca092e..2d7389dae0e 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -291,6 +291,7 @@ textarea.cke_source:focus .liste_titre input[name=month_date_when], .liste_titre input[name=monthvalid], .liste_titre input[name=search_ordermonth], .liste_titre input[name=search_deliverymonth], .liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre input[name=month_lim], .liste_titre input[name=month_start], .liste_titre input[name=month_end], .liste_titre input[name=month_create], +.liste_titre input[name=search_month_lim], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end], .liste_titre input[name=search_month_create], .liste_titre input[name=search_day_date_when], .liste_titre input[name=search_month_date_when], .liste_titre input[name=search_year_date_when], .liste_titre input[name=search_month_create], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end] {