'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '
';
print '';
- print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'nowrap ');
+ print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], "item", "", $param, '', $sortfield, $sortorder, 'nowrap ');
print_liste_field_titre($arrayfields['date']['label'], $_SERVER["PHP_SELF"], "date", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
print ''.$langs->trans("Ref").' ';
print ''.$langs->trans("Document").' ';
@@ -465,7 +465,7 @@ if (!empty($date_start) && !empty($date_stop))
print ' ';
if ($result)
{
- $TData = dol_sort_array($filesarray, 'date', 'ASC');
+ $TData = dol_sort_array($filesarray, $sortfield, $sortorder);
if (empty($TData))
{
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index b177abf75fd..fa9f48ee4c4 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -171,6 +171,7 @@ NotValidated=Not validated
Save=Save
SaveAs=Save As
SaveAndStay=Save and stay
+SaveAndNew=Save and new
TestConnection=Test connection
ToClone=Clone
ConfirmClone=Choose data you want to clone:
diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php
index c9ccd78c244..798ef8dab4a 100644
--- a/htdocs/salaries/card.php
+++ b/htdocs/salaries/card.php
@@ -41,11 +41,17 @@ if (! empty($conf->projet->enabled))
$langs->loadLangs(array("compta","banks","bills","users","salaries","hrm"));
if (! empty($conf->projet->enabled)) $langs->load("projects");
-$id=GETPOST("id", 'int');
-$action=GETPOST('action', 'aZ09');
-$cancel= GETPOST('cancel', 'aZ09');
+$id = GETPOST("id", 'int');
+$action = GETPOST('action', 'aZ09');
+$cancel = GETPOST('cancel', 'aZ09');
+$accountid = GETPOST("accountid", 'int');
$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int'));
+$datep = dol_mktime(12, 0, 0, GETPOST("datepmonth", 'int'), GETPOST("datepday", 'int'), GETPOST("datepyear", 'int'));
+$datev = dol_mktime(12, 0, 0, GETPOST("datevmonth", 'int'), GETPOST("datevday", 'int'), GETPOST("datevyear", 'int'));
+$datesp = dol_mktime(12, 0, 0, GETPOST("datespmonth", 'int'), GETPOST("datespday", 'int'), GETPOST("datespyear", 'int'));
+$dateep = dol_mktime(12, 0, 0, GETPOST("dateepmonth", 'int'), GETPOST("dateepday", 'int'), GETPOST("dateepyear", 'int'));
+
// Security check
$socid = GETPOST("socid", "int");
if ($user->socid) $socid=$user->socid;
@@ -60,6 +66,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('salarycard', 'globalcard'));
+
/**
* Actions
*/
@@ -74,34 +81,30 @@ if ($cancel)
if ($action == 'classin' && $user->rights->banque->modifier)
{
$object->fetch($id);
- $object->setProject(GETPOST('projectid'));
+ $object->setProject($projectid);
}
if ($action == 'add' && empty($cancel))
{
$error = 0;
- $datep = dol_mktime(12, 0, 0, GETPOST("datepmonth", 'int'), GETPOST("datepday", 'int'), GETPOST("datepyear", 'int'));
- $datev = dol_mktime(12, 0, 0, GETPOST("datevmonth", 'int'), GETPOST("datevday", 'int'), GETPOST("datevyear", 'int'));
- $datesp = dol_mktime(12, 0, 0, GETPOST("datespmonth", 'int'), GETPOST("datespday", 'int'), GETPOST("datespyear", 'int'));
- $dateep = dol_mktime(12, 0, 0, GETPOST("dateepmonth", 'int'), GETPOST("dateepday", 'int'), GETPOST("dateepyear", 'int'));
if (empty($datev)) $datev = $datep;
$type_payment = dol_getIdFromCode($db, GETPOST("paymenttype", 'alpha'), 'c_paiement', 'code', 'id', 1);
- $object->accountid = GETPOST("accountid") > 0 ? GETPOST("accountid", "int") : 0;
- $object->fk_user = GETPOST("fk_user") > 0 ? GETPOST("fk_user", "int") : 0;
+ $object->accountid = GETPOST("accountid", 'int') > 0 ? GETPOST("accountid", "int") : 0;
+ $object->fk_user = GETPOST("fk_user", 'int') > 0 ? GETPOST("fk_user", "int") : 0;
$object->datev = $datev;
$object->datep = $datep;
- $object->amount = price2num(GETPOST("amount"));
- $object->label = GETPOST("label");
+ $object->amount = price2num(GETPOST("amount", 'alpha'));
+ $object->label = GETPOST("label", 'alphanohtml');
$object->datesp = $datesp;
$object->dateep = $dateep;
- $object->note = GETPOST("note");
+ $object->note = GETPOST("note", 'none');
$object->type_payment = ($type_payment > 0 ? $type_payment : 0);
- $object->num_payment = GETPOST("num_payment");
+ $object->num_payment = GETPOST("num_payment", 'alphanohtml');
$object->fk_user_author = $user->id;
- $object->fk_project = GETPOST('fk_project', 'int');
+ $object->fk_project = $projectid;
// Set user current salary as ref salary for the payment
$fuser = new User($db);
@@ -146,8 +149,15 @@ if ($action == 'add' && empty($cancel))
if ($ret > 0)
{
$db->commit();
- header("Location: list.php");
- exit;
+
+ if (GETPOST('saveandnew', 'alpha')) {
+ setEventMessages($langs->trans("RecordSaved"), '', 'mesgs');
+ header("Location: card.php?action=create&fk_project=".urlencode($projectid)."&accountid=".urlencode($accountid).'&paymenttype='.urlencode(GETPOST('paymenttype', 'az09')).'&datepday='.GETPOST("datepday", 'int').'&datepmonth='.GETPOST("datepmonth", 'int').'&datepyear='.GETPOST("datepyear", 'int'));
+ exit;
+ } else {
+ header("Location: list.php");
+ exit;
+ }
}
else
{
@@ -272,13 +282,6 @@ if ($action == 'create')
print $form->selectDate((empty($datev) ?-1 : $datev), "datev", '', '', '', 'add', 1, 1);
print '';
- // Employee
- print '';
- print $form->editfieldkey('Employee', 'fk_user', '', $object, 0, 'string', '', 1).' ';
- $noactive = 0; // We keep active and unactive users
- print $form->select_dolusers(GETPOST('fk_user', 'int'), 'fk_user', 1, '', 0, '', '', 0, 0, 0, 'AND employee=1', 0, '', 'maxwidth300', $noactive);
- print ' ';
-
// Label
print '';
print $form->editfieldkey('Label', 'label', '', $object, 0, 'string', '', 1).' ';
@@ -297,6 +300,13 @@ if ($action == 'create')
print $form->selectDate($dateep, "dateep", '', '', '', 'add');
print ' ';
+ // Employee
+ print '';
+ print $form->editfieldkey('Employee', 'fk_user', '', $object, 0, 'string', '', 1).' ';
+ $noactive = 0; // We keep active and unactive users
+ print $form->select_dolusers(GETPOST('fk_user', 'int'), 'fk_user', 1, '', 0, '', '', 0, 0, 0, 'AND employee=1', 0, '', 'maxwidth300', $noactive);
+ print ' ';
+
// Amount
print '';
print $form->editfieldkey('Amount', 'amount', '', $object, 0, 'string', '', 1).' ';
@@ -309,9 +319,7 @@ if ($action == 'create')
$formproject = new FormProjets($db);
print ' '.$langs->trans("Project").' ';
-
- $numproject = $formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1);
-
+ $formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1);
print ' ';
}
@@ -320,14 +328,14 @@ if ($action == 'create')
{
print '';
print $form->editfieldkey('BankAccount', 'selectaccountid', '', $object, 0, 'string', '', 1).' ';
- $form->select_comptes($_POST["accountid"], "accountid", 0, '', 1); // Affiche liste des comptes courant
+ $form->select_comptes($accountid, "accountid", 0, '', 1); // Affiche liste des comptes courant
print ' ';
}
// Type payment
print '';
print $form->editfieldkey('PaymentMode', 'selectpaymenttype', '', $object, 0, 'string', '', 1).' ';
- $form->select_types_paiements(GETPOST("paymenttype"), "paymenttype", '', 2);
+ $form->select_types_paiements(GETPOST("paymenttype", 'aZ09'), "paymenttype", '', 2);
print ' ';
// Number
@@ -354,8 +362,10 @@ if ($action == 'create')
dol_fiche_end();
print '';
- print ' ';
- print ' ';
+ print ' ';
+ print ' ';
+ print ' ';
+ print ' ';
print ' ';
print '
';