Merge pull request #8181 from ATM-Nicolas/new_charges_sociales_trigger
NEW Call to trigger on social contribution creation
This commit is contained in:
commit
f8f4d5caac
@ -156,6 +156,7 @@ class ChargeSociales extends CommonObject
|
||||
function create($user)
|
||||
{
|
||||
global $conf;
|
||||
$error=0;
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
@ -191,8 +192,17 @@ class ChargeSociales extends CommonObject
|
||||
$this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."chargesociales");
|
||||
|
||||
//dol_syslog("ChargesSociales::create this->id=".$this->id);
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
$result=$this->call_trigger('PAYMENTSOCIALCONTRIBUTION_CREATE',$user);
|
||||
if ($result < 0) $error++;
|
||||
|
||||
if(empty($error)) {
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
else {
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -50,10 +51,22 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date_contrat,'day'); ?></td>
|
||||
<td align="right"><?php // var_dump($objectlink->total_ttc); ?></td>
|
||||
<td align="right"><?php
|
||||
// Price of contract is not shown by default because a contract is a list of service with
|
||||
// start and end date that change with time andd that may be different that the period of reference for price.
|
||||
// So price of a contract does often means nothing. Prices is on the different invoices done on same contract.
|
||||
if ($user->rights->contrat->lire && empty($conf->global->CONTRACT_SHOW_TOTAL_OF_PRODUCT_AS_PRICE))
|
||||
{
|
||||
$totalcontrat = 0;
|
||||
foreach ($objectlink->lines as $linecontrat) {
|
||||
$totalcontrat = $totalcontrat + $linecontrat->total_ht;
|
||||
$total = $total + $linecontrat->total_ht;
|
||||
}
|
||||
echo price($totalcontrat);
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(7); ?></td>
|
||||
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
<!-- END PHP TEMPLATE -->
|
||||
|
||||
Loading…
Reference in New Issue
Block a user