FIX Do not record resource owner of event when not defined.

More log to track payment errors.
This commit is contained in:
Laurent Destailleur 2020-01-01 12:47:01 +01:00
parent 3825e9af06
commit e4a03e98b7
4 changed files with 37 additions and 26 deletions

View File

@ -142,14 +142,14 @@ $enabledisablehtml = $langs->trans("EnablePublicSubscriptionForm").' ';
if (empty($conf->global->MEMBER_ENABLE_PUBLIC))
{
// Button off, click to enable
$enabledisablehtml .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMEMBER_ENABLE_PUBLIC&value=1'.$param.'">';
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMEMBER_ENABLE_PUBLIC&value=1'.$param.'">';
$enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
$enabledisablehtml .= '</a>';
}
else
{
// Button on, click to disable
$enabledisablehtml .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMEMBER_ENABLE_PUBLIC&value=0'.$param.'">';
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMEMBER_ENABLE_PUBLIC&value=0'.$param.'">';
$enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
$enabledisablehtml .= '</a>';
}
@ -174,8 +174,8 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC))
$adht = new AdherentType($db);
print '<tr class="oddeven drag" id="trforcetype"><td>';
print $langs->trans("ForceMemberType");
print '</td><td width="60" class="right">';
$listofval = array(-1 => $langs->trans("Undefined"));
print '</td><td class="right">';
$listofval = array();
$listofval += $adht->liste_array();
$forcetype = $conf->global->MEMBER_NEWFORM_FORCETYPE ?: -1;
print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listofval)>1?1:0);

View File

@ -514,9 +514,10 @@ class ActionComm extends CommonObject
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."actioncomm", "id");
// Now insert assignedusers
// Now insert assigned users
if (!$error)
{
//dol_syslog(var_export($this->userassigned, true));
foreach ($this->userassigned as $key => $val)
{
if (!is_array($val)) // For backward compatibility when val=id
@ -524,16 +525,20 @@ class ActionComm extends CommonObject
$val = array('id'=>$val);
}
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
$sql .= " VALUES(".$this->id.", 'user', ".$val['id'].", ".(empty($val['mandatory']) ? '0' : $val['mandatory']).", ".(empty($val['transparency']) ? '0' : $val['transparency']).", ".(empty($val['answer_status']) ? '0' : $val['answer_status']).")";
if ($val['id'] > 0)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
$sql .= " VALUES(".$this->id.", 'user', ".$val['id'].", ".(empty($val['mandatory']) ? '0' : $val['mandatory']).", ".(empty($val['transparency']) ? '0' : $val['transparency']).", ".(empty($val['answer_status']) ? '0' : $val['answer_status']).")";
$resql = $this->db->query($sql);
if (!$resql)
{
$error++;
$this->errors[] = $this->db->lasterror();
}
//var_dump($sql);exit;
$resql = $this->db->query($sql);
if (!$resql)
{
$error++;
dol_syslog('Error to process userassigned: '.$this->db->lasterror(), LOG_ERR);
$this->errors[] = $this->db->lasterror();
}
//var_dump($sql);exit;
}
}
}
@ -541,7 +546,7 @@ class ActionComm extends CommonObject
{
if (!empty($this->socpeopleassigned))
{
foreach ($this->socpeopleassigned as $id => $Tab)
foreach ($this->socpeopleassigned as $id => $val)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
$sql .= " VALUES(".$this->id.", 'socpeople', ".$id.", 0, 0, 0)";
@ -550,6 +555,7 @@ class ActionComm extends CommonObject
if (!$resql)
{
$error++;
dol_syslog('Error to process socpeopleassigned: '.$this->db->lasterror(), LOG_ERR);
$this->errors[] = $this->db->lasterror();
}
}
@ -558,8 +564,6 @@ class ActionComm extends CommonObject
if (!$error)
{
$action = 'create';
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{

View File

@ -954,8 +954,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
}
else
{
$error ="Failed to insert event : ".$actioncomm->error." ".join(',', $actioncomm->errors);
$this->error=$error;
$this->error="Failed to insert event : ".$actioncomm->error." ".join(',', $actioncomm->errors);
$this->errors=$actioncomm->errors;
dol_syslog("interface_modAgenda_ActionsAuto.class.php: ".$this->error, LOG_ERR);

View File

@ -109,7 +109,7 @@ $ErrorCode=$ErrorShortMsg=$ErrorLongMsg=$ErrorSeverityCode='';
$object = new stdClass(); // For triggers
$error = 0;
/*
@ -205,11 +205,11 @@ if (! empty($conf->paypal->enabled))
if ($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING")
{
// Nothing to do
dol_syslog("Call to GetExpressCheckoutDetails return ".$ack);
dol_syslog("Call to GetExpressCheckoutDetails return ".$ack, LOG_DEBUG, 0, '_payment');
}
else
{
dol_syslog("Call to GetExpressCheckoutDetails return error: ".json_encode($resArray), LOG_WARNING);
dol_syslog("Call to GetExpressCheckoutDetails return error: ".json_encode($resArray), LOG_WARNING, '_payment');
}
dol_syslog("We call DoExpressCheckoutPayment token=".$onlinetoken." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag, LOG_DEBUG, 0, '_payment');
@ -219,7 +219,7 @@ if (! empty($conf->paypal->enabled))
$ack = strtoupper($resArray2["ACK"]);
if ($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING")
{
dol_syslog("Call to GetExpressCheckoutDetails return ".$ack);
dol_syslog("Call to GetExpressCheckoutDetails return ".$ack, LOG_DEBUG, 0, '_payment');
$object->source = $source;
$object->ref = $ref;
@ -238,7 +238,7 @@ if (! empty($conf->paypal->enabled))
}
else
{
dol_syslog("Call to DoExpressCheckoutPayment return error: ".json_encode($resArray2), LOG_WARNING);
dol_syslog("Call to DoExpressCheckoutPayment return error: ".json_encode($resArray2), LOG_WARNING, 0, '_payment');
//Display a user friendly Error on the page using any of the following error information returned by PayPal
$ErrorCode = urldecode($resArray2["L_ERRORCODE0"]);
@ -316,6 +316,8 @@ if ($ispaymentok)
$result1 = $object->fetch($tmptag['MEM']);
$result2 = $adht->fetch($object->typeid);
dol_syslog("We have to process member with id=".$tmptag['MEM']." result1=".$result1." result2=".$result2, LOG_DEBUG, 0, '_payment');
if ($result1 > 0 && $result2 > 0)
{
$paymentTypeId = 0;
@ -329,7 +331,9 @@ if ($ispaymentok)
$paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1);
}
$currencyCodeType = $_SESSION['currencyCodeType'];
$currencyCodeType = $_SESSION['currencyCodeType'];
dol_syslog("FinalPaymentAmt=".$FinalPaymentAmt." paymentTypeId=".$paymentTypeId, LOG_DEBUG, 0, '_payment');
// Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time)
if (! empty($FinalPaymentAmt) && $paymentTypeId > 0)
@ -342,6 +346,7 @@ if ($ispaymentok)
$postactionmessages[] = $errmsg;
$postactionmessages = array_merge($postactionmessages, $object->errors);
$ispostactionok = -1;
dol_syslog("Failed to validate member: ".$errmsg, LOG_ERR, 0, '_payment');
}
// Subscription informations
@ -366,9 +371,10 @@ if ($ispaymentok)
if ($accountid < 0)
{
$error++;
$errmsg='Setup of bank accout to use for payment is not correctly done for payment method '.$paymentmethod;
$errmsg='Setup of bank account to use for payment is not correctly done for payment method '.$paymentmethod;
$postactionmessages[] = $errmsg;
$ispostactionok = -1;
dol_syslog("Failed to get the bank account to record payment: ".$errmsg, LOG_ERR, 0, '_payment');
}
$operation=$paymentType; // Payment mode code
@ -844,10 +850,12 @@ if ($ispaymentok)
if ($result)
{
dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment');
//dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0);
}
else
{
dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment');
//dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0);
}
}
}