FIX Error reported when creation of thirdparty from member fails

This commit is contained in:
Laurent Destailleur 2018-12-18 21:27:16 +01:00
parent 31d032d5d3
commit f2318716ec
3 changed files with 8 additions and 5 deletions

View File

@ -586,13 +586,14 @@ class Adherent extends CommonObject
$lthirdparty->phone=$this->phone;
$lthirdparty->state_id=$this->state_id;
$lthirdparty->country_id=$this->country_id;
$lthirdparty->country_id=$this->country_id;
//$lthirdparty->phone_mobile=$this->phone_mobile;
$result=$lthirdparty->update($this->fk_soc,$user,0,1,1,'update'); // Use sync to 0 to avoid cyclic updates
$result=$lthirdparty->update($this->fk_soc, $user, 0, 1, 1, 'update'); // Use sync to 0 to avoid cyclic updates
if ($result < 0)
{
$this->error=$lthirdparty->error;
$this->errors=$lthirdparty->errors;
dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR);
$error++;
}

View File

@ -359,7 +359,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
$outputlangs->loadLangs(array("main", "members"));
// Get email content fro mtemplae
// Get email content from templae
$arraydefaultmessage=null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION;
@ -862,6 +862,7 @@ if ($rowid > 0)
$customercode = $tmpcompany->get_codeclient($tmpcompany,0);
$formquestion[]=array('label' => $langs->trans("CustomerCode"), 'type' => 'text', 'name' => 'customercode', 'value' => $customercode, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"');
}
// @TODO Add other extrafields mandatory for thirdparty creation
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion,1);
}

View File

@ -4848,6 +4848,7 @@ abstract class CommonObject
if ($this->array_options[$key] === '') $mandatorypb=true;
if ($mandatorypb)
{
dol_syslog($this->error);
$this->errors[]=$langs->trans('ErrorFieldRequired', $attributeLabel);
return -1;
}
@ -6142,7 +6143,7 @@ abstract class CommonObject
if (! is_object($form)) $form=new Form($db);
$out = '';
if (is_array($extrafields->attributes[$this->table_element]['label']) && count($extrafields->attributes[$this->table_element]['label']) > 0)
{
$out .= "\n";
@ -6156,7 +6157,7 @@ abstract class CommonObject
&& empty($extrafields->attributes[$this->table_element]['list'][$key]) && $mode == 'view'){
continue;
}
$enabled = 1;
if ($enabled && isset($extrafields->attributes[$this->table_element]['list'][$key]))
{