Merge remote-tracking branch 'upstream/develop' into camelCaps
This commit is contained in:
commit
d8bf4a0ecf
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||||
@ -990,7 +990,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
if (! empty($conf->global->MAIN_MULTILANGS))
|
if (! empty($conf->global->MAIN_MULTILANGS))
|
||||||
{
|
{
|
||||||
$selectedlang = $langs->defaultlang;
|
$selectedlang = GETPOSTISSET('langcode','aZ09')?GETPOST('langcode','aZ09'):$langs->defaultlang;
|
||||||
if ($context == 'edit') $selectedlang = $obj->{$fieldlist[$field]};
|
if ($context == 'edit') $selectedlang = $obj->{$fieldlist[$field]};
|
||||||
print $formadmin->select_language($selectedlang, 'langcode', 0, null, 1, 0, 0, 'maxwidth150');
|
print $formadmin->select_language($selectedlang, 'langcode', 0, null, 1, 0, 0, 'maxwidth150');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -99,6 +99,7 @@ class DolibarrApi
|
|||||||
|
|
||||||
// Remove $db object property for object
|
// Remove $db object property for object
|
||||||
unset($object->db);
|
unset($object->db);
|
||||||
|
unset($object->isextrafieldmanaged);
|
||||||
unset($object->ismultientitymanaged);
|
unset($object->ismultientitymanaged);
|
||||||
unset($object->restrictiononfksoc);
|
unset($object->restrictiononfksoc);
|
||||||
|
|
||||||
|
|||||||
@ -1513,7 +1513,7 @@ else
|
|||||||
//var_dump(dol_print_date($object->date_when+60, 'dayhour').' - '.dol_print_date($now, 'dayhour'));
|
//var_dump(dol_print_date($object->date_when+60, 'dayhour').' - '.dol_print_date($now, 'dayhour'));
|
||||||
if (! $object->isMaxNbGenReached())
|
if (! $object->isMaxNbGenReached())
|
||||||
{
|
{
|
||||||
if ($action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) print img_warning($langs->trans("Late"));
|
if (! $object->suspended && $action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) print img_warning($langs->trans("Late"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -607,7 +607,7 @@ if ($resql)
|
|||||||
print ($objp->frequency ? ($invoicerectmp->isMaxNbGenReached()?'<strike>':'').dol_print_date($db->jdate($objp->date_when),'day').($invoicerectmp->isMaxNbGenReached()?'</strike>':'') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>');
|
print ($objp->frequency ? ($invoicerectmp->isMaxNbGenReached()?'<strike>':'').dol_print_date($db->jdate($objp->date_when),'day').($invoicerectmp->isMaxNbGenReached()?'</strike>':'') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>');
|
||||||
if (! $invoicerectmp->isMaxNbGenReached())
|
if (! $invoicerectmp->isMaxNbGenReached())
|
||||||
{
|
{
|
||||||
if ($objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) print img_warning($langs->trans("Late"));
|
if (! $objp->suspended && $objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) print img_warning($langs->trans("Late"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1357,7 +1357,7 @@ class Form
|
|||||||
* @param string $moreclass Add more class to class style
|
* @param string $moreclass Add more class to class style
|
||||||
* @param bool $options_only Return options only (for ajax treatment)
|
* @param bool $options_only Return options only (for ajax treatment)
|
||||||
* @param integer $showsoc Add company into label
|
* @param integer $showsoc Add company into label
|
||||||
* @param int $forcecombo Force to use combo box
|
* @param int $forcecombo Force to use combo box (so no ajax beautify effect)
|
||||||
* @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
|
* @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
|
||||||
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
|
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
|
||||||
* @param string $htmlid Html id to use instead of htmlname
|
* @param string $htmlid Html id to use instead of htmlname
|
||||||
@ -1566,7 +1566,7 @@ class Form
|
|||||||
else $sql.= " WHERE u.entity IS NOT NULL";
|
else $sql.= " WHERE u.entity IS NOT NULL";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
|
if (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
|
||||||
{
|
{
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||||
@ -3716,7 +3716,7 @@ class Form
|
|||||||
|
|
||||||
// Now add questions
|
// Now add questions
|
||||||
$more.='<table class="paddingtopbottomonly" width="100%">'."\n";
|
$more.='<table class="paddingtopbottomonly" width="100%">'."\n";
|
||||||
$more.='<tr><td colspan="3">'.(! empty($formquestion['text'])?$formquestion['text']:'').'</td></tr>'."\n";
|
if (! empty($formquestion['text'])) $more.='<tr><td colspan="2">'.$formquestion['text'].'</td></tr>'."\n";
|
||||||
foreach ($formquestion as $key => $input)
|
foreach ($formquestion as $key => $input)
|
||||||
{
|
{
|
||||||
if (is_array($input) && ! empty($input))
|
if (is_array($input) && ! empty($input))
|
||||||
@ -3727,29 +3727,28 @@ class Form
|
|||||||
|
|
||||||
if ($input['type'] == 'text')
|
if ($input['type'] == 'text')
|
||||||
{
|
{
|
||||||
$more.='<tr><td>'.$input['label'].'</td><td colspan="2" align="left"><input type="text" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'"'.$moreattr.' /></td></tr>'."\n";
|
$more.='<tr><td'.(empty($input['tdclass'])?'':(' class="'.$input['tdclass'].'"')).'>'.$input['label'].'</td><td align="left"><input type="text" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'"'.$moreattr.' /></td></tr>'."\n";
|
||||||
}
|
}
|
||||||
else if ($input['type'] == 'password')
|
else if ($input['type'] == 'password')
|
||||||
{
|
{
|
||||||
$more.='<tr><td>'.$input['label'].'</td><td colspan="2" align="left"><input type="password" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'"'.$moreattr.' /></td></tr>'."\n";
|
$more.='<tr><td'.(empty($input['tdclass'])?'':(' class="'.$input['tdclass'].'"')).'>'.$input['label'].'</td><td align="left"><input type="password" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'"'.$moreattr.' /></td></tr>'."\n";
|
||||||
}
|
}
|
||||||
else if ($input['type'] == 'select')
|
else if ($input['type'] == 'select')
|
||||||
{
|
{
|
||||||
$more.='<tr><td>';
|
$more.='<tr><td'.(empty($input['tdclass'])?'':(' class="'.$input['tdclass'].'"')).'>';
|
||||||
if (! empty($input['label'])) $more.=$input['label'].'</td><td valign="top" colspan="2" align="left">';
|
if (! empty($input['label'])) $more.=$input['label'].'</td><td class="tdtop" align="left">';
|
||||||
$more.=$this->selectarray($input['name'],$input['values'],$input['default'],1,0,0,$moreattr,0,0,0,'',$morecss);
|
$more.=$this->selectarray($input['name'],$input['values'],$input['default'],1,0,0,$moreattr,0,0,0,'',$morecss);
|
||||||
$more.='</td></tr>'."\n";
|
$more.='</td></tr>'."\n";
|
||||||
}
|
}
|
||||||
else if ($input['type'] == 'checkbox')
|
else if ($input['type'] == 'checkbox')
|
||||||
{
|
{
|
||||||
$more.='<tr>';
|
$more.='<tr>';
|
||||||
$more.='<td>'.$input['label'].' </td><td align="left">';
|
$more.='<td'.(empty($input['tdclass'])?'':(' class="'.$input['tdclass'].'"')).'>'.$input['label'].' </td><td align="left">';
|
||||||
$more.='<input type="checkbox" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'"'.$moreattr;
|
$more.='<input type="checkbox" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'"'.$moreattr;
|
||||||
if (! is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0') $more.=' checked';
|
if (! is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0') $more.=' checked';
|
||||||
if (is_bool($input['value']) && $input['value']) $more.=' checked';
|
if (is_bool($input['value']) && $input['value']) $more.=' checked';
|
||||||
if (isset($input['disabled'])) $more.=' disabled';
|
if (isset($input['disabled'])) $more.=' disabled';
|
||||||
$more.=' /></td>';
|
$more.=' /></td>';
|
||||||
$more.='<td align="left"> </td>';
|
|
||||||
$more.='</tr>'."\n";
|
$more.='</tr>'."\n";
|
||||||
}
|
}
|
||||||
else if ($input['type'] == 'radio')
|
else if ($input['type'] == 'radio')
|
||||||
@ -3758,12 +3757,11 @@ class Form
|
|||||||
foreach($input['values'] as $selkey => $selval)
|
foreach($input['values'] as $selkey => $selval)
|
||||||
{
|
{
|
||||||
$more.='<tr>';
|
$more.='<tr>';
|
||||||
if ($i==0) $more.='<td class="tdtop">'.$input['label'].'</td>';
|
if ($i==0) $more.='<td'.(empty($input['tdclass'])?' class="tdtop"':(' class="tdtop '.$input['tdclass'].'"')).'>'.$input['label'].'</td>';
|
||||||
else $more.='<td> </td>';
|
else $more.='<td'.(empty($input['tdclass'])?'':(' class="'.$input['tdclass'].'"')).'> </td>';
|
||||||
$more.='<td width="20"><input type="radio" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'" value="'.$selkey.'"'.$moreattr;
|
$more.='<td><input type="radio" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'" value="'.$selkey.'"'.$moreattr;
|
||||||
if ($input['disabled']) $more.=' disabled';
|
if ($input['disabled']) $more.=' disabled';
|
||||||
$more.=' /></td>';
|
$more.=' /> ';
|
||||||
$more.='<td align="left">';
|
|
||||||
$more.=$selval;
|
$more.=$selval;
|
||||||
$more.='</td></tr>'."\n";
|
$more.='</td></tr>'."\n";
|
||||||
$i++;
|
$i++;
|
||||||
@ -3771,8 +3769,8 @@ class Form
|
|||||||
}
|
}
|
||||||
else if ($input['type'] == 'date')
|
else if ($input['type'] == 'date')
|
||||||
{
|
{
|
||||||
$more.='<tr><td>'.$input['label'].'</td>';
|
$more.='<tr><td'.(empty($input['tdclass'])?'':(' class="'.$input['tdclass'].'"')).'>'.$input['label'].'</td>';
|
||||||
$more.='<td colspan="2" align="left">';
|
$more.='<td align="left">';
|
||||||
$more.=$this->select_date($input['value'],$input['name'],0,0,0,'',1,0,1);
|
$more.=$this->select_date($input['value'],$input['name'],0,0,0,'',1,0,1);
|
||||||
$more.='</td></tr>'."\n";
|
$more.='</td></tr>'."\n";
|
||||||
$formquestion[] = array('name'=>$input['name'].'day');
|
$formquestion[] = array('name'=>$input['name'].'day');
|
||||||
@ -3783,15 +3781,15 @@ class Form
|
|||||||
}
|
}
|
||||||
else if ($input['type'] == 'other')
|
else if ($input['type'] == 'other')
|
||||||
{
|
{
|
||||||
$more.='<tr><td>';
|
$more.='<tr><td'.(empty($input['tdclass'])?'':(' class="'.$input['tdclass'].'"')).'>';
|
||||||
if (! empty($input['label'])) $more.=$input['label'].'</td><td colspan="2" align="left">';
|
if (! empty($input['label'])) $more.=$input['label'].'</td><td align="left">';
|
||||||
$more.=$input['value'];
|
$more.=$input['value'];
|
||||||
$more.='</td></tr>'."\n";
|
$more.='</td></tr>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($input['type'] == 'onecolumn')
|
else if ($input['type'] == 'onecolumn')
|
||||||
{
|
{
|
||||||
$more.='<tr><td colspan="3" align="left">';
|
$more.='<tr><td colspan="2" align="left">';
|
||||||
$more.=$input['value'];
|
$more.=$input['value'];
|
||||||
$more.='</td></tr>'."\n";
|
$more.='</td></tr>'."\n";
|
||||||
}
|
}
|
||||||
@ -3845,14 +3843,14 @@ class Form
|
|||||||
$( "#'.$dialogconfirm.'" ).dialog(
|
$( "#'.$dialogconfirm.'" ).dialog(
|
||||||
{
|
{
|
||||||
autoOpen: '.($autoOpen ? "true" : "false").',';
|
autoOpen: '.($autoOpen ? "true" : "false").',';
|
||||||
if ($newselectedchoice == 'no')
|
if ($newselectedchoice == 'no')
|
||||||
{
|
{
|
||||||
$formconfirm.='
|
$formconfirm.='
|
||||||
open: function() {
|
open: function() {
|
||||||
$(this).parent().find("button.ui-button:eq(2)").focus();
|
$(this).parent().find("button.ui-button:eq(2)").focus();
|
||||||
},';
|
},';
|
||||||
}
|
}
|
||||||
$formconfirm.='
|
$formconfirm.='
|
||||||
resizable: false,
|
resizable: false,
|
||||||
height: "'.$height.'",
|
height: "'.$height.'",
|
||||||
width: "'.$width.'",
|
width: "'.$width.'",
|
||||||
|
|||||||
@ -56,10 +56,11 @@ class FormAdmin
|
|||||||
* @param int $disabled Disable edit of select
|
* @param int $disabled Disable edit of select
|
||||||
* @param string $morecss Add more css styles
|
* @param string $morecss Add more css styles
|
||||||
* @param int $showcode Add language code into label
|
* @param int $showcode Add language code into label
|
||||||
|
* @param int $forcecombo Force to use combo box (so no ajax beautify effect)
|
||||||
* @return string Return HTML select string with list of languages
|
* @return string Return HTML select string with list of languages
|
||||||
*/
|
*/
|
||||||
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||||
function select_language($selected='', $htmlname='lang_id', $showauto=0, $filter=null, $showempty='', $showwarning=0, $disabled=0, $morecss='', $showcode=0)
|
function select_language($selected='', $htmlname='lang_id', $showauto=0, $filter=null, $showempty='', $showwarning=0, $disabled=0, $morecss='', $showcode=0, $forcecombo=0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
@ -110,8 +111,11 @@ class FormAdmin
|
|||||||
$out.= '</select>';
|
$out.= '</select>';
|
||||||
|
|
||||||
// Make select dynamic
|
// Make select dynamic
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
if (! $forcecombo)
|
||||||
$out.= ajax_combobox($htmlname);
|
{
|
||||||
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||||
|
$out.= ajax_combobox($htmlname);
|
||||||
|
}
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -292,7 +292,7 @@ class FormMail extends Form
|
|||||||
|
|
||||||
$disablebademails=1;
|
$disablebademails=1;
|
||||||
|
|
||||||
// Define output language
|
// Define output language
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang = '';
|
$newlang = '';
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $this->param['langsmodels'];
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $this->param['langsmodels'];
|
||||||
@ -1088,7 +1088,7 @@ class FormMail extends Form
|
|||||||
$sql.= " AND (private = 0 OR fk_user = ".$user->id.")"; // Get all public or private owned
|
$sql.= " AND (private = 0 OR fk_user = ".$user->id.")"; // Get all public or private owned
|
||||||
if ($active >= 0) $sql.=" AND active = ".$active;
|
if ($active >= 0) $sql.=" AND active = ".$active;
|
||||||
if ($label) $sql.=" AND label ='".$db->escape($label)."'";
|
if ($label) $sql.=" AND label ='".$db->escape($label)."'";
|
||||||
if (is_object($outputlangs)) $sql.= " AND (lang = '".$db->escape($outputlangs->defaultlang)."' OR lang IS NULL OR lang = '')";
|
if (! ($id > 0) && is_object($outputlangs)) $sql.= " AND (lang = '".$db->escape($outputlangs->defaultlang)."' OR lang IS NULL OR lang = '')";
|
||||||
if ($id > 0) $sql.= " AND rowid=".$id;
|
if ($id > 0) $sql.= " AND rowid=".$id;
|
||||||
if ($id == -1) $sql.= " AND position=0";
|
if ($id == -1) $sql.= " AND position=0";
|
||||||
if (is_object($outputlangs)) $sql.= $db->order("position,lang,label","ASC,DESC,ASC"); // We want line with lang set first, then with lang null or ''
|
if (is_object($outputlangs)) $sql.= $db->order("position,lang,label","ASC,DESC,ASC"); // We want line with lang set first, then with lang null or ''
|
||||||
|
|||||||
@ -331,7 +331,7 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage=0, $
|
|||||||
print '<font style="font-size: 10px;"><br><hr>'."\n";
|
print '<font style="font-size: 10px;"><br><hr>'."\n";
|
||||||
print $fromcompany->name.'<br>';
|
print $fromcompany->name.'<br>';
|
||||||
print $line1;
|
print $line1;
|
||||||
if (strlen($line1+$line2) > 50) print '<br>';
|
if (strlen($line1.$line2) > 50) print '<br>';
|
||||||
else print ' - ';
|
else print ' - ';
|
||||||
print $line2;
|
print $line2;
|
||||||
print '</font></div>'."\n";
|
print '</font></div>'."\n";
|
||||||
|
|||||||
@ -104,9 +104,24 @@ function project_prepare_head($object)
|
|||||||
$head[$h][2] = 'tasks';
|
$head[$h][2] = 'tasks';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
|
$nbTimeSpent=0;
|
||||||
|
$sql = "SELECT t.rowid";
|
||||||
|
//$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u";
|
||||||
|
//$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid";
|
||||||
|
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt";
|
||||||
|
$sql .= " WHERE t.fk_task = pt.rowid";
|
||||||
|
$sql .= " AND pt.fk_projet =".$object->id;
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
if ($obj) $nbTimeSpent=1;
|
||||||
|
}
|
||||||
|
else dol_print_error($db);
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&projectid='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&projectid='.$object->id;
|
||||||
$head[$h][1] = $langs->trans("TimeSpent");
|
$head[$h][1] = $langs->trans("TimeSpent");
|
||||||
//if ($nbTasks > 0) $head[$h][1].= ' <span class="badge">'.($nbTasks).'</span>';
|
if ($nbTimeSpent > 0) $head[$h][1].= ' <span class="badge">...</span>';
|
||||||
$head[$h][2] = 'timespent';
|
$head[$h][2] = 'timespent';
|
||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
@ -165,9 +180,10 @@ function task_prepare_head($object)
|
|||||||
// Is there timespent ?
|
// Is there timespent ?
|
||||||
$nbTimeSpent=0;
|
$nbTimeSpent=0;
|
||||||
$sql = "SELECT t.rowid";
|
$sql = "SELECT t.rowid";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u";
|
//$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u";
|
||||||
$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid";
|
//$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid";
|
||||||
$sql .= " AND t.fk_task =".$object->id;
|
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
|
||||||
|
$sql .= " WHERE t.fk_task =".$object->id;
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -349,12 +349,12 @@ class modAdherent extends DolibarrModules
|
|||||||
// Cronjobs
|
// Cronjobs
|
||||||
$this->cronjobs = array(
|
$this->cronjobs = array(
|
||||||
0=>array(
|
0=>array(
|
||||||
'label'=>'SendReminderForExpiredSubscription',
|
'label'=>'SendReminderForExpiredSubscriptionTitle',
|
||||||
'jobtype'=>'method', 'class'=>'adherents/class/adherent.class.php',
|
'jobtype'=>'method', 'class'=>'adherents/class/adherent.class.php',
|
||||||
'objectname'=>'Adherent',
|
'objectname'=>'Adherent',
|
||||||
'method'=>'sendReminderForExpiredSubscription',
|
'method'=>'sendReminderForExpiredSubscription',
|
||||||
'parameters'=>'10',
|
'parameters'=>'10',
|
||||||
'comment'=>'sendReminderForExpiredSubscription',
|
'comment'=>'SendReminderForExpiredSubscription',
|
||||||
'frequency'=>1,
|
'frequency'=>1,
|
||||||
'unitfrequency'=> 3600 * 24,
|
'unitfrequency'=> 3600 * 24,
|
||||||
'priority'=>50,
|
'priority'=>50,
|
||||||
|
|||||||
@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT."/core/class/html.formcron.class.php";
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/cron.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/cron.lib.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array('admin', 'cron'));
|
$langs->loadLangs(array('admin', 'cron', 'members'));
|
||||||
|
|
||||||
if (!$user->rights->cron->create) accessforbidden();
|
if (!$user->rights->cron->create) accessforbidden();
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/cron/class/cronjob.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/cron.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/cron.lib.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("admin","cron","bills"));
|
$langs->loadLangs(array("admin","cron","bills","members"));
|
||||||
|
|
||||||
if (!$user->rights->cron->read) accessforbidden();
|
if (!$user->rights->cron->read) accessforbidden();
|
||||||
|
|
||||||
|
|||||||
@ -117,27 +117,29 @@ class MyModuleApi extends DolibarrApi
|
|||||||
|
|
||||||
$socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : '';
|
$socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : '';
|
||||||
|
|
||||||
|
$restictonsocid = 0; // Set to 1 if there is a field socid in table of object
|
||||||
|
|
||||||
// If the internal user must only see his customers, force searching by him
|
// If the internal user must only see his customers, force searching by him
|
||||||
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
|
if ($restictonsocid && ! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
|
||||||
|
|
||||||
$sql = "SELECT s.rowid";
|
$sql = "SELECT t.rowid";
|
||||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
if ($restictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."myobject as s";
|
$sql.= " FROM ".MAIN_DB_PREFIX."myobject_mytable as t";
|
||||||
|
|
||||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
if ($restictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st";
|
$sql.= " WHERE 1 = 1";
|
||||||
$sql.= " WHERE s.fk_stcomm = st.id";
|
|
||||||
|
|
||||||
// Example of use $mode
|
// Example of use $mode
|
||||||
//if ($mode == 1) $sql.= " AND s.client IN (1, 3)";
|
//if ($mode == 1) $sql.= " AND s.client IN (1, 3)";
|
||||||
//if ($mode == 2) $sql.= " AND s.client IN (2, 3)";
|
//if ($mode == 2) $sql.= " AND s.client IN (2, 3)";
|
||||||
|
|
||||||
$sql.= ' AND s.entity IN ('.getEntity('myobject').')';
|
$tmpobject = new MyObject($db);
|
||||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND s.fk_soc = sc.fk_soc";
|
if ($tmpobject->ismultientitymanaged) $sql.= ' AND t.entity IN ('.getEntity('myobject').')';
|
||||||
if ($socid) $sql.= " AND s.fk_soc = ".$socid;
|
if ($restictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
|
||||||
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
if ($restictonsocid && $socid) $sql.= " AND t.fk_soc = ".$socid;
|
||||||
|
if ($restictonsocid && $search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||||
// Insert sale filter
|
// Insert sale filter
|
||||||
if ($search_sale > 0)
|
if ($restictonsocid && $search_sale > 0)
|
||||||
{
|
{
|
||||||
$sql .= " AND sc.fk_user = ".$search_sale;
|
$sql .= " AND sc.fk_user = ".$search_sale;
|
||||||
}
|
}
|
||||||
@ -171,7 +173,7 @@ class MyModuleApi extends DolibarrApi
|
|||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
$myobject_static = new MyObject($db);
|
$myobject_static = new MyObject($db);
|
||||||
if($myobject_static->fetch($obj->rowid)) {
|
if($myobject_static->fetch($obj->rowid)) {
|
||||||
$obj_ret[] = parent::_cleanObjectDatas($myobject_static);
|
$obj_ret[] = $this->_cleanObjectDatas($myobject_static);
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -254,7 +256,7 @@ class MyModuleApi extends DolibarrApi
|
|||||||
*/
|
*/
|
||||||
function delete($id)
|
function delete($id)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->myobject->supprimer) {
|
if(! DolibarrApiAccess::$user->rights->myobject->delete) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
$result = $this->myobject->fetch($id);
|
$result = $this->myobject->fetch($id);
|
||||||
@ -266,7 +268,7 @@ class MyModuleApi extends DolibarrApi
|
|||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !$this->myobject->delete($id))
|
if( !$this->myobject->delete(DolibarrApiAccess::$user, 0))
|
||||||
{
|
{
|
||||||
throw new RestException(500);
|
throw new RestException(500);
|
||||||
}
|
}
|
||||||
@ -280,6 +282,27 @@ class MyModuleApi extends DolibarrApi
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean sensible object datas
|
||||||
|
*
|
||||||
|
* @param object $object Object to clean
|
||||||
|
* @return array Array of cleaned object properties
|
||||||
|
*/
|
||||||
|
function _cleanObjectDatas($object)
|
||||||
|
{
|
||||||
|
$object = parent::_cleanObjectDatas($object);
|
||||||
|
|
||||||
|
/*unset($object->note);
|
||||||
|
unset($object->address);
|
||||||
|
unset($object->barcode_type);
|
||||||
|
unset($object->barcode_type_code);
|
||||||
|
unset($object->barcode_type_label);
|
||||||
|
unset($object->barcode_type_coder);*/
|
||||||
|
|
||||||
|
return $object;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate fields before create or update object
|
* Validate fields before create or update object
|
||||||
*
|
*
|
||||||
|
|||||||
@ -66,6 +66,7 @@ class MyObject extends CommonObject
|
|||||||
* 'position' is the sort order of field.
|
* 'position' is the sort order of field.
|
||||||
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
|
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
|
||||||
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
||||||
|
* 'css' is the CSS style to use on field. For example: 'maxwidth200'
|
||||||
* 'help' is a string visible as a tooltip on field
|
* 'help' is a string visible as a tooltip on field
|
||||||
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
|
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
|
||||||
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
|
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
|
||||||
@ -285,7 +286,7 @@ class MyObject extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
|
function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
|
||||||
{
|
{
|
||||||
global $db, $conf, $langs, $hoomanager;
|
global $db, $conf, $langs, $hookmanager;
|
||||||
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
||||||
global $menumanager;
|
global $menumanager;
|
||||||
|
|
||||||
|
|||||||
@ -122,7 +122,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
$permissiontoadd = $user->rights->mymodule->write;
|
$permissiontoadd = $user->rights->mymodule->write;
|
||||||
$permissiontodelete = $user->rights->mymodule->delete;
|
$permissiontodelete = $user->rights->mymodule->delete;
|
||||||
if (empty($backtopage)) $backtopage = dol_buildpath('/mymodule/myobject_card.php',1).'?id=__ID__';
|
if (empty($backtopage)) $backtopage = dol_buildpath('/mymodule/myobject_card.php',1).'?id='.($id > 0 ? $id : '__ID__');
|
||||||
$backurlforlist = dol_buildpath('/mymodule/myobject_list.php',1);
|
$backurlforlist = dol_buildpath('/mymodule/myobject_list.php',1);
|
||||||
$triggermodname = 'MYMODULE_MYOBJECT_MODIFY'; // Name of trigger action code to execute when we modify record
|
$triggermodname = 'MYMODULE_MYOBJECT_MODIFY'; // Name of trigger action code to execute when we modify record
|
||||||
|
|
||||||
|
|||||||
@ -64,6 +64,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$ret = $object->fetch($id,$ref); // If we create project, ref may be defined into POST but record does not yet exists into database
|
$ret = $object->fetch($id,$ref); // If we create project, ref may be defined into POST but record does not yet exists into database
|
||||||
if ($ret > 0) {
|
if ($ret > 0) {
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
$id=$object->id;
|
$id=$object->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -454,18 +454,12 @@ class Project extends CommonObject
|
|||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
$this->fetch_optionals();
|
$this->fetch_optionals();
|
||||||
|
|
||||||
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT))
|
|
||||||
{
|
|
||||||
$this->fetchComments();
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|
||||||
if ($num_rows) return 1;
|
return 0;
|
||||||
else return 0;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -655,9 +649,8 @@ class Project extends CommonObject
|
|||||||
$this->getLinesArray($user);
|
$this->getLinesArray($user);
|
||||||
|
|
||||||
// Delete tasks
|
// Delete tasks
|
||||||
foreach($this->lines as &$task) {
|
$ret = $this->deleteTasks($user);
|
||||||
$task->delete($user);
|
if ($ret < 0) $error++;
|
||||||
}
|
|
||||||
|
|
||||||
// Delete project
|
// Delete project
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -733,6 +726,40 @@ class Project extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete tasks with no children first, then task with children recursively
|
||||||
|
*
|
||||||
|
* @param User $user User
|
||||||
|
* @return int <0 if KO, 1 if OK
|
||||||
|
*/
|
||||||
|
function deleteTasks($user)
|
||||||
|
{
|
||||||
|
$countTasks = count($this->lines);
|
||||||
|
$deleted = false;
|
||||||
|
if ($countTasks)
|
||||||
|
{
|
||||||
|
foreach($this->lines as $task)
|
||||||
|
{
|
||||||
|
if ($task->hasChildren() <= 0) { // If there is no children (or error to detect them)
|
||||||
|
$deleted = true;
|
||||||
|
$ret = $task->delete($user);
|
||||||
|
if ($ret <= 0)
|
||||||
|
{
|
||||||
|
$this->errors[] = $this->db->lasterror();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->getLinesArray($user);
|
||||||
|
if ($deleted && count($this->lines) < $countTasks)
|
||||||
|
{
|
||||||
|
if (count($this->lines)) $this->deleteTasks($this->lines);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate a project
|
* Validate a project
|
||||||
|
|||||||
@ -194,7 +194,7 @@ class Task extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function fetch($id, $ref='', $loadparentdata=0)
|
function fetch($id, $ref='', $loadparentdata=0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs, $conf;
|
||||||
|
|
||||||
$sql = "SELECT";
|
$sql = "SELECT";
|
||||||
$sql.= " t.rowid,";
|
$sql.= " t.rowid,";
|
||||||
@ -267,7 +267,6 @@ class Task extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Retreive all extrafield
|
// Retreive all extrafield
|
||||||
// fetch optionals attributes and labels
|
|
||||||
$this->fetch_optionals();
|
$this->fetch_optionals();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -67,6 +67,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$ret = $object->fetch($id,$ref); // If we create project, ref may be defined into POST but record does not yet exists into database
|
$ret = $object->fetch($id,$ref); // If we create project, ref may be defined into POST but record does not yet exists into database
|
||||||
if ($ret > 0) {
|
if ($ret > 0) {
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
$id=$object->id;
|
$id=$object->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,6 +43,7 @@ $mine = GETPOST('mode')=='mine' ? 1 : 0;
|
|||||||
$object = new Project($db);
|
$object = new Project($db);
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid=0;
|
$socid=0;
|
||||||
@ -140,6 +141,7 @@ $userstatic=new User($db);
|
|||||||
|
|
||||||
if ($id > 0 || ! empty($ref))
|
if ($id > 0 || ! empty($ref))
|
||||||
{
|
{
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
// To verify role of users
|
// To verify role of users
|
||||||
//$userAccess = $object->restrictedProjectArea($user,'read');
|
//$userAccess = $object->restrictedProjectArea($user,'read');
|
||||||
$userWrite = $object->restrictedProjectArea($user,'write');
|
$userWrite = $object->restrictedProjectArea($user,'write');
|
||||||
|
|||||||
@ -48,6 +48,7 @@ $result=restrictedArea($user,'projet',$id,'projet&project');
|
|||||||
$object = new Project($db);
|
$object = new Project($db);
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
|
|
||||||
if ($id > 0 || ! empty($ref)) {
|
if ($id > 0 || ! empty($ref)) {
|
||||||
$upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
$upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||||
|
|||||||
@ -97,6 +97,7 @@ $projectid=$id; // For backward compatibility
|
|||||||
$object = new Project($db);
|
$object = new Project($db);
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid=$object->socid;
|
$socid=$object->socid;
|
||||||
|
|||||||
@ -42,6 +42,7 @@ $mine = ($mode == 'mine' ? 1 : 0);
|
|||||||
$object = new Project($db);
|
$object = new Project($db);
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid=0;
|
$socid=0;
|
||||||
|
|||||||
@ -98,6 +98,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
{
|
{
|
||||||
$object->fetch($id, $ref);
|
$object->fetch($id, $ref);
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
$object->info($object->id);
|
$object->info($object->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -39,6 +39,7 @@ $mine = $_REQUEST['mode']=='mine' ? 1 : 0;
|
|||||||
$object = new Project($db);
|
$object = new Project($db);
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid=0;
|
$socid=0;
|
||||||
|
|||||||
@ -64,6 +64,7 @@ $extrafields_project = new ExtraFields($db);
|
|||||||
$extrafields_task = new ExtraFields($db);
|
$extrafields_task = new ExtraFields($db);
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
|
|
||||||
if ($id > 0 || ! empty($ref))
|
if ($id > 0 || ! empty($ref))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -106,6 +106,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
$result=$projectstatic->fetch($object->fk_project);
|
$result=$projectstatic->fetch($object->fk_project);
|
||||||
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) $projectstatic->fetchComments();
|
||||||
|
|
||||||
$object->project = clone $projectstatic;
|
$object->project = clone $projectstatic;
|
||||||
|
|
||||||
|
|||||||
@ -173,9 +173,11 @@ if ($id > 0 || ! empty($ref))
|
|||||||
{
|
{
|
||||||
if ($object->fetch($id, $ref) > 0)
|
if ($object->fetch($id, $ref) > 0)
|
||||||
{
|
{
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
$id = $object->id; // So when doing a search from ref, id is also set correctly.
|
$id = $object->id; // So when doing a search from ref, id is also set correctly.
|
||||||
|
|
||||||
$result=$projectstatic->fetch($object->fk_project);
|
$result=$projectstatic->fetch($object->fk_project);
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) $projectstatic->fetchComments();
|
||||||
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
||||||
|
|
||||||
$object->project = clone $projectstatic;
|
$object->project = clone $projectstatic;
|
||||||
|
|||||||
@ -91,7 +91,9 @@ if ($id > 0 || ! empty($ref))
|
|||||||
{
|
{
|
||||||
if ($object->fetch($id,$ref) > 0)
|
if ($object->fetch($id,$ref) > 0)
|
||||||
{
|
{
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
$projectstatic->fetch($object->fk_project);
|
$projectstatic->fetch($object->fk_project);
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) $projectstatic->fetchComments();
|
||||||
|
|
||||||
if (! empty($projectstatic->socid)) {
|
if (! empty($projectstatic->socid)) {
|
||||||
$projectstatic->fetch_thirdparty();
|
$projectstatic->fetch_thirdparty();
|
||||||
|
|||||||
@ -51,7 +51,9 @@ if ($id > 0 || ! empty($ref))
|
|||||||
{
|
{
|
||||||
if ($object->fetch($id,$ref) > 0)
|
if ($object->fetch($id,$ref) > 0)
|
||||||
{
|
{
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
$projectstatic->fetch($object->fk_project);
|
$projectstatic->fetch($object->fk_project);
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) $projectstatic->fetchComments();
|
||||||
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
||||||
|
|
||||||
$object->project = clone $projectstatic;
|
$object->project = clone $projectstatic;
|
||||||
|
|||||||
@ -211,8 +211,10 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if ($object->fetch($id,$ref) > 0)
|
if ($object->fetch($id,$ref) > 0)
|
||||||
{
|
{
|
||||||
$res=$object->fetch_optionals();
|
$res=$object->fetch_optionals();
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
|
|
||||||
$result=$projectstatic->fetch($object->fk_project);
|
$result=$projectstatic->fetch($object->fk_project);
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) $projectstatic->fetchComments();
|
||||||
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
||||||
|
|
||||||
$object->project = clone $projectstatic;
|
$object->project = clone $projectstatic;
|
||||||
|
|||||||
@ -71,7 +71,7 @@ $offset = $limit * $page;
|
|||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if (! $sortfield) $sortfield='t.task_date,t.task_datehour,t.rowid';
|
if (! $sortfield) $sortfield='t.task_date,t.task_datehour,t.rowid';
|
||||||
if (! $sortorder) $sortorder='DESC';
|
if (! $sortorder) $sortorder='DESC,DESC,DESC';
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
//$object = new TaskTime($db);
|
//$object = new TaskTime($db);
|
||||||
@ -158,7 +158,7 @@ if ($action == 'addtimespent' && $user->rights->projet->lire)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$object->timespent_note = $_POST["timespent_note"];
|
$object->timespent_note = $_POST["timespent_note"];
|
||||||
$object->progress = GETPOST('progress', 'int');
|
if (GETPOST('progress', 'int') > 0) $object->progress = GETPOST('progress', 'int'); // If progress is -1 (not defined), we do not change value
|
||||||
$object->timespent_duration = $_POST["timespent_durationhour"]*60*60; // We store duration in seconds
|
$object->timespent_duration = $_POST["timespent_durationhour"]*60*60; // We store duration in seconds
|
||||||
$object->timespent_duration+= ($_POST["timespent_durationmin"]?$_POST["timespent_durationmin"]:0)*60; // We store duration in seconds
|
$object->timespent_duration+= ($_POST["timespent_durationmin"]?$_POST["timespent_durationmin"]:0)*60; // We store duration in seconds
|
||||||
if (GETPOST("timehour") != '' && GETPOST("timehour") >= 0) // If hour was entered
|
if (GETPOST("timehour") != '' && GETPOST("timehour") >= 0) // If hour was entered
|
||||||
@ -307,7 +307,9 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
}
|
}
|
||||||
elseif ($object->fetch($id, $ref) >= 0)
|
elseif ($object->fetch($id, $ref) >= 0)
|
||||||
{
|
{
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
|
||||||
$result=$projectstatic->fetch($object->fk_project);
|
$result=$projectstatic->fetch($object->fk_project);
|
||||||
|
if(! empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) $projectstatic->fetchComments();
|
||||||
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
||||||
$res=$projectstatic->fetch_optionals();
|
$res=$projectstatic->fetch_optionals();
|
||||||
|
|
||||||
@ -422,7 +424,16 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
{
|
{
|
||||||
if ($projectstatic->public || $userWrite > 0)
|
if ($projectstatic->public || $userWrite > 0)
|
||||||
{
|
{
|
||||||
$linktocreatetime = '<a class="butActionNew" href="'.$_SERVER['PHP_SELF'].'?withproject=1'.($object->id > 0 ? '&id='.$object->id : '&projectid='.$projectstatic->id).'&action=createtime'.$param.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id).'">'.$langs->trans('AddTimeSpent').'<span class="fa fa-plus-circle valignmiddle"></span></a>';
|
if (! empty($projectidforalltimes)) // We are on tab 'Time Spent' of project
|
||||||
|
{
|
||||||
|
$backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject?'&withproject=1':'');
|
||||||
|
$linktocreatetime = '<a class="butActionNew" href="'.$_SERVER['PHP_SELF'].'?withproject=1&projectid='.$projectstatic->id.'&action=createtime'.$param.'&backtopage='.urlencode($backtourl).'">'.$langs->trans('AddTimeSpent').'<span class="fa fa-plus-circle valignmiddle"></span></a>';
|
||||||
|
}
|
||||||
|
else // We are on tab 'Time Spent' of task
|
||||||
|
{
|
||||||
|
$backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject?'&withproject=1':'');
|
||||||
|
$linktocreatetime = '<a class="butActionNew" href="'.$_SERVER['PHP_SELF'].'?withproject=1'.($object->id > 0 ? '&id='.$object->id : '&projectid='.$projectstatic->id).'&action=createtime'.$param.'&backtopage='.urlencode($backtourl).'">'.$langs->trans('AddTimeSpent').'<span class="fa fa-plus-circle valignmiddle"></span></a>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -600,7 +611,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
|
|
||||||
// Progress declared
|
// Progress declared
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
print $formother->select_percent(GETPOST('progress')?GETPOST('progress'):$object->progress,'progress');
|
print $formother->select_percent(GETPOST('progress')?GETPOST('progress'):$object->progress, 'progress', 0, 5, 0, 100, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
@ -785,7 +796,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
|||||||
|
|
||||||
// Progress declared
|
// Progress declared
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
print $formother->select_percent(GETPOST('progress')?GETPOST('progress'):$object->progress,'progress');
|
print $formother->select_percent(GETPOST('progress')?GETPOST('progress'):$object->progress, 'progress', 0, 5, 0, 100, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
|
|||||||
@ -1800,11 +1800,12 @@ if (count($object->records) > 0)
|
|||||||
// Confirmation to clone
|
// Confirmation to clone
|
||||||
if ($action == 'createpagefromclone') {
|
if ($action == 'createpagefromclone') {
|
||||||
// Create an array for form
|
// Create an array for form
|
||||||
|
$preselectedlanguage = GETPOST('newlang', 'az09') ? GETPOST('newlang', 'az09') : ($objectpage->lang ? $objectpage->lang : $langs->defaultlang);
|
||||||
$formquestion = array(
|
$formquestion = array(
|
||||||
array('type' => 'text', 'name' => 'pageurl', 'label'=> $langs->trans("WEBSITE_PAGENAME") ,'value'=> 'copy_of_'.$objectpage->pageurl),
|
array('type' => 'text', 'tdclass'=>'maxwidth200', 'name' => 'pageurl', 'label'=> $langs->trans("WEBSITE_PAGENAME"), 'value'=> 'copy_of_'.$objectpage->pageurl),
|
||||||
array('type' => 'checkbox', 'name' => 'is_a_translation', 'label' => $langs->trans("PageIsANewTranslation"), 'value' => 0),
|
array('type' => 'checkbox', 'tdclass'=>'maxwidth200', 'name' => 'is_a_translation', 'label' => $langs->trans("PageIsANewTranslation"), 'value' => 0),
|
||||||
array('type' => 'other','name' => 'newlang','label' => $langs->trans("Language"), 'value' => $formadmin->select_language(GETPOST('newlang', 'az09')?GETPOST('newlang', 'az09'):$langs->defaultlang, 'newlang', 0, null, 1, 0, 0, 'minwidth200')),
|
array('type' => 'other','name' => 'newlang', 'label' => $langs->trans("Language"), 'value' => $formadmin->select_language($preselectedlanguage, 'newlang', 0, null, 1, 0, 0, 'minwidth200', 0, 1)),
|
||||||
array('type' => 'other','name' => 'newwebsite','label' => $langs->trans("WebSite"), 'value' => $formwebsite->selectWebsite($object->id, 'newwebsite', 0)),
|
array('type' => 'other','name' => 'newwebsite', 'label' => $langs->trans("WebSite"), 'value' => $formwebsite->selectWebsite($object->id, 'newwebsite', 0)),
|
||||||
);
|
);
|
||||||
|
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?website='.$object->ref.'&pageid=' . $pageid, $langs->trans('ClonePage'), '', 'confirm_createpagefromclone', $formquestion, 0, 1, 300, 550);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?website='.$object->ref.'&pageid=' . $pageid, $langs->trans('ClonePage'), '', 'confirm_createpagefromclone', $formquestion, 0, 1, 300, 550);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user