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

This commit is contained in:
florian HENRY 2017-07-05 11:01:57 +02:00
commit 437b2a7290
16 changed files with 116 additions and 88 deletions

View File

@ -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

View File

@ -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

View File

@ -174,8 +174,8 @@ $message.='<br>';
print $message;
$message=$langs->trans("AgendaUrlOptions1",$user->login,$user->login).'<br>';
//$message.=$langs->trans("AgendaUrlOptions2",$user->login,$user->login).'<br>';
$message.=$langs->trans("AgendaUrlOptions3",$user->login,$user->login).'<br>';
$message.=$langs->trans("AgendaUrlOptionsNotAdmin",$user->login,$user->login).'<br>';
$message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'<br>';
$message.=$langs->trans("AgendaUrlOptionsProject",$user->login,$user->login);

View File

@ -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 '<table class="noborder" width="100%">';

View File

@ -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';

View File

@ -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);
}
}

View File

@ -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 = '<u>' . $langs->trans('ShowAction'.$objp->code) . '</u>';
if (! empty($this->ref))
$tooltip .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
@ -1137,7 +1137,7 @@ class ActionComm extends CommonObject
$tooltip .= '<br><b>' . $langs->trans('Location') . ':</b> ' . $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 = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
$linkend='</a>';
//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

View File

@ -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']))

View File

@ -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']))

View File

@ -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=<b>login=%s</b> to restrict output to actions created by or assigned to user <b>%s</b>.
AgendaUrlOptions3=<b>logina=%s</b> to restrict output to actions owned by a user <b>%s</b>.
AgendaUrlOptions4=<b>logint=%s</b> to restrict output to actions assigned to user <b>%s</b>.
AgendaUrlOptionsNotAdmin=<b>logina=!%s</b> to restrict output to actions not owned by user <b>%s</b>.
AgendaUrlOptions4=<b>logint=%s</b> to restrict output to actions assigned to user <b>%s</b> (owner and others).
AgendaUrlOptionsProject=<b>project=PROJECT_ID</b> to restrict output to actions associated to project <b>PROJECT_ID</b>.
AgendaShowBirthdayEvents=Show birthdays of contacts
AgendaHideBirthdayEvents=Hide birthdays of contacts

View File

@ -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

View File

@ -172,7 +172,7 @@ while ($i < min($num,$limit))
$opensurvey_static->id=$obj->id_sondage;
$opensurvey_static->status=$obj->status;
print '<tr>';
print '<td>';
print '<a href="'.dol_buildpath('/opensurvey/card.php',1).'?id='.$obj->id_sondage.'">'.img_picto('','object_opensurvey').' '.$obj->id_sondage.'</a>';
@ -198,19 +198,27 @@ while ($i < min($num,$limit))
print '</td>';
print'<td align="right">'.$nbuser.'</td>'."\n";
print '<td align="center">'.dol_print_date($db->jdate($obj->date_fin),'day');
if ($db->jdate($obj->date_fin) < time()) { print ' ('.$langs->trans("Expired").')'; }
print '</td>';
print'<td align="center">'.$opensurvey_static->getLibStatut(5).'</td>'."\n";
print'<td align="center"></td>'."\n";
print '</tr>'."\n";
$i++;
}
// If no record found
if ($num == 0)
{
$colspan=8;
//foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
}
print '</table>'."\n";
print '</div>';
print '</form>';

View File

@ -54,9 +54,11 @@ if ($action == 'edit_updater') {
}
}
/*
* Actions
*/
if (!empty($action) && empty($cancel)) {
//Global variable actions
if ($action == 'create_variable' || $action == 'edit_variable') {

View File

@ -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;
}

View File

@ -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
}

View File

@ -311,7 +311,9 @@ if ($ret)
}
else
{
print '<tr><td class="opacitymedium">'.$langs->trans('NoResourceInDatabase').'</td></tr>';
$colspan=1;
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
}
print '</table>';