diff --git a/htdocs/compta/loan/card.php b/htdocs/compta/loan/card.php index e49aee1b61f..49e3884562c 100644 --- a/htdocs/compta/loan/card.php +++ b/htdocs/compta/loan/card.php @@ -69,12 +69,12 @@ if ($action == 'confirm_delete' && $confirm == 'yes') } } - // Add loan if ($action == 'add' && $user->rights->loan->write) { - $datestart=dol_mktime(12,0,0, $GETPOST("startmonth"), $GETPOST("startday"), $GETPOST("startyear")); - $dateend=dol_mktime(12,0,0, $GETPOST("endmonth"), $GETPOST("endday"), $GETPOST("endyear")); + $datestart=@dol_mktime(12,0,0, $_POST["startmonth"], $_POST["startday"], $_POST["startyear"]); + $dateend=@dol_mktime(12,0,0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]); + if (! $datestart) { setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("DateStart")), 'errors'); @@ -94,17 +94,17 @@ if ($action == 'add' && $user->rights->loan->write) { $object = new Loan($db); - $object->label = GETPOST("label"); - $object->fk_bank = GETPOST("accountid"); - $object->capital = GETPOST("capital"); - $object->datestart = $datestart; - $object->dateend = $dateend; - $object->nbterm = GETPOST("nbterm"); - $object->rate = GETPOST("rate"); + $object->label = $_POST["label"]; + $object->fk_bank = $_POST["accountid"]; + $object->capital = $_POST["capital"]; + $object->datestart = $datestart; + $object->dateend = $dateend; + $object->nbterm = $_POST["nbterm"]; + $object->rate = $_POST["rate"]; - $object->account_capital = GETPOST("accountancy_account_capital"); - $object->account_insurance = GETPOST("accountancy_account_insurance"); - $object->account_interest = GETPOST("accountancy_account_interest"); + $object->account_capital = $_POST["accountancy_account_capital"]; + $object->account_insurance = $_POST["accountancy_account_insurance"]; + $object->account_interest = $_POST["accountancy_account_interest"]; $id=$object->create($user); if ($id <= 0) @@ -173,7 +173,7 @@ if ($action == 'create') $datec = dol_mktime(12, 0, 0, GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int')); - print '
' . "\n"; + print '' . "\n"; print ''; print ''; diff --git a/htdocs/compta/loan/index.php b/htdocs/compta/loan/index.php index a4432ba9ced..2834ce2069f 100644 --- a/htdocs/compta/loan/index.php +++ b/htdocs/compta/loan/index.php @@ -45,8 +45,16 @@ if (! $sortfield) $sortfield="l.rowid"; if (! $sortorder) $sortorder="DESC"; $limit = $conf->liste_limit; +$search_ref=GETPOST('search_ref','int'); $search_label=GETPOST('search_label','alpha'); -$filtre=$_GET["filtre"]; +$filtre=GETPOST("filtre"); + +if (GETPOST("button_removefilter")) +{ + $search_ref=""; + $search_label=""; + $search_amount=""; +} /* * View @@ -56,13 +64,14 @@ $loan = new Loan($db); llxHeader(); -$sql = "SELECT l.rowid as id, l.label, l.capital, l.datestart, l.dateend,"; +$sql = "SELECT l.rowid, l.label, l.capital, l.datestart, l.dateend,"; $sql.= " SUM(pl.amount) as alreadypayed"; $sql.= " FROM ".MAIN_DB_PREFIX."loan as l,"; $sql.= " ".MAIN_DB_PREFIX."payment_loan as pl"; $sql.= " WHERE pl.fk_loan = l.rowid"; $sql.= " AND l.entity = ".$conf->entity; -if (GETPOST("search_label")) $sql.=" AND l.label LIKE '%".$db->escape(GETPOST("search_label"))."%'"; +if (GETPOST("search_ref")) $sql.=" AND (l.rowid = ".$db->escape($search_ref).")"; +if (GETPOST("search_label")) $sql.=" AND l.label LIKE '%".$db->escape($search_label)."%'"; if ($filtre) { $filtre=str_replace(":","=",$filtre); @@ -83,7 +92,7 @@ if ($resql) print ''."\n"; print ''; print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"id","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"l.rowid","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"l.label","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Capital"),$_SERVER["PHP_SELF"],"l.capital","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"l.datestart","",$param,'align="center"',$sortfield,$sortorder); @@ -96,9 +105,11 @@ if ($resql) print ''; print ''; print ''; - print '\n"; + print ''; + print ''; + print ''; $var=true; while ($i < min($num,$limit)) diff --git a/htdocs/compta/salaries/card.php b/htdocs/compta/salaries/card.php index 3ee796c6134..c6e492cd787 100644 --- a/htdocs/compta/salaries/card.php +++ b/htdocs/compta/salaries/card.php @@ -206,7 +206,7 @@ if ($action == 'create') $datesp=dol_get_first_day($pastmonthyear,$pastmonth,false); $dateep=dol_get_last_day($pastmonthyear,$pastmonth,false); } - print "\n"; + print ''; print ''; print '';
  '; + print ''; print ''; - print "