Merge pull request #3576 from aspangaro/develop-67
New : Salaries - Add info card / add field datec / rename field user_creat to user_author
This commit is contained in:
commit
99a945882d
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
/* Copyright (C) 2011-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015 Charlie BENKE <charlie@patas-monkey.com>
|
||||
@ -83,7 +83,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
|
||||
$object->note=GETPOST("note");
|
||||
$object->type_payment=GETPOST("paymenttype");
|
||||
$object->num_payment=GETPOST("num_payment");
|
||||
$object->fk_user_creat=$user->id;
|
||||
$object->fk_user_author=$user->id;
|
||||
|
||||
// Set user current salary as ref salaray for the payment
|
||||
$fuser=new User($db);
|
||||
@ -232,45 +232,45 @@ if ($action == 'create')
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print "<tr>";
|
||||
print '<td class="fieldrequired">'.$langs->trans("DatePayment").'</td><td>';
|
||||
print '<td class="fieldrequired"><label for="datep">'.$langs->trans("DatePayment").'</label></td><td>';
|
||||
print $form->select_date((empty($datep)?-1:$datep),"datep",'','','','add',1,1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("DateValue").'</td><td>';
|
||||
print '<tr><td><label for="datev">'.$langs->trans("DateValue").'</label></td><td>';
|
||||
print $form->select_date((empty($datev)?-1:$datev),"datev",'','','','add',1,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Employee
|
||||
print "<tr>";
|
||||
print '<td class="fieldrequired">'.$langs->trans("Employee").'</td><td>';
|
||||
print '<td class="fieldrequired"><label for="fk_user">'.$langs->trans("Employee").'</label></td><td>';
|
||||
print $form->select_dolusers(GETPOST('fk_user','int'),'fk_user',1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" size="40" value="'.($_POST["label"]?$_POST["label"]:$langs->trans("SalaryPayment")).'"></td></tr>';
|
||||
print '<tr><td class="fieldrequired"><label for="label">'.$langs->trans("Label").'</label></td><td><input name="label" id="label" size="40" value="'.($_POST["label"]?$_POST["label"]:$langs->trans("SalaryPayment")).'"></td></tr>';
|
||||
|
||||
print "<tr>";
|
||||
print '<td class="fieldrequired">'.$langs->trans("DateStartPeriod").'</td><td>';
|
||||
print '<td class="fieldrequired"><label for="datesp">'.$langs->trans("DateStartPeriod").'</label></td><td>';
|
||||
print $form->select_date($datesp,"datesp",'','','','add');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("DateEndPeriod").'</td><td>';
|
||||
print '<tr><td class="fieldrequired"><label for="dateep">'.$langs->trans("DateEndPeriod").'</label></td><td>';
|
||||
print $form->select_date($dateep,"dateep",'','','','add');
|
||||
print '</td></tr>';
|
||||
|
||||
// Amount
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input name="amount" size="10" value="'.GETPOST("amount").'"></td></tr>';
|
||||
print '<tr><td class="fieldrequired"><label for="amount">'.$langs->trans("Amount").'</label></td><td><input name="amount" id="amount" size="10" value="'.GETPOST("amount").'"></td></tr>';
|
||||
|
||||
// Bank
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Account").'</td><td>';
|
||||
print '<tr><td class="fieldrequired"><label for="selectaccountid">'.$langs->trans("Account").'</label></td><td>';
|
||||
$form->select_comptes($_POST["accountid"],"accountid",0,'',1); // Affiche liste des comptes courant
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Type payment
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
|
||||
print '<tr><td class="fieldrequired"><label for="selectpaymenttype">'.$langs->trans("PaymentMode").'</label></td><td>';
|
||||
$form->select_types_paiements(GETPOST("paymenttype"), "paymenttype");
|
||||
print "</td>\n";
|
||||
print "</tr>";
|
||||
@ -278,9 +278,10 @@ if ($action == 'create')
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
// Number
|
||||
print '<tr><td>'.$langs->trans('Numero');
|
||||
print '<tr><td><label for="num_payment">'.$langs->trans('Numero');
|
||||
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
||||
print '<td><input name="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
|
||||
print '</label></td>';
|
||||
print '<td><input name="num_payment" id="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
@ -314,7 +315,6 @@ if ($id)
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("SalaryPayment"), 0, 'payment');
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print "<tr>";
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
/* Copyright (C) 2011-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -49,7 +49,7 @@ class PaymentSalary extends CommonObject
|
||||
var $dateep;
|
||||
var $note;
|
||||
var $fk_bank;
|
||||
var $fk_user_creat;
|
||||
var $fk_user_author;
|
||||
var $fk_user_modif;
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ class PaymentSalary extends CommonObject
|
||||
$this->label=trim($this->label);
|
||||
$this->note=trim($this->note);
|
||||
$this->fk_bank=trim($this->fk_bank);
|
||||
$this->fk_user_creat=trim($this->fk_user_creat);
|
||||
$this->fk_user_author=trim($this->fk_user_author);
|
||||
$this->fk_user_modif=trim($this->fk_user_modif);
|
||||
|
||||
// Check parameters
|
||||
@ -112,7 +112,7 @@ class PaymentSalary extends CommonObject
|
||||
$sql.= " dateep=".$this->db->idate($this->dateep).",";
|
||||
$sql.= " note='".$this->db->escape($this->note)."',";
|
||||
$sql.= " fk_bank=".($this->fk_bank > 0 ? "'".$this->fk_bank."'":"null").",";
|
||||
$sql.= " fk_user_creat='".$this->fk_user_creat."',";
|
||||
$sql.= " fk_user_author='".$this->fk_user_author."',";
|
||||
$sql.= " fk_user_modif='".$this->fk_user_modif."'";
|
||||
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
@ -171,7 +171,7 @@ class PaymentSalary extends CommonObject
|
||||
$sql.= " s.dateep,";
|
||||
$sql.= " s.note,";
|
||||
$sql.= " s.fk_bank,";
|
||||
$sql.= " s.fk_user_creat,";
|
||||
$sql.= " s.fk_user_author,";
|
||||
$sql.= " s.fk_user_modif,";
|
||||
$sql.= " b.fk_account,";
|
||||
$sql.= " b.fk_type,";
|
||||
@ -203,7 +203,7 @@ class PaymentSalary extends CommonObject
|
||||
$this->dateep = $this->db->jdate($obj->dateep);
|
||||
$this->note = $obj->note;
|
||||
$this->fk_bank = $obj->fk_bank;
|
||||
$this->fk_user_creat = $obj->fk_user_creat;
|
||||
$this->fk_user_author = $obj->fk_user_author;
|
||||
$this->fk_user_modif = $obj->fk_user_modif;
|
||||
$this->fk_account = $obj->fk_account;
|
||||
$this->fk_type = $obj->fk_type;
|
||||
@ -275,7 +275,7 @@ class PaymentSalary extends CommonObject
|
||||
$this->dateep='';
|
||||
$this->note='';
|
||||
$this->fk_bank='';
|
||||
$this->fk_user_creat='';
|
||||
$this->fk_user_author='';
|
||||
$this->fk_user_modif='';
|
||||
}
|
||||
|
||||
@ -290,13 +290,14 @@ class PaymentSalary extends CommonObject
|
||||
global $conf,$langs;
|
||||
|
||||
$error=0;
|
||||
$now=dol_now();
|
||||
|
||||
// Clean parameters
|
||||
$this->amount=price2num(trim($this->amount));
|
||||
$this->label=trim($this->label);
|
||||
$this->note=trim($this->note);
|
||||
$this->fk_bank=trim($this->fk_bank);
|
||||
$this->fk_user_creat=trim($this->fk_user_creat);
|
||||
$this->fk_user_author=trim($this->fk_user_author);
|
||||
$this->fk_user_modif=trim($this->fk_user_modif);
|
||||
|
||||
// Check parameters
|
||||
@ -340,7 +341,8 @@ class PaymentSalary extends CommonObject
|
||||
$sql.= ", label";
|
||||
$sql.= ", datesp";
|
||||
$sql.= ", dateep";
|
||||
$sql.= ", fk_user_creat";
|
||||
$sql.= ", fk_user_author";
|
||||
$sql.= ", datec";
|
||||
$sql.= ", fk_bank";
|
||||
$sql.= ", entity";
|
||||
$sql.= ") ";
|
||||
@ -357,6 +359,7 @@ class PaymentSalary extends CommonObject
|
||||
$sql.= ", '".$this->db->idate($this->datesp)."'";
|
||||
$sql.= ", '".$this->db->idate($this->dateep)."'";
|
||||
$sql.= ", '".$user->id."'";
|
||||
$sql.= ", '".$this->db->idate($now)."'";
|
||||
$sql.= ", NULL";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
@ -511,4 +514,41 @@ class PaymentSalary extends CommonObject
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Information on record
|
||||
*
|
||||
* @param int $id Id of record
|
||||
* @return void
|
||||
*/
|
||||
function info($id)
|
||||
{
|
||||
$sql = 'SELECT ps.rowid, ps.datec, ps.fk_user_author';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'payment_salary as ps';
|
||||
$sql.= ' WHERE ps.rowid = '.$id;
|
||||
|
||||
dol_syslog(get_class($this).'::info', LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows($result))
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$this->id = $obj->rowid;
|
||||
if ($obj->fk_user_author)
|
||||
{
|
||||
$cuser = new User($this->db);
|
||||
$cuser->fetch($obj->fk_user_author);
|
||||
$this->user_creation = $cuser;
|
||||
}
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
}
|
||||
$this->db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -51,12 +51,10 @@ function salaries_prepare_head($object) {
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
/*
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/salaries/info.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$head[$h][2] = 'info';
|
||||
$h++;
|
||||
*/
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'salaries', 'remove');
|
||||
|
||||
|
||||
@ -42,3 +42,6 @@ create table llx_overwrite_trans
|
||||
transvalue text
|
||||
)ENGINE=innodb;
|
||||
|
||||
ALTER TABLE llx_payment_salary ADD COLUMN datec datetime after tms;
|
||||
ALTER TABLE llx_payment_salary CHANGE COLUMN fk_user_creat fk_user_author integer;
|
||||
|
||||
|
||||
@ -20,6 +20,7 @@ create table llx_payment_salary
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
datec datetime, -- Create date
|
||||
fk_user integer NOT NULL,
|
||||
datep date, -- date de paiement
|
||||
datev date, -- date de valeur (this field should not be here, only into bank tables)
|
||||
@ -33,6 +34,6 @@ create table llx_payment_salary
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
note text,
|
||||
fk_bank integer,
|
||||
fk_user_creat integer, -- utilisateur qui a cree l'info
|
||||
fk_user_author integer, -- utilisateur qui a cree l'info
|
||||
fk_user_modif integer -- utilisateur qui a modifié l'info
|
||||
)ENGINE=innodb;
|
||||
Loading…
Reference in New Issue
Block a user