mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-07 16:41:48 +01:00
Merge branch 'develop' into extrafields_object_filter
This commit is contained in:
@@ -4925,6 +4925,15 @@ abstract class CommonObject
|
||||
$haschild = 0;
|
||||
foreach ($arraytoscan as $table => $element) {
|
||||
//print $id.'-'.$table.'-'.$elementname.'<br>';
|
||||
|
||||
// Check if module is enabled (to avoid error if tables of module not created)
|
||||
if (isset($element['enabled']) && !empty($element['enabled'])) {
|
||||
$enabled = (int) dol_eval($element['enabled'], 1);
|
||||
if (empty($enabled)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if element can be deleted
|
||||
$sql = "SELECT COUNT(*) as nb";
|
||||
$sql .= " FROM ".$this->db->prefix().$table." as c";
|
||||
@@ -6604,14 +6613,14 @@ abstract class CommonObject
|
||||
* Data to describe values to insert/update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
|
||||
* This function delete record with all extrafields and insert them again from the array $this->array_options.
|
||||
*
|
||||
* @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY)
|
||||
* @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY). Must be used for action 'update_extras'. For other actions, trigger is called explicitly by caller.
|
||||
* @param User $userused Object user
|
||||
* @return int<-1,1> -1=error, O=did nothing, 1=OK
|
||||
* @see insertExtraLanguages(), updateExtraField(), deleteExtraField(), setValueFrom()
|
||||
*/
|
||||
public function insertExtraFields($trigger = '', $userused = null)
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
global $langs, $user;
|
||||
|
||||
if (getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED')) {
|
||||
return 0;
|
||||
@@ -10335,6 +10344,7 @@ abstract class CommonObject
|
||||
|
||||
if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) {
|
||||
$fieldvalues['date_creation'] = $this->db->idate($now);
|
||||
$this->date_creation = $this->db->idate($now);
|
||||
}
|
||||
if (array_key_exists('fk_user_creat', $fieldvalues) && !($fieldvalues['fk_user_creat'] > 0)) {
|
||||
$fieldvalues['fk_user_creat'] = $user->id;
|
||||
|
||||
Reference in New Issue
Block a user