Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
f4fb07b570
@ -216,7 +216,7 @@ $parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."mytable as t";
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."mytable_extrafields as ef on (u.rowid = ef.fk_object)";
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."mytable_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||
$sql.= " WHERE 1 = 1";
|
||||
//$sql.= " WHERE u.entity IN (".getEntity('mytable',1).")";
|
||||
if ($search_field1) $sql.= natural_search("field1",$search_field1);
|
||||
|
||||
@ -1034,9 +1034,9 @@ if ($id)
|
||||
if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); }
|
||||
if ($fieldlist[$field]=='type_cdr') { $valuetoshow=$langs->trans("AtEndOfMonth"); $align="center"; }
|
||||
if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); }
|
||||
if ($fieldlist[$field]=='width') { $valuetoshow=$langs->trans("Width"); }
|
||||
if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); }
|
||||
if ($fieldlist[$field]=='unit') { $valuetoshow=$langs->trans("MeasuringUnit"); }
|
||||
if ($fieldlist[$field]=='width' || $fieldlist[$field]=='nx') { $valuetoshow=$langs->trans("Width"); }
|
||||
if ($fieldlist[$field]=='height' || $fieldlist[$field]=='ny') { $valuetoshow=$langs->trans("Height"); }
|
||||
if ($fieldlist[$field]=='unit' || $fieldlist[$field]=='metric') { $valuetoshow=$langs->trans("MeasuringUnit"); }
|
||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $valuetoshow=''; }
|
||||
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); }
|
||||
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); }
|
||||
@ -1052,6 +1052,18 @@ if ($id)
|
||||
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); }
|
||||
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
|
||||
if ($fieldlist[$field]=='formula') { $valuetoshow=$langs->trans("Formula"); }
|
||||
if ($fieldlist[$field]=='paper_size') { $valuetoshow=$langs->trans("PaperSize"); }
|
||||
if ($fieldlist[$field]=='orientation') { $valuetoshow=$langs->trans("Orientation"); }
|
||||
if ($fieldlist[$field]=='leftmargin') { $valuetoshow=$langs->trans("LeftMargin"); }
|
||||
if ($fieldlist[$field]=='topmargin') { $valuetoshow=$langs->trans("TopMargin"); }
|
||||
if ($fieldlist[$field]=='spacex') { $valuetoshow=$langs->trans("SpaceX"); }
|
||||
if ($fieldlist[$field]=='spacey') { $valuetoshow=$langs->trans("SpaceY"); }
|
||||
if ($fieldlist[$field]=='font_size') { $valuetoshow=$langs->trans("FontSize"); }
|
||||
if ($fieldlist[$field]=='custom_x') { $valuetoshow=$langs->trans("CustomX"); }
|
||||
if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); }
|
||||
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); }
|
||||
if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); }
|
||||
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); }
|
||||
|
||||
if ($id == 2) // Special cas for state page
|
||||
{
|
||||
@ -1211,9 +1223,9 @@ if ($id)
|
||||
if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); }
|
||||
if ($fieldlist[$field]=='type_cdr') { $valuetoshow=$langs->trans("AtEndOfMonth"); $align="center"; }
|
||||
if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); }
|
||||
if ($fieldlist[$field]=='width') { $valuetoshow=$langs->trans("Width"); }
|
||||
if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); }
|
||||
if ($fieldlist[$field]=='unit') { $valuetoshow=$langs->trans("MeasuringUnit"); }
|
||||
if ($fieldlist[$field]=='width' || $fieldlist[$field]=='nx') { $valuetoshow=$langs->trans("Width"); }
|
||||
if ($fieldlist[$field]=='height' || $fieldlist[$field]=='ny') { $valuetoshow=$langs->trans("Height"); }
|
||||
if ($fieldlist[$field]=='unit' || $fieldlist[$field]=='metric') { $valuetoshow=$langs->trans("MeasuringUnit"); }
|
||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
||||
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); }
|
||||
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); $sortable=0; }
|
||||
@ -1229,6 +1241,20 @@ if ($id)
|
||||
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); }
|
||||
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
|
||||
if ($fieldlist[$field]=='formula') { $valuetoshow=$langs->trans("Formula"); }
|
||||
if ($fieldlist[$field]=='paper_size') { $valuetoshow=$langs->trans("PaperSize"); }
|
||||
if ($fieldlist[$field]=='orientation') { $valuetoshow=$langs->trans("Orientation"); }
|
||||
if ($fieldlist[$field]=='leftmargin') { $valuetoshow=$langs->trans("LeftMargin"); }
|
||||
if ($fieldlist[$field]=='topmargin') { $valuetoshow=$langs->trans("TopMargin"); }
|
||||
if ($fieldlist[$field]=='spacex') { $valuetoshow=$langs->trans("SpaceX"); }
|
||||
if ($fieldlist[$field]=='spacey') { $valuetoshow=$langs->trans("SpaceY"); }
|
||||
if ($fieldlist[$field]=='font_size') { $valuetoshow=$langs->trans("FontSize"); }
|
||||
if ($fieldlist[$field]=='custom_x') { $valuetoshow=$langs->trans("CustomX"); }
|
||||
if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); }
|
||||
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); }
|
||||
if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); }
|
||||
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); }
|
||||
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
|
||||
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }
|
||||
|
||||
// Affiche nom du champ
|
||||
if ($showfield)
|
||||
|
||||
@ -325,7 +325,7 @@ if ($mode != 'marketplace')
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
|
||||
$moreforfilter = '';
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.= $langs->trans('Keyword') . ': <input type="text" name="search_keyword" value="'.dol_escape_htmltag($search_keyword).'">';
|
||||
@ -352,7 +352,7 @@ if ($mode != 'marketplace')
|
||||
$moreforfilter.=' ';
|
||||
$moreforfilter.='<input type="submit" name="buttonreset" class="button" value="'.dol_escape_htmltag($langs->trans("Reset")).'">';
|
||||
$moreforfilter.= '</div>';
|
||||
|
||||
|
||||
if (! empty($moreforfilter))
|
||||
{
|
||||
//print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
@ -361,11 +361,10 @@ if ($mode != 'marketplace')
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
//print '</div>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
print '<br><br><br><br>';
|
||||
|
||||
|
||||
|
||||
// Show list of modules
|
||||
|
||||
print '<table summary="list_of_modules" id="list_of_modules" class="liste" width="100%">'."\n";
|
||||
@ -380,7 +379,7 @@ if ($mode != 'marketplace')
|
||||
$modName = $filename[$key];
|
||||
$objMod = $modules[$key];
|
||||
$dirofmodule = $dirmod[$key];
|
||||
|
||||
|
||||
$special = $objMod->special;
|
||||
|
||||
//print $objMod->name." - ".$key." - ".$objMod->special.' - '.$objMod->version."<br>";
|
||||
@ -393,9 +392,9 @@ if ($mode != 'marketplace')
|
||||
dol_syslog("Error for module ".$key." - Property name of module looks empty", LOG_WARNING);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod)));
|
||||
|
||||
|
||||
// Check filters
|
||||
$modulename=$objMod->getName();
|
||||
$moduledesc=$objMod->getDesc();
|
||||
@ -506,7 +505,7 @@ if ($mode != 'marketplace')
|
||||
$text='';
|
||||
if ($objMod->getDescLong()) $text.='<div class="titre">'.$objMod->getDesc().'</div><br>'.$objMod->getDescLong().'<br>';
|
||||
else $text.='<div class="titre">'.$objMod->getDesc().'</div><br>';
|
||||
|
||||
|
||||
$textexternal='';
|
||||
if ($objMod->isCoreOrExternalModule() == 'external')
|
||||
{
|
||||
@ -524,7 +523,7 @@ if ($mode != 'marketplace')
|
||||
if (! empty($conf->global->$const_name)) $text.=dol_print_date($objMod->getLastActivationDate(), 'dayhour');
|
||||
else $text.=$langs->trans("Disabled");
|
||||
$text.='<br>';
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddRemoveTabs").':</strong> ';
|
||||
if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs))
|
||||
{
|
||||
@ -537,7 +536,7 @@ if ($mode != 'marketplace')
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddDictionaries").':</strong> ';
|
||||
if (isset($objMod->dictionaries) && isset($objMod->dictionaries['tablib']) && is_array($objMod->dictionaries['tablib']) && count($objMod->dictionaries['tablib']))
|
||||
{
|
||||
@ -549,7 +548,7 @@ if ($mode != 'marketplace')
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddBoxes").':</strong> ';
|
||||
if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes))
|
||||
{
|
||||
@ -568,14 +567,14 @@ if ($mode != 'marketplace')
|
||||
$text.=$langs->trans("Yes");
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddSubstitutions").':</strong> ';
|
||||
if (isset($objMod->module_parts) && isset($objMod->module_parts['substitutions']) && $objMod->module_parts['substitutions'])
|
||||
{
|
||||
$text.=$langs->trans("Yes");
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddSheduledJobs").':</strong> ';
|
||||
if (isset($objMod->cronjobs) && is_array($objMod->cronjobs) && count($objMod->cronjobs))
|
||||
{
|
||||
@ -587,14 +586,14 @@ if ($mode != 'marketplace')
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddTriggers").':</strong> ';
|
||||
if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers'])
|
||||
{
|
||||
$text.=$langs->trans("Yes");
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddHooks").':</strong> ';
|
||||
if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks']))
|
||||
{
|
||||
@ -618,14 +617,14 @@ if ($mode != 'marketplace')
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddMenus").':</strong> ';
|
||||
if (isset($objMod->menu) && ! empty($objMod->menu)) // objMod can be an array or just an int 1
|
||||
{
|
||||
$text.=$langs->trans("Yes");
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddExportProfiles").':</strong> ';
|
||||
if (isset($objMod->export_label) && is_array($objMod->export_label) && count($objMod->export_label))
|
||||
{
|
||||
@ -637,7 +636,7 @@ if ($mode != 'marketplace')
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddImportProfiles").':</strong> ';
|
||||
if (isset($objMod->import_label) && is_array($objMod->import_label) && count($objMod->import_label))
|
||||
{
|
||||
@ -649,29 +648,29 @@ if ($mode != 'marketplace')
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddOtherPagesOrServices").':</strong> ';
|
||||
$text.=$langs->trans("DetectionNotPossible");
|
||||
|
||||
|
||||
print $form->textwithpicto('', $text, 1, 'help', 'minheight20');
|
||||
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Version
|
||||
print '<td align="center" valign="top" class="nowrap">';
|
||||
|
||||
|
||||
// Picto warning
|
||||
$version=$objMod->getVersion(0);
|
||||
$versiontrans=$objMod->getVersion(1);
|
||||
if (preg_match('/development/i', $version)) print img_warning($langs->trans("Development"), 'style="float: left"');
|
||||
if (preg_match('/experimental/i', $version)) print img_warning($langs->trans("Experimental"), 'style="float: left"');
|
||||
if (preg_match('/deprecated/i', $version)) print img_warning($langs->trans("Deprecated"), 'style="float: left"');
|
||||
|
||||
|
||||
// Picto external
|
||||
if ($textexternal) print img_picto($langs->trans("ExternalModule",$dirofmodule), 'external', 'style="float: left"');
|
||||
|
||||
|
||||
print $versiontrans;
|
||||
|
||||
|
||||
print "</td>\n";
|
||||
|
||||
// Activate/Disable and Setup (2 columns)
|
||||
|
||||
@ -344,7 +344,7 @@ class Categories extends DolibarrApi
|
||||
/**
|
||||
* Clean sensible object datas
|
||||
*
|
||||
* @param object $object Object to clean
|
||||
* @param Categorie $object Object to clean
|
||||
* @return array Array of cleaned object properties
|
||||
*
|
||||
* @todo use an array for properties to clean
|
||||
|
||||
@ -141,6 +141,12 @@ class Contrat extends CommonObject
|
||||
*/
|
||||
var $lines=array();
|
||||
|
||||
/**
|
||||
* Maps ContratLigne IDs to $this->lines indexes
|
||||
* @var int[]
|
||||
*/
|
||||
protected $lines_id_index_mapper=array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -221,38 +227,7 @@ class Contrat extends CommonObject
|
||||
*/
|
||||
function active_line($user, $line_id, $date, $date_end='', $comment='')
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET statut = 4,";
|
||||
$sql.= " date_ouverture = ".(dol_strlen($date)!=0?"'".$this->db->idate($date)."'":"null").",";
|
||||
$sql.= " date_fin_validite = ".(dol_strlen($date_end)!=0?"'".$this->db->idate($date_end)."'":"null").",";
|
||||
$sql.= " fk_user_ouverture = ".$user->id.",";
|
||||
$sql.= " date_cloture = null,";
|
||||
$sql.= " commentaire = '".$this->db->escape($comment)."'";
|
||||
$sql.= " WHERE rowid = ".$line_id . " AND (statut = 0 OR statut = 3 OR statut = 5)";
|
||||
|
||||
dol_syslog(get_class($this)."::active_line", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('CONTRACT_SERVICE_ACTIVATE',$user);
|
||||
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||
// End call triggers
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
$this->lines[$this->lines_id_index_mapper[$line_id]]->active_line($user, $date, $date_end, $comment);
|
||||
}
|
||||
|
||||
|
||||
@ -267,37 +242,7 @@ class Contrat extends CommonObject
|
||||
*/
|
||||
function close_line($user, $line_id, $date_end, $comment='')
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
$error=0;
|
||||
|
||||
// statut actif : 4
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET statut = 5,";
|
||||
$sql.= " date_cloture = '".$this->db->idate($date_end)."',";
|
||||
$sql.= " fk_user_cloture = ".$user->id.",";
|
||||
$sql.= " commentaire = '".$this->db->escape($comment)."'";
|
||||
$sql.= " WHERE rowid = ".$line_id . " AND statut = 4";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('CONTRACT_SERVICE_CLOSE',$user);
|
||||
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||
// End call triggers
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
$this->lines[$this->lines_id_index_mapper[$line_id]]->close_line($user, $date_end, $comment);
|
||||
}
|
||||
|
||||
|
||||
@ -748,6 +693,7 @@ class Contrat extends CommonObject
|
||||
$line->fetch_optionals($line->id,$extralabelsline);
|
||||
|
||||
$this->lines[] = $line;
|
||||
$this->lines_id_index_mapper[$line->id] = key($this->lines);
|
||||
|
||||
//dol_syslog("1 ".$line->desc);
|
||||
//dol_syslog("2 ".$line->product_desc);
|
||||
@ -852,6 +798,7 @@ class Contrat extends CommonObject
|
||||
|
||||
|
||||
$this->lines[] = $line;
|
||||
$this->lines_id_index_mapper[$line->id] = key($this->lines);
|
||||
|
||||
$total_ttc+=$objp->total_ttc;
|
||||
$total_vat+=$objp->total_tva;
|
||||
@ -2947,4 +2894,106 @@ class ContratLigne extends CommonObjectLine
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate a contract line
|
||||
*
|
||||
* @param User $user Objet User who activate contract
|
||||
* @param int $date Date d'ouverture
|
||||
* @param int|string $date_end Date fin prevue
|
||||
* @param string $comment A comment typed by user
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function active_line($user, $date, $date_end = '', $comment = '')
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
// Update object
|
||||
$this->date_ouverture = $date;
|
||||
$this->date_fin_validite = $date_end;
|
||||
$this->fk_user_ouverture = $user->id;
|
||||
$this->date_cloture = null;
|
||||
$this->commentaire = $comment;
|
||||
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "contratdet SET statut = 4,";
|
||||
$sql .= " date_ouverture = " . (dol_strlen($date) != 0 ? "'" . $this->db->idate($date) . "'" : "null") . ",";
|
||||
$sql .= " date_fin_validite = " . (dol_strlen($date_end) != 0 ? "'" . $this->db->idate($date_end) . "'" : "null") . ",";
|
||||
$sql .= " fk_user_ouverture = " . $user->id . ",";
|
||||
$sql .= " date_cloture = null,";
|
||||
$sql .= " commentaire = '" . $this->db->escape($comment) . "'";
|
||||
$sql .= " WHERE rowid = " . $this->id . " AND (statut = 0 OR statut = 3 OR statut = 5)";
|
||||
|
||||
dol_syslog(get_class($this) . "::active_line", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('CONTRACT_SERVICE_ACTIVATE', $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
// End call triggers
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Close a contract line
|
||||
*
|
||||
* @param User $user Objet User who close contract
|
||||
* @param int $date_end Date end
|
||||
* @param string $comment A comment typed by user
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function close_line($user, $date_end, $comment = '')
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
// Update object
|
||||
$this->date_cloture = $date_end;
|
||||
$this->fk_user_cloture = $user->id;
|
||||
$this->commentaire = $comment;
|
||||
|
||||
$error = 0;
|
||||
|
||||
// statut actif : 4
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "contratdet SET statut = 5,";
|
||||
$sql .= " date_cloture = '" . $this->db->idate($date_end) . "',";
|
||||
$sql .= " fk_user_cloture = " . $user->id . ",";
|
||||
$sql .= " commentaire = '" . $this->db->escape($comment) . "'";
|
||||
$sql .= " WHERE rowid = " . $this->id . " AND statut = 4";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('CONTRACT_SERVICE_CLOSE', $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
// End call triggers
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,6 +223,16 @@ HelpCenterDesc1=This area can help you to get a Help support service on Dolibarr
|
||||
HelpCenterDesc2=Some part of this service are available in <b>english only</b>.
|
||||
CurrentMenuHandler=Current menu handler
|
||||
MeasuringUnit=Measuring unit
|
||||
LeftMargin=Left margin
|
||||
TopMargin=Top margin
|
||||
PaperSize=Paper type
|
||||
Orientation=Orientation
|
||||
SpaceX=Space X
|
||||
SpaceY=Space Y
|
||||
FontSize=Font size
|
||||
Content=Content
|
||||
NoticePeriod=Notice
|
||||
NewByMonth=New by month
|
||||
Emails=E-mails
|
||||
EMailsSetup=E-mails setup
|
||||
EMailsDesc=This page allows you to overwrite your PHP parameters for e-mails sending. In most cases on Unix/Linux OS, your PHP setup is correct and these parameters are useless.
|
||||
@ -815,6 +825,7 @@ DictionaryPaymentModes=Payment modes
|
||||
DictionaryTypeContact=Contact/Address types
|
||||
DictionaryEcotaxe=Ecotax (WEEE)
|
||||
DictionaryPaperFormat=Paper formats
|
||||
DictionaryFormatCards=Cards formats
|
||||
DictionaryFees=Types of fees
|
||||
DictionarySendingMethods=Shipping methods
|
||||
DictionaryStaff=Staff
|
||||
|
||||
@ -613,6 +613,9 @@ NoFileFound=No documents saved in this directory
|
||||
CurrentUserLanguage=Current language
|
||||
CurrentTheme=Current theme
|
||||
CurrentMenuManager=Current menu manager
|
||||
Browser=Browser
|
||||
Layout=Layout
|
||||
Screen=Screen
|
||||
DisabledModules=Disabled modules
|
||||
For=For
|
||||
ForCustomer=For customer
|
||||
|
||||
@ -924,7 +924,23 @@ class Product extends CommonObject
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
|
||||
// Delete from product_batch on product delete
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX.'product_batch';
|
||||
$sql.= " WHERE fk_product_stock IN (";
|
||||
$sql.= "SELECT rowid FROM ".MAIN_DB_PREFIX.'product_stock';
|
||||
$sql.= " WHERE fk_product = ".$id.")";
|
||||
dol_syslog(get_class($this).'::delete', LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if (! $result)
|
||||
{
|
||||
$error++;
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
// Delete all child tables
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
@ -275,7 +275,7 @@ class StockMovements extends DolibarrApi
|
||||
/**
|
||||
* Clean sensible object datas
|
||||
*
|
||||
* @param object $object Object to clean
|
||||
* @param MouvementStock $object Object to clean
|
||||
* @return array Array of cleaned object properties
|
||||
*
|
||||
* @todo use an array for properties to clean
|
||||
|
||||
@ -244,7 +244,7 @@ class Warehouses extends DolibarrApi
|
||||
/**
|
||||
* Clean sensible object datas
|
||||
*
|
||||
* @param object $object Object to clean
|
||||
* @param Entrepot $object Object to clean
|
||||
* @return array Array of cleaned object properties
|
||||
*
|
||||
* @todo use an array for properties to clean
|
||||
|
||||
@ -780,7 +780,7 @@ class Task extends CommonObject
|
||||
* @param User $usert Return roles on task for this internal user. If set userp must NOT be defined. -1 means no filter.
|
||||
* @param int $projectid Project id list separated with , to filter on project
|
||||
* @param int $taskid Task id to filter on a task
|
||||
* @param string $filteronprojstatus Filter on project status if userp is set. Not used if userp not defined.
|
||||
* @param integer $filteronprojstatus Filter on project status if userp is set. Not used if userp not defined.
|
||||
* @return array Array (projectid => 'list of roles for project' or taskid => 'list of roles for task')
|
||||
*/
|
||||
function getUserRolesForProjectsOrTasks($userp, $usert, $projectid='', $taskid=0, $filteronprojstatus=-1)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user