Merge branch '6.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/blockedlog/class/blockedlog.class.php htdocs/contrat/card.php htdocs/societe/card.php
This commit is contained in:
commit
e4645cf2c5
@ -96,7 +96,8 @@ class BlockedLog
|
|||||||
/**
|
/**
|
||||||
* try to retrieve logged object link
|
* try to retrieve logged object link
|
||||||
*/
|
*/
|
||||||
public function getObjectLink() {
|
public function getObjectLink()
|
||||||
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
if($this->element === 'facture') {
|
if($this->element === 'facture') {
|
||||||
@ -110,6 +111,17 @@ class BlockedLog
|
|||||||
$this->error++;
|
$this->error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if($this->element === 'invoice_supplier') {
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||||
|
|
||||||
|
$object = new FactureFournisseur($this->db);
|
||||||
|
if($object->fetch($this->fk_object)>0) {
|
||||||
|
return $object->getNomUrl(1);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$this->error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if($this->element === 'payment') {
|
else if($this->element === 'payment') {
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||||
|
|
||||||
@ -121,6 +133,17 @@ class BlockedLog
|
|||||||
$this->error++;
|
$this->error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if($this->element === 'payment_supplier') {
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||||
|
|
||||||
|
$object = new PaiementFourn($this->db);
|
||||||
|
if($object->fetch($this->fk_object)>0) {
|
||||||
|
return $object->getNomUrl(1);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$this->error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $langs->trans('ImpossibleToReloadObject', $this->element, $this->fk_object);
|
return $langs->trans('ImpossibleToReloadObject', $this->element, $this->fk_object);
|
||||||
|
|
||||||
@ -129,7 +152,8 @@ class BlockedLog
|
|||||||
/**
|
/**
|
||||||
* try to retrieve user author
|
* try to retrieve user author
|
||||||
*/
|
*/
|
||||||
public function getUser() {
|
public function getUser()
|
||||||
|
{
|
||||||
global $langs, $cachedUser;
|
global $langs, $cachedUser;
|
||||||
|
|
||||||
if(empty($cachedUser))$cachedUser=array();
|
if(empty($cachedUser))$cachedUser=array();
|
||||||
@ -149,14 +173,14 @@ class BlockedLog
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* populate log by object
|
* Populate properties of log from object data
|
||||||
*
|
*
|
||||||
* @param payment|facture $object object to store
|
* @param Object $object object to store
|
||||||
*/
|
*/
|
||||||
public function setObjectData(&$object) {
|
public function setObjectData(&$object)
|
||||||
|
{
|
||||||
// Set date
|
// Set date
|
||||||
if ($object->element=='payment')
|
if($object->element == 'payment' || $object->element == 'payment_supplier')
|
||||||
{
|
{
|
||||||
$this->date_object = $object->datepaye;
|
$this->date_object = $object->datepaye;
|
||||||
}
|
}
|
||||||
@ -174,7 +198,7 @@ class BlockedLog
|
|||||||
|
|
||||||
$this->object_data=new stdClass();
|
$this->object_data=new stdClass();
|
||||||
|
|
||||||
if ($this->element === 'facture')
|
if ($this->element == 'facture')
|
||||||
{
|
{
|
||||||
if(empty($object->thirdparty))$object->fetch_thirdparty();
|
if(empty($object->thirdparty))$object->fetch_thirdparty();
|
||||||
$this->object_data->thirdparty = new stdClass();
|
$this->object_data->thirdparty = new stdClass();
|
||||||
@ -190,15 +214,31 @@ class BlockedLog
|
|||||||
$this->object_data->total_localtax2= (double) $object->total_localtax2;
|
$this->object_data->total_localtax2= (double) $object->total_localtax2;
|
||||||
$this->object_data->note_public = (double) $object->note_public;
|
$this->object_data->note_public = (double) $object->note_public;
|
||||||
}
|
}
|
||||||
elseif($this->element === 'payment')
|
if($this->element == 'invoice_supplier') {
|
||||||
|
if(empty($object->thirdparty))$object->fetch_thirdparty();
|
||||||
|
$this->object_data->thirdparty = new stdClass();
|
||||||
|
|
||||||
|
foreach($object->thirdparty as $key=>$value) {
|
||||||
|
if(!is_object($value)) $this->object_data->thirdparty->{$key} = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->object_data->total_ht = (double) $object->total_ht;
|
||||||
|
$this->object_data->total_tva = (double) $object->total_tva;
|
||||||
|
$this->object_data->total_ttc = (double) $object->total_ttc;
|
||||||
|
$this->object_data->total_localtax1= (double) $object->total_localtax1;
|
||||||
|
$this->object_data->total_localtax2= (double) $object->total_localtax2;
|
||||||
|
$this->object_data->note_public = (double) $object->note_public;
|
||||||
|
$this->object_data->note_private= (double) $object->note_private;
|
||||||
|
|
||||||
|
}
|
||||||
|
elseif ($this->element == 'payment'|| $object->element == 'payment_supplier')
|
||||||
{
|
{
|
||||||
$this->object_data->amounts = $object->amounts;
|
$this->object_data->amounts = $object->amounts;
|
||||||
}
|
}
|
||||||
elseif($this->element === 'payment_salary')
|
elseif($this->element == 'payment_salary')
|
||||||
{
|
{
|
||||||
$this->object_data->amounts = array($object->amount);
|
$this->object_data->amounts = array($object->amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -520,6 +560,15 @@ class BlockedLog
|
|||||||
$this->amounts = (double) $obj->amount;
|
$this->amounts = (double) $obj->amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if($this->element === 'payment_supplier') {
|
||||||
|
$sql="SELECT amount FROM ".MAIN_DB_PREFIX."paiementfourn WHERE rowid=".$this->fk_object;
|
||||||
|
|
||||||
|
$res = $this->db->query($sql);
|
||||||
|
|
||||||
|
if($res && $obj = $this->db->fetch_object($res)) {
|
||||||
|
$this->amounts = (double) $obj->amount;
|
||||||
|
}
|
||||||
|
}
|
||||||
elseif($this->element === 'facture') {
|
elseif($this->element === 'facture') {
|
||||||
$sql="SELECT total_ttc FROM ".MAIN_DB_PREFIX."facture WHERE rowid=".$this->fk_object;
|
$sql="SELECT total_ttc FROM ".MAIN_DB_PREFIX."facture WHERE rowid=".$this->fk_object;
|
||||||
|
|
||||||
|
|||||||
@ -333,6 +333,15 @@ if (empty($reshook))
|
|||||||
$desc = dol_htmlentitiesbr($lines[$i]->desc);
|
$desc = dol_htmlentitiesbr($lines[$i]->desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Extrafields
|
||||||
|
$array_options = array();
|
||||||
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if
|
||||||
|
// trigger used
|
||||||
|
{
|
||||||
|
$lines[$i]->fetch_optionals($lines[$i]->rowid);
|
||||||
|
$array_options = $lines[$i]->array_options;
|
||||||
|
}
|
||||||
|
|
||||||
$txtva = $lines[$i]->vat_src_code ? $lines[$i]->tva_tx . ' (' . $lines[$i]->vat_src_code . ')' : $lines[$i]->tva_tx;
|
$txtva = $lines[$i]->vat_src_code ? $lines[$i]->tva_tx . ' (' . $lines[$i]->vat_src_code . ')' : $lines[$i]->tva_tx;
|
||||||
|
|
||||||
// View third's localtaxes for now
|
// View third's localtaxes for now
|
||||||
@ -355,7 +364,7 @@ if (empty($reshook))
|
|||||||
$lines[$i]->info_bits,
|
$lines[$i]->info_bits,
|
||||||
$lines[$i]->fk_fournprice,
|
$lines[$i]->fk_fournprice,
|
||||||
$lines[$i]->pa_ht,
|
$lines[$i]->pa_ht,
|
||||||
array(),
|
$array_options,
|
||||||
$lines[$i]->fk_unit
|
$lines[$i]->fk_unit
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -50,19 +50,27 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
|
|||||||
|
|
||||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
|
||||||
|
|
||||||
|
// Test if event/record is qualified
|
||||||
|
$listofqualifiedelement = array('payment', 'facture');
|
||||||
|
if (! in_array($object->element, $listofqualifiedelement)) return 1;
|
||||||
|
|
||||||
|
|
||||||
|
// Event/record is qualified
|
||||||
if ($action==='BILL_VALIDATE' || $action === 'BILL_PAYED' || $action==='BILL_UNPAYED'
|
if ($action==='BILL_VALIDATE' || $action === 'BILL_PAYED' || $action==='BILL_UNPAYED'
|
||||||
|| $action === 'BILL_SENTBYMAIL' || $action === 'DOC_DOWNLOAD' || $action === 'DOC_PREVIEW') {
|
|| $action === 'BILL_SENTBYMAIL' || $action === 'DOC_DOWNLOAD' || $action === 'DOC_PREVIEW'
|
||||||
|
|| $action === 'BILL_SUPPLIER_PAYED')
|
||||||
|
{
|
||||||
$amounts= (double) $object->total_ttc;
|
$amounts= (double) $object->total_ttc;
|
||||||
}
|
}
|
||||||
else if($action === 'PAYMENT_CUSTOMER_CREATE' || $action === 'PAYMENT_ADD_TO_BANK') {
|
else if($action === 'PAYMENT_CUSTOMER_CREATE' || $action === 'PAYMENT_ADD_TO_BANK' || $action === 'PAYMENT_SUPPLIER_CREATE')
|
||||||
|
{
|
||||||
$amounts = 0;
|
$amounts = 0;
|
||||||
if(!empty($object->amounts)) {
|
if(!empty($object->amounts)) {
|
||||||
foreach($object->amounts as $amount) {
|
foreach($object->amounts as $amount) {
|
||||||
$amounts+= price2num($amount);
|
$amounts+= price2num($amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(strpos($action,'PAYMENT')!==false) {
|
else if(strpos($action,'PAYMENT')!==false) {
|
||||||
$amounts= (double) $object->amount;
|
$amounts= (double) $object->amount;
|
||||||
@ -71,6 +79,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
|
|||||||
return 0; // not implemented action log
|
return 0; // not implemented action log
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$b=new BlockedLog($this->db);
|
$b=new BlockedLog($this->db);
|
||||||
$b->action = $action;
|
$b->action = $action;
|
||||||
$b->amounts= $amounts;
|
$b->amounts= $amounts;
|
||||||
@ -78,17 +87,15 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
|
|||||||
|
|
||||||
$res = $b->create($user);
|
$res = $b->create($user);
|
||||||
|
|
||||||
if($res<0) {
|
if ($res<0)
|
||||||
|
{
|
||||||
setEventMessage($b->error,'errors');
|
setEventMessage($b->error,'errors');
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -109,7 +109,7 @@ if ($socid > 0)
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($object->fournisseur)
|
if (! empty($conf->fournisseur->enabled) && $object->fournisseur && ! empty($user->rights->fournisseur->lire))
|
||||||
{
|
{
|
||||||
print '<tr><td class="titlefield">';
|
print '<tr><td class="titlefield">';
|
||||||
print $langs->trans('SupplierCode').'</td><td colspan="3">';
|
print $langs->trans('SupplierCode').'</td><td colspan="3">';
|
||||||
|
|||||||
@ -1995,9 +1995,12 @@ else
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Supplier
|
// Supplier
|
||||||
|
if (! empty($conf->fournisseur->enabled))
|
||||||
|
{
|
||||||
print '<tr><td>'.$langs->trans('Supplier').'</td><td>';
|
print '<tr><td>'.$langs->trans('Supplier').'</td><td>';
|
||||||
print yn($object->fournisseur);
|
print yn($object->fournisseur);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Prefix
|
// Prefix
|
||||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||||
|
|||||||
@ -180,7 +180,7 @@ if ($result > 0)
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($object->fournisseur)
|
if (! empty($conf->fournisseur->enabled) && $object->fournisseur && ! empty($user->rights->fournisseur->lire))
|
||||||
{
|
{
|
||||||
print '<tr><td class="titlefield">';
|
print '<tr><td class="titlefield">';
|
||||||
print $langs->trans('SupplierCode').'</td><td colspan="3">';
|
print $langs->trans('SupplierCode').'</td><td colspan="3">';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user