Merge branch 'develop' of github.com:Dolibarr/dolibarr into develop

This commit is contained in:
Marc de Lima Lucio 2018-04-10 16:16:02 +02:00
commit cdcfe8e356
47 changed files with 302 additions and 524 deletions

View File

@ -8,6 +8,7 @@ English Dolibarr ChangeLog
WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* Remove old deprecated hook 'insertExtraFields'. Triggers must be used for action on CRUD events.
* Hook 'maildao' was renamed into 'mail' into the method sendfile that send emails, and method was renamed from
'doaction' into 'sendMail'.
* Rename trigger CONTRACT_SERVICE_ACTIVATE into LINECONTRACT_ACTIVATE and

View File

@ -1001,13 +1001,7 @@ else
}
// Other attributes
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
print $object->showOptionals($extrafields,'edit');
}
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
print '<tbody>';
print "</table>\n";
@ -1277,13 +1271,7 @@ else
print '</td></tr>';
// Other attributes
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
print $object->showOptionals($extrafields,'edit',$parameters);
}
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
print '</table>';

View File

@ -463,24 +463,15 @@ class Adherent extends CommonObject
$action='update';
// Actions on extra fields (by external module)
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('memberdao'));
$parameters=array('id'=>$this->id);
$action='';
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
$result=$this->insertExtraFields();
if ($result < 0)
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
$error++;
}
}
else if ($reshook < 0) $error++;
// Update password
if (! $error && $this->pass)

View File

@ -171,22 +171,15 @@ class AdherentType extends CommonObject
{
$action='update';
// Actions on extra fields (by external module or standard code)
$hookmanager->initHooks(array('membertypedao'));
$parameters=array('membertype'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
$result=$this->insertExtraFields();
if ($result < 0)
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
$error++;
}
}
else if ($reshook < 0) $error++;
if (! $error && ! $notrigger)
{

View File

@ -155,22 +155,15 @@ class AssetType extends CommonObject
{
$action='update';
// Actions on extra fields (by external module or standard code)
$hookmanager->initHooks(array('assettypedao'));
$parameters=array('assettype'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
$result=$this->insertExtraFields();
if ($result < 0)
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
$error++;
}
}
else if ($reshook < 0) $error++;
if (! $error && ! $notrigger)
{

View File

@ -338,28 +338,23 @@ class Categorie extends CommonObject
$action='create';
// Actions on extra fields (by external module or standard code)
// TODO the hook duplicates the trigger !!
$hookmanager->initHooks(array('HookModuleNamedao'));
$parameters=array('socid'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
$result=$this->insertExtraFields();
if ($result < 0)
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
$error++;
}
}
else if ($reshook < 0) $error++;
// Call trigger
$result=$this->call_trigger('CATEGORY_CREATE',$user);
if ($result < 0) { $error++; }
// End call triggers
if (! $error)
{
// Call trigger
$result=$this->call_trigger('CATEGORY_CREATE',$user);
if ($result < 0) { $error++; }
// End call triggers
}
if ( ! $error )
{
@ -432,28 +427,23 @@ class Categorie extends CommonObject
{
$action='update';
// Actions on extra fields (by external module or standard code)
// TODO the hook duplicates the trigger !!
$hookmanager->initHooks(array('HookCategorydao'));
$parameters=array();
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
$result=$this->insertExtraFields();
if ($result < 0)
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
$error++;
}
}
else if ($reshook < 0) $error++;
// Call trigger
$result=$this->call_trigger('CATEGORY_MODIFY',$user);
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
// End call triggers
if (! $error)
{
// Call trigger
$result=$this->call_trigger('CATEGORY_MODIFY',$user);
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
// End call triggers
}
$this->db->commit();

View File

@ -384,23 +384,15 @@ class ActionComm extends CommonObject
{
$action='create';
// Actions on extra fields (by external module or standard code)
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('actioncommdao'));
$parameters=array('actcomm'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
else if ($reshook < 0) $error++;
}
if (! $error && ! $notrigger)
@ -865,23 +857,15 @@ class ActionComm extends CommonObject
{
$action='update';
// Actions on extra fields (by external module or standard code)
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('actioncommdao'));
$parameters=array('actcomm'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
else if ($reshook < 0) $error++;
// Now insert assignedusers
if (! $error)

View File

@ -1114,12 +1114,8 @@ class Propal extends CommonObject
{
$action='update';
// Actions on extra fields (by external module or standard code)
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('propaldao'));
$parameters=array('socid'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
// Actions on extra fields
if (! $error)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
@ -1130,9 +1126,8 @@ class Propal extends CommonObject
}
}
}
else if ($reshook < 0) $error++;
if (! $notrigger)
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('PROPAL_CREATE',$user);
@ -3953,7 +3948,7 @@ class PropaleLigne extends CommonObjectLine
}
}
if (! $notrigger)
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('LINEPROPAL_INSERT',$user);
@ -4136,7 +4131,7 @@ class PropaleLigne extends CommonObjectLine
}
}
if (! $notrigger)
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('LINEPROPAL_UPDATE',$user);

View File

@ -1269,24 +1269,16 @@ if (empty($reshook))
if (! $error)
{
// Actions on extra fields (by external module or standard code)
$hookmanager->initHooks(array('orderdao'));
$parameters = array('id' => $object->id);
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by
// some hooks
if (empty($reshook)) {
$result = $object->insertExtraFields('ORDER_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
} else if ($reshook < 0)
// Actions on extra fields
$result = $object->insertExtraFields('ORDER_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
if ($error)
$action = 'edit_extras';
if ($error) $action = 'edit_extras';
}
if ($action == 'set_thirdparty' && $user->rights->commande->creer)

View File

@ -4208,7 +4208,7 @@ class OrderLine extends CommonOrderLine
}
}
if (! $notrigger)
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('LINEORDER_UPDATE',$user);

View File

@ -2117,7 +2117,7 @@ if (empty($reshook))
$fromElement = GETPOST('fromelement');
$fromElementid = GETPOST('fromelementid');
$importLines = GETPOST('line_checkbox');
if(!empty($importLines) && is_array($importLines) && !empty($fromElement) && ctype_alpha($fromElement) && !empty($fromElementid))
{
if($fromElement == 'commande')
@ -2164,7 +2164,7 @@ if (empty($reshook))
$fk_prev_id = '';
$fk_unit = $originLine->fk_unit;
$pu_ht_devise = $originLine->multicurrency_subprice;
$res = $object->addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $ventil, $info_bits, $fk_remise_except, $price_base_type, $pu_ttc, $type, $rang, $special_code, $origin, $origin_id, $fk_parent_line, $fk_fournprice, $pa_ht, $label, $array_options, $situation_percent, $fk_prev_id, $fk_unit,$pu_ht_devise);
if($res > 0){
$importCount++;
@ -2172,18 +2172,18 @@ if (empty($reshook))
$error++;
}
}
else{
$error++;
else{
$error++;
}
}
if($error)
{
setEventMessage($langs->trans('ErrorsOnXLines',$error), 'errors');
}
}
}
// Actions when printing a doc from card
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
@ -2209,22 +2209,15 @@ if (empty($reshook))
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute','none'));
if ($ret < 0) $error++;
if (! $error) {
// Actions on extra fields (by external module or standard code)
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('invoicedao'));
$parameters = array('id' => $object->id);
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by
// some hooks
if (empty($reshook)) {
$result = $object->insertExtraFields('BILL_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
} else if ($reshook < 0)
$error ++;
if (! $error)
{
// Actions on extra fields
$result = $object->insertExtraFields('BILL_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
if ($error)
@ -4537,16 +4530,16 @@ else if ($id > 0 || ! empty($ref))
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('invoice'));
$compatibleImportElementsList = false;
if($user->rights->facture->creer
&& $object->statut == Facture::STATUS_DRAFT
if($user->rights->facture->creer
&& $object->statut == Facture::STATUS_DRAFT
&& ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) )
{
$compatibleImportElementsList = array('commande'); // import from linked elements
}
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem,$compatibleImportElementsList);
// Show online payment link
$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));

View File

@ -1791,7 +1791,7 @@ class FactureLigneRec extends CommonInvoiceLine
}
}
if (! $notrigger)
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('LINEBILL_REC_UPDATE',$user);

View File

@ -750,35 +750,20 @@ class Facture extends CommonInvoice
{
$action='create';
// Actions on extra fields (by external module or standard code)
// TODO le hook fait double emploi avec le trigger !!
/*
$hookmanager->initHooks(array('invoicedao'));
$parameters=array('invoiceid'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{*/
// Actions on extra fields
if (! $error)
{
$result=$this->insertExtraFields();
if ($result < 0) $error++;
}
/*}
}
else if ($reshook < 0) $error++;*/
if (! $error)
{
if (! $notrigger)
{
// Call trigger
$result=$this->call_trigger('BILL_CREATE',$user);
if ($result < 0) $error++;
// End call triggers
}
}
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('BILL_CREATE',$user);
if ($result < 0) $error++;
// End call triggers
}
if (! $error)
{
@ -4697,7 +4682,7 @@ class FactureLigne extends CommonInvoiceLine
}
}
if (! $notrigger)
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('LINEBILL_UPDATE',$user);

View File

@ -417,7 +417,8 @@ if (empty($reshook))
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute','none'));
if ($ret < 0) $error++;
if (! $error) {
if (! $error)
{
$result = $object->insertExtraFields('BILLREC_MODIFY');
if ($result < 0)
{

View File

@ -366,11 +366,8 @@ class Contact extends CommonObject
$action='update';
// Actions on extra fields (by external module or standard code)
$hookmanager->initHooks(array('contactdao'));
$parameters=array('socid'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
// Actions on extra fields
if (! $error)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
@ -381,7 +378,6 @@ class Contact extends CommonObject
}
}
}
else if ($reshook < 0) $error++;
if (! $error && $this->user_id > 0)
{

View File

@ -191,7 +191,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
// Recipient was provided from combo list
if ($val == 'thirdparty') // Id of third party
{
$tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>';
$tmparray[] = dol_string_nospecial($thirdparty->name, ' ', array(",")).' <'.$thirdparty->email.'>';
}
elseif ($val) // Id du contact
{
@ -221,7 +221,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
// Recipient was provided from combo list
if ($val == 'thirdparty') // Id of third party
{
$tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>';
$tmparray[] = dol_string_nospecial($thirdparty->name, ' ', array(",")).' <'.$thirdparty->email.'>';
}
elseif ($val) // Id du contact
{
@ -245,13 +245,13 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$fromtype = GETPOST('fromtype','alpha');
if ($fromtype === 'robot') {
$from = $conf->global->MAIN_MAIL_EMAIL_FROM .' <'.$conf->global->MAIN_MAIL_EMAIL_FROM.'>';
$from = dol_string_nospecial($conf->global->MAIN_MAIL_EMAIL_FROM, ' ', array(",")) .' <'.$conf->global->MAIN_MAIL_EMAIL_FROM.'>';
}
elseif ($fromtype === 'user') {
$from = $user->getFullName($langs) .' <'.$user->email.'>';
$from = dol_string_nospecial($user->getFullName($langs), ' ', array(",")) .' <'.$user->email.'>';
}
elseif ($fromtype === 'company') {
$from = $conf->global->MAIN_INFO_SOCIETE_NOM .' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
$from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")) .' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
}
elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) {
$tmp=explode(',', $user->email_aliases);
@ -267,14 +267,14 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$obj = $db->fetch_object($resql);
if ($obj)
{
$from = $obj->label.' <'.$obj->email.'>';
$from = dol_string_nospecial($obj->label, ' ', array(",")).' <'.$obj->email.'>';
}
}
else {
$from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>';
$from = dol_string_nospecial($_POST['fromname'], ' ', array(",")) . ' <' . $_POST['frommail'] .'>';
}
$replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>';
$replyto = dol_string_nospecial($_POST['replytoname'], ' ', array(",")). ' <' . $_POST['replytomail'].'>';
$message = GETPOST('message','none');
$subject = GETPOST('subject','none');

View File

@ -5938,8 +5938,16 @@ abstract class CommonObject
$e = 0;
foreach($extrafields->attribute_label as $key=>$label)
{
if (empty($extrafields->attribute_list[$key])) continue; // 0 = Never visible field
if (($mode == 'create' || $mode == 'edit') && abs($extrafields->attribute_list[$key]) != 1 && abs($extrafields->attribute_list[$key]) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list
$enabled = $extrafields->attribute_list[$key];
if (empty($enabled)) continue; // 0 = Never visible field
if (! is_numeric($enabled))
{
$enabled=dol_eval($enabled, 1);
if (empty($enabled)) continue;
else $enabled = 1;
}
if (($mode == 'create' || $mode == 'edit') && abs($enabled) != 1 && abs($enabled) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list
// Load language if required
if (! empty($extrafields->attributes[$this->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$this->table_element]['langfile'][$key]);

View File

@ -144,7 +144,7 @@ class ExtraFields
* @param array|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
* @param int $list Visibilty (0=never visible, 1=visible on list+forms, 2=list onyl, 3=form only)
* @param string $list Visibilty ('0'=never visible, '1'=visible on list+forms, '2'=list only, '3'=form only or 'eval string')
* @param int $notused Deprecated.
* @param string $computed Computed value
* @param string $entity Entity of extrafields (for multicompany modules)
@ -152,7 +152,7 @@ class ExtraFields
* @param string $enabled Condition to have the field enabled or not
* @return int <=0 if KO, >0 if OK
*/
function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param='', $alwayseditable=0, $perms='', $list=-1, $notused=0, $computed='', $entity='', $langfile='', $enabled='1')
function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param='', $alwayseditable=0, $perms='', $list='-1', $notused=0, $computed='', $entity='', $langfile='', $enabled='1')
{
if (empty($attrname)) return -1;
if (empty($label)) return -1;
@ -198,11 +198,11 @@ class ExtraFields
* @param string $default_value Default value for field (in database)
* @param array $param Params for field (ex for select list : array('options'=>array('value'=>'label of option'))
* @param string $perms Permission
* @param int $list Into list view by default
* @param string $list Into list view by default
* @param string $computed Computed value
* @return int <=0 if KO, >0 if OK
*/
private function create($attrname, $type='varchar', $length=255, $elementtype='member', $unique=0, $required=0, $default_value='',$param='', $perms='', $list=0, $computed='')
private function create($attrname, $type='varchar', $length=255, $elementtype='member', $unique=0, $required=0, $default_value='',$param='', $perms='', $list='0', $computed='')
{
if ($elementtype == 'thirdparty') $elementtype='societe';
if ($elementtype == 'contact') $elementtype='socpeople';
@ -288,7 +288,7 @@ class ExtraFields
* @param array|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
* @param int $list Visibily
* @param string $list Visibily
* @param int $notused Deprecated.
* @param string $default Default value (in database. use the default_value feature for default value on screen).
* @param string $computed Computed value
@ -297,7 +297,7 @@ class ExtraFields
* @param string $enabled Condition to have the field enabled or not
* @return int <=0 if KO, >0 if OK
*/
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list=-1, $notused=0, $default='', $computed='',$entity='', $langfile='', $enabled='1')
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list='-1', $notused=0, $default='', $computed='',$entity='', $langfile='', $enabled='1')
{
global $conf,$user;
@ -306,7 +306,7 @@ class ExtraFields
// Clean parameters
if (empty($pos)) $pos=0;
if (empty($list)) $list=0;
if (empty($list)) $list='0';
if (empty($required)) $required=0;
if (empty($unique)) $unique=0;
if (empty($alwayseditable)) $alwayseditable=0;
@ -361,7 +361,7 @@ class ExtraFields
$sql.= " ".$alwayseditable.",";
$sql.= " ".($perms?"'".$this->db->escape($perms)."'":"null").",";
$sql.= " ".($langfile?"'".$this->db->escape($langfile)."'":"null").",";
$sql.= " ".$list.",";
$sql.= " '".$this->db->escape($list)."',";
$sql.= " ".($default?"'".$this->db->escape($default)."'":"null").",";
$sql.= " ".($computed?"'".$this->db->escape($computed)."'":"null").",";
$sql .= " " . $user->id . ",";
@ -496,7 +496,7 @@ class ExtraFields
* @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
* @param int $list Visibility
* @param string $list Visibility
* @param int $notused Deprecated.
* @param string $default Default value (in database. use the default_value feature for default value on screen).
* @param string $computed Computed value
@ -605,7 +605,7 @@ class ExtraFields
* @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
* @param int $list Visiblity
* @param string $list Visiblity
* @param int $notused Deprecated.
* @param string $default Default value (in database. use the default_value feature for default value on screen).
* @param string $computed Computed value
@ -614,7 +614,7 @@ class ExtraFields
* @param string $enabled Condition to have the field enabled or not
* @return int <=0 if KO, >0 if OK
*/
private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0,$perms='',$list=0,$notused=0,$default='',$computed='',$entity='',$langfile='',$enabled='1')
private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0,$perms='',$list='0',$notused=0,$default='',$computed='',$entity='',$langfile='',$enabled='1')
{
global $conf, $user;
dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required.", ".$pos.", ".$alwayseditable.", ".$perms.", ".$list.", ".$notused.", ".$default.", ".$computed.", ".$entity.", ".$langfile.", ".$enabled);
@ -624,7 +624,7 @@ class ExtraFields
if ($elementtype == 'contact') $elementtype='socpeople';
if (empty($pos)) $pos=0;
if (empty($list)) $list=0;
if (empty($list)) $list='0';
if (empty($required)) $required=0;
if (empty($unique)) $unique=0;
if (empty($alwayseditable)) $alwayseditable=0;
@ -688,7 +688,7 @@ class ExtraFields
$sql.= " ".$pos.",";
$sql.= " '".$this->db->escape($alwayseditable)."',";
$sql.= " '".$this->db->escape($params)."',";
$sql.= " ".$list.", ";
$sql.= " '".$this->db->escape($list)."', ";
$sql.= " ".(($default!='')?"'".$this->db->escape($default)."'":"null").",";
$sql.= " ".($computed?"'".$this->db->escape($computed)."'":"null").",";
$sql .= " " . $user->id . ",";

View File

@ -939,7 +939,7 @@ function dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
* @param int $keepb 1=Preserve b tags (otherwise, remove them)
* @param int $keepn 1=Preserve \r\n strings (otherwise, replace them with escaped value)
* @return string Escaped string
* @see dol_string_nohtmltag
* @see dol_string_nohtmltag, dol_string_nospecial, dol_string_unaccent
*/
function dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0)
{

View File

@ -252,7 +252,7 @@ else
<?php } ?>
<!-- Visibility -->
<tr><td class="extra_list"><?php echo $form->textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc")); ?>
</td><td class="valeur"><input id="list" size="1" type="text" name="list" value="<?php echo ($list!=''?$list:'1'); ?>"></td></tr>
</td><td class="valeur"><input id="list" class="minwidth100" type="text" name="list" value="<?php echo ($list!=''?$list:'1'); ?>"></td></tr>
</table>
<?php dol_fiche_end(); ?>

View File

@ -396,7 +396,7 @@ class Don extends CommonObject
}
// Update extrafield
if (!$error) {
if (! $error) {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
@ -482,7 +482,7 @@ class Don extends CommonObject
}
// Update extrafield
if (!$error)
if (! $error)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{

View File

@ -164,20 +164,13 @@ if (empty($reshook))
if (! $error)
{
// Actions on extra fields (by external module or standard code)
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('expeditiondao'));
$parameters = array('id' => $object->id);
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) {
$result = $object->insertExtraFields('SHIPMENT_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
} else if ($reshook < 0)
$error++;
// Actions on extra fields
$result = $object->insertExtraFields('SHIPMENT_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
if ($error)

View File

@ -311,23 +311,15 @@ class Expedition extends CommonObject
}
}
// Actions on extra fields (by external module or standard code)
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('expeditiondao'));
$parameters=array('socid'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
$result=$this->insertExtraFields();
if ($result < 0)
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
$error++;
}
}
else if ($reshook < 0) $error++;
if (! $error && ! $notrigger)
{
@ -1105,7 +1097,7 @@ class Expedition extends CommonObject
$error++;
}
if (! $error)
if (! $error)
{
if (! $notrigger)
{
@ -2690,19 +2682,21 @@ class ExpeditionLigne extends CommonObjectLine
$this->errors[]=$this->db->lasterror()." - sql=$sql";
$error++;
}
else
}
if (! $error)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
$result=$this->insertExtraFields();
if ($result < 0)
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$this->errors[]=$this->error;
$error++;
}
$this->errors[]=$this->error;
$error++;
}
}
}
if (! $error && ! $notrigger)
{
// Call trigger

View File

@ -189,20 +189,13 @@ if (empty($reshook))
if (! $error)
{
// Actions on extra fields (by external module or standard code)
$hookmanager->initHooks(array('orderdao'));
$parameters = array('id' => $object->id);
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by
// some hooks
if (empty($reshook)) {
$result = $object->insertExtraFields('SHIPMENT_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
} else if ($reshook < 0)
$error++;
// Actions on extra fields
$result = $object->insertExtraFields('SHIPMENT_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
if ($error)

View File

@ -288,20 +288,13 @@ if (empty($reshook))
if (! $error)
{
// Actions on extra fields (by external module or standard code)
$hookmanager->initHooks(array('expensereportdao'));
$parameters = array('id' => $object->id);
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by
// some hooks
if (empty($reshook)) {
$result = $object->insertExtraFields('FICHINTER_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
} else if ($reshook < 0)
$error++;
// Actions on extra fields
$result = $object->insertExtraFields('FICHINTER_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
if ($error)

View File

@ -750,20 +750,12 @@ if (empty($reshook))
if (! $error)
{
// Actions on extra fields (by external module or standard code)
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('interventiondao'));
$parameters=array('id'=>$object->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
// Actions on extra fields
$result=$object->insertExtraFields('INTERVENTION_MODIFY');
if ($result < 0)
{
$result=$object->insertExtraFields('INTERVENTION_MODIFY');
if ($result < 0)
{
$error++;
}
$error++;
}
else if ($reshook < 0) $error++;
}
if ($error) $action = 'edit_extras';

View File

@ -253,7 +253,7 @@ class Fichinter extends CommonObject
}
if (! $notrigger)
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('FICHINTER_CREATE',$user);

View File

@ -121,11 +121,13 @@ if (empty($reshook))
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute', 'none'));
if ($ret < 0) $error++;
if (! $error)
{
$result = $object->insertExtraFields('COMPANY_MODIFY');
if ($result < 0) $error++;
}
if ($error) $action = 'edit_extras';
}
}

View File

@ -3259,7 +3259,6 @@ class CommandeFournisseurLigne extends CommonOrderLine
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
{
@ -3347,7 +3346,6 @@ class CommandeFournisseurLigne extends CommonOrderLine
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
{

View File

@ -444,23 +444,15 @@ class FactureFournisseur extends CommonInvoice
{
$action='create';
// Actions on extra fields (by external module or standard code)
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('supplierinvoicedao'));
$parameters=array('socid'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
$result=$this->insertExtraFields(); // This also set $this->error or $this->errors if errors are found
if ($result < 0)
{
$result=$this->insertExtraFields(); // This also set $this->error or $this->errors if errors are found
if ($result < 0)
{
$error++;
}
$error++;
}
}
else if ($reshook < 0) $error++;
if (! $error)
{
@ -2830,7 +2822,9 @@ class SupplierInvoiceLine extends CommonObjectLine
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
if ($this->insertExtraFields() < 0) {
$result = $this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
@ -2976,7 +2970,7 @@ class SupplierInvoiceLine extends CommonObjectLine
}
}
if (! $notrigger)
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('LINEBILL_SUPPLIER_CREATE',$user);

View File

@ -955,32 +955,19 @@ if (empty($reshook))
if (! $error)
{
// Actions on extra fields (by external module or standard code)
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('supplierorderdao'));
$parameters=array('id'=>$object->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
$result=$object->insertExtraFields('ORDER_SUPPLIER_MODIFY');
if ($result < 0)
{
$result=$object->insertExtraFields('ORDER_SUPPLIER_MODIFY');
if ($result < 0)
{
$error++;
}
$error++;
}
}
else if ($reshook < 0) $error++;
}
else
{
if ($error)
$action = 'edit_extras';
}
}
/*

View File

@ -1459,35 +1459,21 @@ if (empty($reshook))
$ret = $extrafields->setOptionalsFromPost($extralabels,$object,GETPOST('attribute', 'none'));
if ($ret < 0) $error++;
if (!$error)
if (! $error)
{
// Actions on extra fields (by external module or standard code)
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('supplierinvoicedao'));
$parameters=array('id'=>$object->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
$result=$object->insertExtraFields('BILL_SUPPLIER_MODIFY');
if ($result < 0)
{
$result=$object->insertExtraFields('BILL_SUPPLIER_MODIFY');
if ($result < 0)
{
$error++;
}
$error++;
}
}
else if ($reshook < 0) $error++;
}
else
{
if ($error)
$action = 'edit_extras';
}
}
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->fournisseur->facture->creer)

View File

@ -411,3 +411,5 @@ UPDATE llx_accounting_account set account_parent = 0 WHERE account_parent = '' O
ALTER TABLE llx_accounting_account MODIFY COLUMN account_parent integer DEFAULT 0;
ALTER TABLE llx_accounting_account ADD INDEX idx_accounting_account_account_parent (account_parent);
ALTER TABLE llx_extrafields MODIFY COLUMN list VARCHAR(128);

View File

@ -35,7 +35,7 @@ create table llx_extrafields
pos integer DEFAULT 0,
alwayseditable integer DEFAULT 0, -- 1 if field can be edited whatever is element status
param text, -- extra parameters to define possible values of field
list integer DEFAULT 1, -- visibility of field. 0=Never visible, 1=Visible on list and forms, 2=Visible on list only. Using a negative value means field is not shown by default on list but can be selected for viewing
list varchar(255) DEFAULT '1', -- visibility of field. 0=Never visible, 1=Visible on list and forms, 2=Visible on list only. Using a negative value means field is not shown by default on list but can be selected for viewing
langs varchar(64), -- example: fileofmymodule@mymodule
fk_user_author integer, -- user making creation
fk_user_modif integer, -- user making last change

View File

@ -450,7 +450,7 @@ ModuleCompanyCodePanicum=Return an empty accounting code.
ModuleCompanyCodeDigitaria=Accounting code depends on third party code. The code is composed of the character "C" in the first position followed by the first 5 characters of the third party code.
Use3StepsApproval=By default, Purchase Orders need to be created and approved by 2 different users (one step/user to create and one step/user to approve. Note that if user has both permission to create and approve, one step/user will be enough). You can ask with this option to introduce a third step/user approval, if amount is higher than a dedicated value (so 3 steps will be necessary: 1=validation, 2=first approval and 3=second approval if amount is enough).<br>Set this to empty if one approval (2 steps) is enough, set it to a very low value (0.1) if a second approval (3 steps) is always required.
UseDoubleApproval=Use a 3 steps approval when amount (without tax) is higher than...
WarningPHPMail=WARNING: It is often better to setup outgoing emails to use the email server of your provider instead of the default setup. Some email providers (like Yahoo) does not allow you to send an email from another server than their own server. Your current setup use the server of the application to send email and not the server of your email provider, so some recipients (the one compatible with the restrictive DMARC protocol), will ask your email provider if they can accept your email and some email providers (like Yahoo) may respond "no" because the server is not a server of them, so few of your sent Emails may not be accepted (be car also to your email provider sending quota).<br>If your Email provider (like Yahoo) has this restriction, you must change Email setup to choose the other method "SMTP server" and enter the SMTP server and credentials provided by your Email provider (ask your EMail provider to get SMTP credentials for your account).
WarningPHPMail=WARNING: It is often better to setup outgoing emails to use the email server of your provider instead of the default setup. Some email providers (like Yahoo) does not allow you to send an email from another server than their own server. Your current setup use the server of the application to send email and not the server of your email provider, so some recipients (the one compatible with the restrictive DMARC protocol), will ask your email provider if they can accept your email and some email providers (like Yahoo) may respond "no" because the server is not a server of them, so few of your sent Emails may not be accepted (be carefull also to your email provider sending quota).<br>If your Email provider (like Yahoo) has this restriction, you must change Email setup to choose the other method "SMTP server" and enter the SMTP server and credentials provided by your Email provider (ask your EMail provider to get SMTP credentials for your account).
WarningPHPMail2=If your email SMTP provider need to restrict email client to some IP addresses (very rare), this is the IP address of your ERP CRM application: <strong>%s</strong>.
ClickToShowDescription=Click to show description
DependsOn=This module need the module(s)

View File

@ -202,20 +202,13 @@ if ($action == 'update_extras')
if (! $error)
{
// Actions on extra fields (by external module or standard code)
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('livraisondao'));
$parameters = array('id' => $object->id);
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) {
$result = $object->insertExtraFields('DELIVERY_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
} else if ($reshook < 0)
// Actions on extra fields
$result = $object->insertExtraFields('DELIVERY_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
if ($error)

View File

@ -540,7 +540,7 @@ class Livraison extends CommonObject
global $conf;
$error = 0;
if ($id > 0 && !$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used
if ($id > 0 && ! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used
{
$livraisonline = new LivraisonLigne($this->db);
$livraisonline->array_options=$array_options;

View File

@ -926,22 +926,15 @@ class Product extends CommonObject
$action='update';
// Actions on extra fields (by external module or standard code)
$hookmanager->initHooks(array('productdao'));
$parameters=array('id'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
$result=$this->insertExtraFields();
if ($result < 0)
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
$error++;
}
}
else if ($reshook < 0) $error++;
if (! $error && ! $notrigger)
{

View File

@ -131,20 +131,13 @@ if (empty($reshook))
if (! $error)
{
// Actions on extra fields (by external module or standard code)
$hookmanager->initHooks(array('productlotdao'));
$parameters = array('id' => $object->id);
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by
// some hooks
if (empty($reshook)) {
$result = $object->insertExtraFields('PRODUCT_LOT_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
} else if ($reshook < 0)
$error++;
// Actions on extra fields
$result = $object->insertExtraFields('PRODUCT_LOT_MODIFY');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
if ($error)

View File

@ -223,7 +223,7 @@ class Project extends CommonObject
}
// Update extrafield
if (!$error) {
if (! $error) {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
@ -234,13 +234,13 @@ class Project extends CommonObject
}
}
if (!$error && !empty($conf->global->MAIN_DISABLEDRAFTSTATUS))
if (! $error && !empty($conf->global->MAIN_DISABLEDRAFTSTATUS))
{
$res = $this->setValid($user);
if ($res < 0) $error++;
}
if (!$error)
if (! $error)
{
$this->db->commit();
return $ret;
@ -320,7 +320,7 @@ class Project extends CommonObject
}
}
if (! $error && !$notrigger)
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('PROJECT_MODIFY',$user);

View File

@ -333,6 +333,18 @@ class Task extends CommonObject
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
// Update extrafield
if (! $error) {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
}
if (! $error)
{
if (! $notrigger)
@ -344,18 +356,6 @@ class Task extends CommonObject
}
}
//Update extrafield
if (!$error) {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
}
if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref !== $this->ref))
{
// We remove directory

View File

@ -59,11 +59,7 @@ $backtopage=GETPOST('backtopage','alpha');
$action=GETPOST('action','alpha');
// Load translation files
$langs->load("main");
$langs->load("members");
$langs->load("companies");
$langs->load("install");
$langs->load("other");
$langs->loadLangs(array("main","members","companies","install","other"));
// Security check
if (empty($conf->adherent->enabled)) accessforbidden('',0,0,1);
@ -76,6 +72,8 @@ if (empty($conf->global->MEMBER_ENABLE_PUBLIC))
$extrafields = new ExtraFields($db);
$object = new Adherent($db);
/**
* Show header for new member
@ -487,17 +485,17 @@ llxHeaderVierge($langs->trans("NewSubscription"));
print load_fiche_titre($langs->trans("NewSubscription"), '', '', 0, 0, 'center');
print '<div class="center subscriptionformhelptext">';
print '<div align="center">';
print '<div id="divsubscribe">';
print '<div class="center subscriptionformhelptext justify">';
if (! empty($conf->global->MEMBER_NEWFORM_TEXT)) print $langs->trans($conf->global->MEMBER_NEWFORM_TEXT)."<br>\n";
else print $langs->trans("NewSubscriptionDesc",$conf->global->MAIN_INFO_SOCIETE_MAIL)."<br>\n";
print '</div>';
dol_htmloutput_errors($errmsg);
print '<div align="center">';
print '<div id="divsubscribe">';
// Print form
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newmember">'."\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" / >';
@ -631,13 +629,8 @@ print '</td></tr>'."\n";
print '<tr><td>'.$langs->trans("URLPhoto").'</td><td><input type="text" name="photo" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('photo')).'"></td></tr>'."\n";
// Public
print '<tr><td>'.$langs->trans("Public").'</td><td><input type="checkbox" name="public"></td></tr>'."\n";
// Extrafields
foreach($extrafields->attribute_label as $key=>$value)
{
print "<tr><td>".$value."</td><td>";
print $extrafields->showInputField($key,GETPOST('options_'.$key));
print "</td></tr>\n";
}
// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
// Comments
print '<tr>';
print '<td class="tdtop">'.$langs->trans("Comments").'</td>';

View File

@ -119,23 +119,15 @@ class Dolresource extends CommonObject
{
$action='create';
// Actions on extra fields (by external module or standard code)
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('actioncommdao'));
$parameters=array('actcomm'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
else if ($reshook < 0) $error++;
}
if (! $error)
@ -305,23 +297,15 @@ class Dolresource extends CommonObject
{
$action='update';
// Actions on extra fields (by external module or standard code)
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('actioncommdao'));
$parameters=array('actcomm'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
$result=$this->insertExtraFields();
if ($result < 0)
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
$error++;
}
}
else if ($reshook < 0) $error++;
}
// Commit or rollback

View File

@ -1056,23 +1056,15 @@ class Societe extends CommonObject
$action='update';
// Actions on extra fields (by external module or standard code)
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('thirdpartydao'));
$parameters=array('socid'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
$result=$this->insertExtraFields();
if ($result < 0)
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
$error++;
}
}
else if ($reshook < 0) $error++;
if (! $error && $call_trigger)
{
@ -2407,7 +2399,7 @@ class Societe extends CommonObject
{
$obj = $this->db->fetch_object($resql);
if ($mode == 'email') $contact_property = dolGetFirstLastname($obj->firstname, $obj->lastname)." <".$obj->email.">";
if ($mode == 'email') $contact_property = dol_string_nospecial(dolGetFirstLastname($obj->firstname, $obj->lastname), ' ', array(","))." <".$obj->email.">";
else if ($mode == 'mobile') $contact_property = $obj->phone_mobile;
}
return $contact_property;

View File

@ -960,24 +960,17 @@ class SupplierProposal extends CommonObject
{
$action='update';
// Actions on extra fields (by external module or standard code)
$hookmanager->initHooks(array('supplier_proposaldao'));
$parameters=array('socid'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
else if ($reshook < 0) $error++;
if (! $notrigger)
if (! $erro && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('PROPAL_SUPPLIER_CREATE',$user);
@ -2885,7 +2878,7 @@ class SupplierProposalLine extends CommonObjectLine
}
}
if (! $notrigger)
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('LINESUPPLIER_PROPOSAL_INSERT',$user);
@ -3061,7 +3054,7 @@ class SupplierProposalLine extends CommonObjectLine
}
}
if (! $notrigger)
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('LINESUPPLIER_PROPOSAL_UPDATE',$user);

View File

@ -400,7 +400,7 @@ class Ticketsup extends CommonObject
}
//Update extrafield
if (!$error) {
if (! $error) {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { // For avoid conflicts if trigger used
$result = $this->insertExtraFields();
if ($result < 0) {
@ -822,32 +822,25 @@ class Ticketsup extends CommonObject
$this->errors[] = "Error " . $this->db->lasterror();
}
if (!$error) {
// FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('TicketSupDao'));
$parameters = array('ticketsupid' => $this->id);
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { // For avoid conflicts if trigger used
$result = $this->insertExtraFields();
if ($result < 0) {
$error++;
}
}
} elseif ($reshook < 0) {
$error++;
}
if (!$notrigger) {
// Call trigger
$result=$this->call_trigger('TICKET_MODIFY', $user);
if ($result < 0) {
if (! $error) {
// Update extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { // For avoid conflicts if trigger used
$result = $this->insertExtraFields();
if ($result < 0) {
$error++;
}
// End call triggers
}
}
if (! $error && ! $notrigger) {
// Call trigger
$result=$this->call_trigger('TICKET_MODIFY', $user);
if ($result < 0) {
$error++;
}
// End call triggers
}
// Commit or rollback
if ($error) {
foreach ($this->errors as $errmsg) {

View File

@ -1572,7 +1572,7 @@ class User extends CommonObject
$action='update';
// Actions on extra fields (by external module or standard code)
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();