Skip to content

Commit

Permalink
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
eldy committed Dec 10, 2016
2 parents cdba7cf + 1eb6748 commit 3131ef7
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 21 deletions.
4 changes: 2 additions & 2 deletions htdocs/compta/sociales/card.php
Expand Up @@ -426,7 +426,7 @@

print '<table class="border" width="100%">';

/*
/*
// Ref
print '<tr><td>'.$langs->trans("Ref").'</td><td>';
print $form->showrefnav($object,'id',$linkback);
Expand All @@ -446,7 +446,7 @@
}*/

// Type
print "<tr><td>".$langs->trans("Type")."</td><td>".$object->type_libelle."</td>";
print '<tr><td class="titlefield">'.$langs->trans("Type")."</td><td>".$object->type_libelle."</td>";
print "</tr>";

// Period end date
Expand Down
39 changes: 25 additions & 14 deletions htdocs/compta/sociales/class/chargesociales.class.php
Expand Up @@ -153,6 +153,8 @@ function create($user)
{
global $conf;

$now=dol_now();

// Nettoyage parametres
$newamount=price2num($this->amount,'MT');

Expand All @@ -162,17 +164,18 @@ function create($user)
return -2;
}


$this->db->begin();

$sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, entity)";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, entity, fk_user_author, date_creation)";
$sql.= " VALUES (".$this->type;
$sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL');
$sql.= ", ".($this->mode_reglement_id>0?"'".$this->mode_reglement_id."'":"NULL");
$sql.= ", '".$this->db->escape($this->lib)."',";
$sql.= " '".$this->db->idate($this->date_ech)."','".$this->db->idate($this->periode)."',";
$sql.= " '".price2num($newamount)."',";
$sql.= " ".$conf->entity;
$sql.= ", '".$this->db->escape($this->lib)."'";
$sql.= ", '".$this->db->idate($this->date_ech)."','".$this->db->idate($this->periode)."'";
$sql.= ", '".price2num($newamount)."'";
$sql.= ", ".$conf->entity;
$sql.= ", ".$user->id;
$sql.= ", '".$this->db->idate($now)."'";
$sql.= ")";

dol_syslog(get_class($this)."::create", LOG_DEBUG);
Expand Down Expand Up @@ -276,10 +279,11 @@ function update($user)
$this->db->begin();

$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales";
$sql.= " SET libelle='".$this->db->escape($this->lib)."',";
$sql.= " date_ech='".$this->db->idate($this->date_ech)."',";
$sql.= " periode='".$this->db->idate($this->periode)."',";
$sql.= " amount='".price2num($this->amount,'MT')."'";
$sql.= " SET libelle='".$this->db->escape($this->lib)."'";
$sql.= ", date_ech='".$this->db->idate($this->date_ech)."'";
$sql.= ", periode='".$this->db->idate($this->periode)."'";
$sql.= ", amount='".price2num($this->amount,'MT')."'";
$sql.= ", fk_user_modif=".$user->id;
$sql.= " WHERE rowid=".$this->id;

dol_syslog(get_class($this)."::update", LOG_DEBUG);
Expand Down Expand Up @@ -505,8 +509,9 @@ function getSommePaiement()
*/
function info($id)
{
$sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key";
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as e";
$sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key,";
$sql.= " fk_user_author, fk_user_modif, fk_user_valid";
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as e";
$sql.= " WHERE e.rowid = ".$id;

dol_syslog(get_class($this)."::info", LOG_DEBUG);
Expand All @@ -522,7 +527,13 @@ function info($id)
if ($obj->fk_user_author) {
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
$this->user_creation = $cuser;
}

if ($obj->fk_user_modif) {
$muser = new User($this->db);
$muser->fetch($obj->fk_user_modif);
$this->user_modification = $muser;
}

if ($obj->fk_user_valid) {
Expand All @@ -532,7 +543,7 @@ function info($id)
}

$this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem);
if (! empty($obj->fk_user_modif)) $this->date_modification = $this->db->jdate($obj->datem);
$this->date_validation = $this->db->jdate($obj->datev);
$this->import_key = $obj->import_key;
}
Expand Down
6 changes: 3 additions & 3 deletions htdocs/loan/class/paymentloan.class.php
Expand Up @@ -87,9 +87,9 @@ function create($user)

// Clean parameters
if (isset($this->fk_loan)) $this->fk_loan = trim($this->fk_loan);
if (isset($this->amount_capital)) $this->amount_capital = trim($this->amount_capital?$this->amount_capital:0);
if (isset($this->amount_insurance)) $this->amount_insurance = trim($this->amount_insurance?$this->amount_insurance:0);
if (isset($this->amount_interest)) $this->amount_interest = trim($this->amount_interest?$this->amount_interest:0);
if (isset($this->amount_capital)) $this->amount_capital = price2num($this->amount_capital?$this->amount_capital:0);
if (isset($this->amount_insurance)) $this->amount_insurance = price2num($this->amount_insurance?$this->amount_insurance:0);
if (isset($this->amount_interest)) $this->amount_interest = price2num($this->amount_interest?$this->amount_interest:0);
if (isset($this->fk_typepayment)) $this->fk_typepayment = trim($this->fk_typepayment);
if (isset($this->num_payment)) $this->num_payment = trim($this->num_payment);
if (isset($this->note_private)) $this->note_private = trim($this->note_private);
Expand Down
4 changes: 2 additions & 2 deletions htdocs/loan/payment/payment.php
Expand Up @@ -170,7 +170,7 @@

print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Loan").'</td>';

print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="2"><a href="'.DOL_URL_ROOT.'/loan/card.php?id='.$chid.'">'.$chid.'</a></td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td colspan="2"><a href="'.DOL_URL_ROOT.'/loan/card.php?id='.$chid.'">'.$chid.'</a></td></tr>';
print '<tr><td>'.$langs->trans("DateStart").'</td><td colspan="2">'.dol_print_date($loan->datestart,'day')."</td></tr>\n";
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$loan->label."</td></tr>\n";
print '<tr><td>'.$langs->trans("Amount").'</td><td colspan="2">'.price($loan->capital,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
Expand Down Expand Up @@ -198,7 +198,7 @@
print '<td colspan="3">'.$langs->trans("Payment").'</td>';
print '</tr>';

print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("Date").'</td><td colspan="2">';
print '<tr><td class="titlefield fieldrequired">'.$langs->trans("Date").'</td><td colspan="2">';
$datepaid = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$datepayment = empty($conf->global->MAIN_AUTOFILL_DATE)?(empty($_POST["remonth"])?-1:$datepaye):0;
$form->select_date($datepayment, '', '', '', '', "add_payment", 1, 1);
Expand Down

0 comments on commit 3131ef7

Please sign in to comment.