FIX Subscription not correctly log in blockedlog

This commit is contained in:
Laurent Destailleur 2018-03-05 17:07:59 +01:00
parent 7c95233e3c
commit 17e012e0ac
4 changed files with 54 additions and 12 deletions

View File

@ -474,7 +474,7 @@ if (is_array($blocks))
print '<td class="nowrap">'.$block->ref_object.'</td>';
// Link to source object
print '<td>'.$object_link.'</td>';
print '<td><!-- object_link -->'.$object_link.'</td>';
// Amount
print '<td align="right">'.price($block->amounts).'</td>';
@ -501,7 +501,7 @@ if (is_array($blocks))
print '</td>';
// Status note
// Note
print '<td class="center">';
if (! $checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror)) // If error
{

View File

@ -87,7 +87,7 @@ function formatObject($objtoshow, $prefix)
{
$s.='<tr><td>'.($prefix?$prefix.' > ':'').$key.'</td>';
$s.='<td>';
if (in_array($key, array('date','datef')))
if (in_array($key, array('date','datef','dateh','datec','datem','datep')))
{
$s.=dol_print_date($val, 'dayhour');
}

View File

@ -239,6 +239,17 @@ class BlockedLog
$this->error++;
}
}
else if($this->element === 'subscription') {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
$object = new Subscription($this->db);
if ($object->fetch($this->fk_object)>0) {
return $object->getNomUrl(1);
}
else{
$this->error++;
}
}
else if ($this->action == 'MODULE_SET')
{
return '<i class="opacitymedium">System to track events into unalterable logs were enabled</i>';
@ -313,6 +324,10 @@ class BlockedLog
{
$this->date_object = $object->datepaid?$object->datepaid:$object->datep;
}
elseif ($object->element=='subscription')
{
$this->date_object = $object->dateh;
}
else {
$this->date_object = $object->date;
}
@ -323,7 +338,10 @@ class BlockedLog
// id of object
$this->fk_object = $object->id;
// Set object_data
$this->object_data=new stdClass();
$arrayoffieldstoexclude = array('table_element','fields','ref_previous','ref_next','origin','origin_id','oldcopy','picto','error','modelpdf','table_element_line','linkedObjectsIds','linkedObjects','fk_delivery_address');
// Add thirdparty info
if (empty($object->thirdparty) && method_exists($object, 'fetch_thirdparty')) $object->fetch_thirdparty();
@ -333,7 +351,7 @@ class BlockedLog
foreach($object->thirdparty as $key=>$value)
{
if (in_array($key, array('fields'))) continue; // Discard some properties
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
if (! in_array($key, array(
'name','name_alias','ref_ext','address','zip','town','state_code','country_code','idprof1','idprof2','idprof3','idprof4','idprof5','idprof6','phone','fax','email','barcode',
'tva_intra', 'localtax1_assuj', 'localtax1_value', 'localtax2_assuj', 'localtax2_value', 'managers', 'capital', 'typent_code', 'forme_juridique_code', 'code_client', 'code_fournisseur'
@ -349,7 +367,7 @@ class BlockedLog
foreach($mysoc as $key=>$value)
{
if (in_array($key, array('fields'))) continue; // Discard some properties
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
if (! in_array($key, array(
'name','name_alias','ref_ext','address','zip','town','state_code','country_code','idprof1','idprof2','idprof3','idprof4','idprof5','idprof6','phone','fax','email','barcode',
'tva_intra', 'localtax1_assuj', 'localtax1_value', 'localtax2_assuj', 'localtax2_value', 'managers', 'capital', 'typent_code', 'forme_juridique_code', 'code_client', 'code_fournisseur'
@ -366,12 +384,11 @@ class BlockedLog
}
// Field specific to object
if ($this->element == 'facture')
{
foreach($object as $key=>$value)
{
if (in_array($key, array('fields'))) continue; // Discard some properties
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
if (! in_array($key, array(
'ref','facnumber','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public','lines'
))) continue; // Discard if not into a dedicated list
@ -402,7 +419,7 @@ class BlockedLog
{
foreach($object as $key=>$value)
{
if (in_array($key, array('fields'))) continue; // Discard some properties
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
if (! in_array($key, array(
'ref','facnumber','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public'
))) continue; // Discard if not into a dedicated list
@ -498,7 +515,7 @@ class BlockedLog
$paymentpart->thirdparty = new stdClass();
foreach($tmpobject->thirdparty as $key=>$value)
{
if (in_array($key, array('fields'))) continue; // Discard some properties
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
if (! in_array($key, array(
'name','name_alias','ref_ext','address','zip','town','state_code','country_code','idprof1','idprof2','idprof3','idprof4','idprof5','idprof6','phone','fax','email','barcode',
'tva_intra', 'localtax1_assuj', 'localtax1_value', 'localtax2_assuj', 'localtax2_value', 'managers', 'capital', 'typent_code', 'forme_juridique_code', 'code_client', 'code_fournisseur'
@ -515,7 +532,7 @@ class BlockedLog
{
foreach($tmpobject as $key=>$value)
{
if (in_array($key, array('fields'))) continue; // Discard some properties
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
if (! in_array($key, array(
'ref','facnumber','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public'
))) continue; // Discard if not into a dedicated list
@ -542,6 +559,29 @@ class BlockedLog
if (! empty($object->newref)) $this->object_data->ref = $object->newref;
}
elseif($this->element == 'subscription')
{
foreach($object as $key=>$value)
{
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
if (! in_array($key, array(
'id','datec','dateh','datef','fk_adherent','amount','import_key','statut','note'
))) continue; // Discard if not into a dedicated list
if (!is_object($value)) $this->object_data->{$key} = $value;
}
if (! empty($object->newref)) $this->object_data->ref = $object->newref;
}
else // Generic case
{
foreach($object as $key=>$value)
{
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
if (!is_object($value)) $this->object_data->{$key} = $value;
}
if (! empty($object->newref)) $this->object_data->ref = $object->newref;
}
return 1;
}

View File

@ -69,14 +69,16 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
$amounts = 0;
if ($action==='BILL_VALIDATE' || $action==='BILL_DELETE' || $action === 'BILL_SENTBYMAIL'
|| $action==='BILL_SUPPLIER_VALIDATE' || $action==='BILL_SUPPLIER_DELETE' || $action === 'BILL_SUPPLIER_SENTBYMAIL'
|| $action==='MEMBER_SUBCRIPTION_CREATE' || $action==='MEMBER_SUBCRIPTION_MODIFY' || $action==='MEMBER_SUBCRIPTION_DELETE'
|| $action==='MEMBER_SUBSCRIPTION_CREATE' || $action==='MEMBER_SUBSCRIPTION_MODIFY' || $action==='MEMBER_SUBSCRIPTION_DELETE'
|| $action==='DON_VALIDATE' || $action==='DON_MODIFY' || $action==='DON_DELETE'
|| (in_array($object->element, array('facture','suplier_invoice')) && $action === 'DOC_DOWNLOAD') || (in_array($object->element, array('facture','suplier_invoice')) && $action === 'DOC_PREVIEW')
)
{
$qualified++;
if ($action==='DON_VALIDATE') $amounts = (double) $object->amount;
if (in_array($action, array(
'MEMBER_SUBSCRIPTION_CREATE','MEMBER_SUBSCRIPTION_MODIFY','MEMBER_SUBSCRIPTION_DELETE',
'DON_VALIDATE','DON_MODIFY','DON_DELETE'))) $amounts = (double) $object->amount;
else $amounts = (double) $object->total_ttc;
}
/*if ($action === 'BILL_PAYED' || $action==='BILL_UNPAYED'