diff --git a/htdocs/adherents/stats/byproperties.php b/htdocs/adherents/stats/byproperties.php index f067b27b3d4..ded3dec120e 100644 --- a/htdocs/adherents/stats/byproperties.php +++ b/htdocs/adherents/stats/byproperties.php @@ -101,7 +101,7 @@ else $head = member_stats_prepare_head($adh); -dol_fiche_head($head, 'statsbyproperties', $langs->trans("Statistics"), 0, 'user'); +dol_fiche_head($head, 'statsbyproperties', $langs->trans("Statistics"), -1, 'user'); // Print title diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 1f9ff189068..1c6944c2a0a 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -198,7 +198,7 @@ if ($mode) $head = member_stats_prepare_head($adh); -dol_fiche_head($head, $tab, $langs->trans("Statistics"), 0, 'user'); +dol_fiche_head($head, $tab, $langs->trans("Statistics"), -1, 'user'); // Print title diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index 1895eb5b15d..99742b19f57 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -174,8 +174,8 @@ $message.='
'; print $message; $message=$langs->trans("AgendaUrlOptions1",$user->login,$user->login).'
'; -//$message.=$langs->trans("AgendaUrlOptions2",$user->login,$user->login).'
'; $message.=$langs->trans("AgendaUrlOptions3",$user->login,$user->login).'
'; +$message.=$langs->trans("AgendaUrlOptionsNotAdmin",$user->login,$user->login).'
'; $message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'
'; $message.=$langs->trans("AgendaUrlOptionsProject",$user->login,$user->login); diff --git a/htdocs/categories/admin/categorie.php b/htdocs/categories/admin/categorie.php index d16b081e6ae..55006a8b171 100644 --- a/htdocs/categories/admin/categorie.php +++ b/htdocs/categories/admin/categorie.php @@ -37,6 +37,7 @@ $action=GETPOST('action','aZ09'); /* * Actions */ + if (preg_match('/set_(.*)/',$action,$reg)) { $code=$reg[1]; @@ -82,7 +83,7 @@ print load_fiche_titre($langs->trans("CategoriesSetup"),$linkback,'title_setup') $head=categoriesadmin_prepare_head(); -dol_fiche_head($head, 'setup', $langs->trans("Categories"), 0, 'category'); +dol_fiche_head($head, 'setup', $langs->trans("Categories"), -1, 'category'); print ''; diff --git a/htdocs/categories/admin/categorie_extrafields.php b/htdocs/categories/admin/categorie_extrafields.php index 2bc9f205334..6291d2065c2 100644 --- a/htdocs/categories/admin/categorie_extrafields.php +++ b/htdocs/categories/admin/categorie_extrafields.php @@ -68,7 +68,7 @@ print load_fiche_titre($langs->trans("CategoriesSetup"),$linkback,'title_setup') $head = categoriesadmin_prepare_head(); -dol_fiche_head($head, 'attributes_categories', $langs->trans("Categories"), 0, 'category'); +dol_fiche_head($head, 'attributes_categories', $langs->trans("Categories"), -1, 'category'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 60ef207bb48..b294f7c4aeb 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -447,9 +447,10 @@ class Categorie extends CommonObject * Delete a category from database * * @param User $user Object user that ask to delete - * @return int <0 KO >0 OK + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int <0 KO >0 OK */ - function delete($user) + function delete($user, $notrigger=0) { global $conf,$langs; @@ -462,6 +463,14 @@ class Categorie extends CommonObject $this->db->begin(); + if (! $error && ! $notrigger) + { + // Call trigger + $result=$this->call_trigger('CATEGORY_DELETE',$user); + if ($result < 0) $error++; + // End call triggers + } + /* FIX #1317 : Check for child category and move up 1 level*/ if (! $error) { @@ -580,25 +589,16 @@ class Categorie extends CommonObject $this->error=$this->db->lasterror(); $error++; } - else + } + + // Removed extrafields + if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $result=$this->deleteExtraFields(); + if ($result < 0) { - // Removed extrafields - if (! $error) - { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used - { - $result=$this->deleteExtraFields(); - if ($result < 0) - { - $error++; - dol_syslog(get_class($this)."::delete erreur ".$this->error, LOG_ERR); - } - } - } - // Call trigger - $result=$this->call_trigger('CATEGORY_DELETE',$user); - if ($result < 0) { $error++; } - // End call triggers + $error++; + dol_syslog(get_class($this)."::delete erreur ".$this->error, LOG_ERR); } } diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 8243268574c..70b2acb86b7 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -38,7 +38,7 @@ class ActionComm extends CommonObject public $table_rowid = 'id'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe public $picto='action'; - + /** * Id of the event * @var int @@ -168,7 +168,7 @@ class ActionComm extends CommonObject var $email_subject; var $errors_to; - + /** * Constructor * @@ -444,7 +444,7 @@ class ActionComm extends CommonObject $u->fetch($fuser); $fuser = $u; } - else + else { $fuser = $user; } @@ -657,11 +657,11 @@ class ActionComm extends CommonObject $this->error=$this->db->lasterror(); $error++; } - + if (! $error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_resources"; $sql.= " WHERE fk_actioncomm=".$this->id; - + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $res=$this->db->query($sql); if ($res < 0) { @@ -669,7 +669,7 @@ class ActionComm extends CommonObject $error++; } } - + // Removed extrafields if (! $error) { $result=$this->deleteExtraFields(); @@ -1091,7 +1091,7 @@ class ActionComm extends CommonObject else if ($percent > 0 && $percent < 100) return $percent.'% '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3'); else if ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6'); } - + return ''; } @@ -1112,20 +1112,20 @@ class ActionComm extends CommonObject global $conf, $langs, $user, $hookmanager; if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips - + $label = $this->label; if (empty($label)) $label=$this->libelle; // For backward compatibility $result=''; - + // Set label of typ $labeltype = ($langs->transnoentities("Action".$this->type_code) != "Action".$this->type_code)?$langs->transnoentities("Action".$this->type_code):$this->type_label; if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) { if ($this->type_code != 'AC_OTH_AUTO') $labeltype = $langs->trans('ActionAC_MANUAL'); } - - + + $tooltip = '' . $langs->trans('ShowAction'.$objp->code) . ''; if (! empty($this->ref)) $tooltip .= '
' . $langs->trans('Ref') . ': ' . $this->ref; @@ -1137,7 +1137,7 @@ class ActionComm extends CommonObject $tooltip .= '
' . $langs->trans('Location') . ': ' . $this->location; $linkclose=''; - if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color) + if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color) $linkclose = ' style="background-color:#'.$this->type_color.'"'; if (empty($notooltip)) @@ -1149,7 +1149,7 @@ class ActionComm extends CommonObject } $linkclose.=' title="'.dol_escape_htmltag($tooltip, 1).'"'; $linkclose.=' class="'.$classname.' classfortooltip"'; - + if (! is_object($hookmanager)) { include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; @@ -1161,17 +1161,17 @@ class ActionComm extends CommonObject $linkclose = ($hookmanager->resPrint ? $hookmanager->resPrint : $linkclose); } else $linkclose.=' class="'.$classname.'"'; - + $url=''; - if ($option=='birthday') + if ($option=='birthday') $url = DOL_URL_ROOT.'/contact/perso.php?id='.$this->id; - else + else $url = DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id; - + $linkstart = ''; $linkend=''; - + //print 'rrr'.$this->libelle.'-'.$withpicto; if ($withpicto == 2) @@ -1279,7 +1279,7 @@ class ActionComm extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; // Link to get author of event for export $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; // We must filter on assignement table - if ($filters['logint'] || $filters['login']) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar"; + if ($filters['logint']) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar"; $sql.= " WHERE a.fk_action=c.id"; $sql.= " AND a.entity IN (".getEntity('agenda').")"; foreach ($filters as $key => $value) @@ -1291,20 +1291,34 @@ class ActionComm extends CommonObject if ($key == 'idto') $sql.=" AND a.id <= ".(is_numeric($value)?$value:0); if ($key == 'project') $sql.=" AND a.fk_project=".(is_numeric($value)?$value:0); // We must filter on assignement table - if ($key == 'logint' || $key == 'login') $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; + if ($key == 'logint') $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; if ($key == 'logina') { $logina=$value; + $condition='='; + if (preg_match('/^!/',$logina)) + { + $logina=preg_replace('/^!/','',$logina); + $condition='<>'; + } $userforfilter=new User($this->db); - $result=$userforfilter->fetch('',$value); - $sql.= " AND a.fk_user_author = ".$userforfilter->id; + $result=$userforfilter->fetch('',$logina); + if ($result > 0) $sql.= " AND a.fk_user_author ".$condition." ".$userforfilter->id; + elseif ($result < 0 || $condition == '=') $sql.= " AND a.fk_user_author = 0"; } - if ($key == 'logint' || $key == 'login') + if ($key == 'logint') { $logint=$value; + $condition='='; + if (preg_match('/^!/',$logint)) + { + $logint=preg_replace('/^!/','',$logint); + $condition='<>'; + } $userforfilter=new User($this->db); - $result=$userforfilter->fetch('',$value); - $sql.= " AND ar.fk_element = ".$userforfilter->id; + $result=$userforfilter->fetch('',$logint); + if ($result > 0) $sql.= " AND ar.fk_element = ".$userforfilter->id; + elseif ($result < 0 || $condition == '=') $sql.= " AND ar.fk_element = 0"; } } $sql.= " AND a.datep IS NOT NULL"; // To exclude corrupted events and avoid errors in lightning/sunbird import diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 526d43de0ab..4358e8695fe 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -735,13 +735,13 @@ class DoliDBMysqli extends DoliDB { // cles recherchees dans le tableau des descriptions (field_desc) : type,value,attribute,null,default,extra // ex. : $field_desc = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); - $sql= "ALTER TABLE ".$table." ADD `".$field_name."` "; + $sql= "ALTER TABLE ".$table." ADD ".$field_name." "; $sql.= $field_desc['type']; if(preg_match("/^[^\s]/i",$field_desc['value'])) - if (! in_array($field_desc['type'],array('date','datetime'))) - { - $sql.= "(".$field_desc['value'].")"; - } + if (! in_array($field_desc['type'],array('date','datetime'))) + { + $sql.= "(".$field_desc['value'].")"; + } if(preg_match("/^[^\s]/i",$field_desc['attribute'])) $sql.= " ".$field_desc['attribute']; if(preg_match("/^[^\s]/i",$field_desc['null'])) diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 4aa56b367f3..d02ff4a1341 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -1048,8 +1048,11 @@ class DoliDBPgsql extends DoliDB // ex. : $field_desc = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); $sql= "ALTER TABLE ".$table." ADD ".$field_name." "; $sql .= $field_desc['type']; - if ($field_desc['type'] != 'int' && preg_match("/^[^\s]/i",$field_desc['value'])) - $sql .= "(".$field_desc['value'].")"; + if(preg_match("/^[^\s]/i",$field_desc['value'])) + if (! in_array($field_desc['type'],array('int','date','datetime'))) + { + $sql.= "(".$field_desc['value'].")"; + } if (preg_match("/^[^\s]/i",$field_desc['attribute'])) $sql .= " ".$field_desc['attribute']; if (preg_match("/^[^\s]/i",$field_desc['null'])) diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index 9e7af7b0d06..4e2e2acf378 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -80,9 +80,9 @@ AgendaModelModule=Document templates for event DateActionStart=Start date DateActionEnd=End date AgendaUrlOptions1=You can also add following parameters to filter output: -AgendaUrlOptions2=login=%s to restrict output to actions created by or assigned to user %s. AgendaUrlOptions3=logina=%s to restrict output to actions owned by a user %s. -AgendaUrlOptions4=logint=%s to restrict output to actions assigned to user %s. +AgendaUrlOptionsNotAdmin=logina=!%s to restrict output to actions not owned by user %s. +AgendaUrlOptions4=logint=%s to restrict output to actions assigned to user %s (owner and others). AgendaUrlOptionsProject=project=PROJECT_ID to restrict output to actions associated to project PROJECT_ID. AgendaShowBirthdayEvents=Show birthdays of contacts AgendaHideBirthdayEvents=Hide birthdays of contacts diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index ae9cd743c8f..3c47b188972 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -247,12 +247,18 @@ ComposedProduct=Sub-product MinSupplierPrice=Minimum supplier price MinCustomerPrice=Minimum customer price DynamicPriceConfiguration=Dynamic price configuration -DynamicPriceDesc=On product card, with this module enabled, you should be able to set mathematic functions to calculate Customer or Supplier prices. Such function can use all mathematic operators, some constants and variables. You can set here the variables you want to be able and if the variable need an automatic update, the external URL to use to ask Dolibarr to update automaticaly the value. +DynamicPriceDesc=On product card, with this module enabled, you should be able to set mathematic functions to calculate Customer or Supplier prices. Such function can use all mathematic operators, some constants and variables. You can set here the variables you want to be able to use and if the variable need an automatic update, the external URL to use to ask Dolibarr to update automaticaly the value. AddVariable=Add Variable AddUpdater=Add Updater GlobalVariables=Global variables VariableToUpdate=Variable to update GlobalVariableUpdaters=Global variable updaters +GlobalVariableUpdaterType0=JSON data +GlobalVariableUpdaterHelp0=Parses JSON data from specified URL, VALUE specifies the location of relevant value, +GlobalVariableUpdaterHelpFormat0=Format for request {"URL": "http://example.com/urlofjson", "VALUE": "array1,array2,targetvalue"} +GlobalVariableUpdaterType1=WebService data +GlobalVariableUpdaterHelp1=Parses WebService data from specified URL, NS specifies the namespace, VALUE specifies the location of relevant value, DATA should contain the data to send and METHOD is the calling WS method +GlobalVariableUpdaterHelpFormat1=Format for request is {"URL": "http://example.com/urlofws", "VALUE": "array,targetvalue", "NS": "http://example.com/urlofns", "METHOD": "myWSMethod", "DATA": {"your": "data", "to": "send"}} UpdateInterval=Update interval (minutes) LastUpdated=Latest update CorrectlyUpdated=Correctly updated diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index 0593f9ccd05..d5a17f02239 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -172,7 +172,7 @@ while ($i < min($num,$limit)) $opensurvey_static->id=$obj->id_sondage; $opensurvey_static->status=$obj->status; - + print ''; print ''; print''."\n"; - + print ''; print''."\n"; - + print''."\n"; print ''."\n"; $i++; } +// If no record found +if ($num == 0) +{ + $colspan=8; + //foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; } + print ''; +} + print '
'; print ''.img_picto('','object_opensurvey').' '.$obj->id_sondage.''; @@ -198,19 +198,27 @@ while ($i < min($num,$limit)) print ''.$nbuser.''.dol_print_date($db->jdate($obj->date_fin),'day'); if ($db->jdate($obj->date_fin) < time()) { print ' ('.$langs->trans("Expired").')'; } print ''.$opensurvey_static->getLibStatut(5).'
'.$langs->trans("NoRecordFound").'
'."\n"; print ''; print ''; diff --git a/htdocs/product/admin/dynamic_prices.php b/htdocs/product/admin/dynamic_prices.php index 24f1d64e30c..b044471e3e1 100644 --- a/htdocs/product/admin/dynamic_prices.php +++ b/htdocs/product/admin/dynamic_prices.php @@ -54,9 +54,11 @@ if ($action == 'edit_updater') { } } + /* * Actions */ + if (!empty($action) && empty($cancel)) { //Global variable actions if ($action == 'create_variable' || $action == 'edit_variable') { diff --git a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php index 3c176f0530e..0948275ce2b 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php @@ -464,24 +464,18 @@ class PriceGlobalVariableUpdater } $result = ""; if ($this->type == 0) { - //CURL client - $handle = curl_init(); - curl_setopt_array($handle, array( - CURLOPT_URL => $url, - CURLOPT_RETURNTRANSFER => true, - CURLOPT_TIMEOUT => 5, - CURLOPT_POST => false, - CURLOPT_HEADER => false, - )); + // Call JSON request + include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; + $tmpresult=getURLContent($url); + $code=$tmpresult['http_code']; + $result=$tmpresult['content']; - $result = curl_exec($handle); - $code = curl_getinfo($handle, CURLINFO_HTTP_CODE); if (!isset($result)) { $this->error = $langs->trans("ErrorGlobalVariableUpdater0", "empty response"); return -1; } if ($code !== 200) { - $this->error = $langs->trans("ErrorGlobalVariableUpdater0", $code); + $this->error = $langs->trans("ErrorGlobalVariableUpdater0", $code.' '.$tmpresult['curl_error_msg']); return -1; } diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php index b3886824485..81a67204fdb 100644 --- a/htdocs/public/agenda/agendaexport.php +++ b/htdocs/public/agenda/agendaexport.php @@ -65,19 +65,18 @@ if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_A // Define format, type and filter $format='ical'; $type='event'; -if (! empty($_GET["format"])) $format=$_GET["format"]; -if (! empty($_GET["type"])) $type=$_GET["type"]; +if (GETPOST("format",'alpha')) $format=GETPOST("format",'apha'); +if (GETPOST("type",'apha')) $type=GETPOST("type",'alpha'); $filters=array(); -if (! empty($_GET["year"])) $filters['year']=$_GET["year"]; -if (! empty($_GET["id"])) $filters['id']=$_GET["id"]; -if (! empty($_GET["idfrom"])) $filters['idfrom']=$_GET["idfrom"]; -if (! empty($_GET["idto"])) $filters['idto']=$_GET["idto"]; -if (! empty($_GET["project"])) $filters['project']=$_GET["project"]; -if (! empty($_GET["login"])) $filters['login']=$_GET["login"]; -if (! empty($_GET["logina"])) $filters['logina']=$_GET["logina"]; -if (! empty($_GET["logint"])) $filters['logint']=$_GET["logint"]; -if (GETPOST("notolderthan")) $filters['notolderthan']=GETPOST("notolderthan","int"); +if (GETPOST("year",'int')) $filters['year']=GETPOST("year",'int'); +if (GETPOST("id",'int')) $filters['id']=GETPOST("id",'int'); +if (GETPOST("idfrom",'int')) $filters['idfrom']=GETPOST("idfrom",'int'); +if (GETPOST("idto",'int')) $filters['idto']=GETPOST("idto",'int'); +if (GETPOST("project",'apha')) $filters['project']=GETPOST("project",'apha'); +if (GETPOST("logina",'apha')) $filters['logina']=GETPOST("logina",'apha'); +if (GETPOST("logint",'apha')) $filters['logint']=GETPOST("logint",'apha'); +if (GETPOST("notolderthan",'int')) $filters['notolderthan']=GETPOST("notolderthan","int"); else $filters['notolderthan']=$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY; // Check config @@ -115,7 +114,6 @@ foreach ($filters as $key => $value) if ($key == 'idfrom') $filename.='-idfrom'.$value; if ($key == 'idto') $filename.='-idto'.$value; if ($key == 'project') $filename.='-project'.$value; - if ($key == 'login') $filename.='-login'.$value; if ($key == 'logina') $filename.='-logina'.$value; // Author if ($key == 'logint') $filename.='-logint'.$value; // Assigned to } diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 11405d15acc..53658c588c6 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -311,7 +311,9 @@ if ($ret) } else { - print ''.$langs->trans('NoResourceInDatabase').''; + $colspan=1; + foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; } + print ''.$langs->trans("NoRecordFound").''; } print '';