forked from Wavyzz/dolibarr
Merge remote-tracking branch 'upstream/develop' into actioncomm_category
This commit is contained in:
@@ -32,13 +32,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("errors","admin","companies","resource","holiday","accountancy","hrm"));
|
||||
$langs->loadLangs(array("errors", "admin", "companies", "resource", "holiday", "accountancy", "hrm"));
|
||||
|
||||
$action=GETPOST('action', 'aZ09')?GETPOST('action', 'aZ09'):'view';
|
||||
$confirm=GETPOST('confirm', 'alpha');
|
||||
$id=32;
|
||||
$rowid=GETPOST('rowid', 'alpha');
|
||||
$code=GETPOST('code', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view';
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$id = 32;
|
||||
$rowid = GETPOST('rowid', 'alpha');
|
||||
$code = GETPOST('code', 'alpha');
|
||||
|
||||
// Security access
|
||||
if (empty($user->rights->accounting->chartofaccount)) {
|
||||
@@ -50,15 +50,15 @@ $acts[1] = "disable";
|
||||
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$actl[1] = img_picto($langs->trans("Activated"), 'switch_on');
|
||||
|
||||
$listoffset=GETPOST('listoffset', 'alpha');
|
||||
$listlimit=GETPOST('listlimit', 'int')>0?GETPOST('listlimit', 'int'):1000;
|
||||
$listoffset = GETPOST('listoffset', 'alpha');
|
||||
$listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000;
|
||||
$active = 1;
|
||||
|
||||
$sortfield = GETPOST("sortfield", 'aZ09comma');
|
||||
$sortorder = GETPOST("sortorder", 'aZ09comma');
|
||||
$page = GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $listlimit * $page ;
|
||||
$offset = $listlimit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
@@ -71,52 +71,52 @@ $hookmanager->initHooks(array('admin'));
|
||||
// Put here declaration of dictionaries properties
|
||||
|
||||
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
|
||||
$taborder=array(32);
|
||||
$taborder = array(32);
|
||||
|
||||
// Name of SQL tables of dictionaries
|
||||
$tabname=array();
|
||||
$tabname[32]= MAIN_DB_PREFIX."c_accounting_category";
|
||||
$tabname = array();
|
||||
$tabname[32] = MAIN_DB_PREFIX."c_accounting_category";
|
||||
|
||||
// Dictionary labels
|
||||
$tablib=array();
|
||||
$tablib[32]= "DictionaryAccountancyCategory";
|
||||
$tablib = array();
|
||||
$tablib[32] = "DictionaryAccountancyCategory";
|
||||
|
||||
// Requests to extract data
|
||||
$tabsql=array();
|
||||
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
||||
$tabsql = array();
|
||||
$tabsql[32] = "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
||||
|
||||
// Criteria to sort dictionaries
|
||||
$tabsqlsort=array();
|
||||
$tabsqlsort[32]="position ASC";
|
||||
$tabsqlsort = array();
|
||||
$tabsqlsort[32] = "position ASC";
|
||||
|
||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||
$tabfield=array();
|
||||
$tabfield[32]= "code,label,range_account,category_type,formula,position,country";
|
||||
$tabfield = array();
|
||||
$tabfield[32] = "code,label,range_account,category_type,formula,position,country";
|
||||
|
||||
// Nom des champs d'edition pour modification d'un enregistrement
|
||||
$tabfieldvalue=array();
|
||||
$tabfieldvalue[32]= "code,label,range_account,category_type,formula,position,country_id";
|
||||
$tabfieldvalue = array();
|
||||
$tabfieldvalue[32] = "code,label,range_account,category_type,formula,position,country_id";
|
||||
|
||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||
$tabfieldinsert=array();
|
||||
$tabfieldinsert[32]= "code,label,range_account,category_type,formula,position,fk_country";
|
||||
$tabfieldinsert = array();
|
||||
$tabfieldinsert[32] = "code,label,range_account,category_type,formula,position,fk_country";
|
||||
|
||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
||||
// Example: "" if id field is "rowid" and has autoincrement on
|
||||
// "nameoffield" if id field is not "rowid" or has not autoincrement on
|
||||
$tabrowid=array();
|
||||
$tabrowid[32]= "";
|
||||
$tabrowid = array();
|
||||
$tabrowid[32] = "";
|
||||
|
||||
// Condition to show dictionary in setup page
|
||||
$tabcond=array();
|
||||
$tabcond[32]= ! empty($conf->accounting->enabled);
|
||||
$tabcond = array();
|
||||
$tabcond[32] = !empty($conf->accounting->enabled);
|
||||
|
||||
// List of help for fields
|
||||
$tabhelp=array();
|
||||
$tabhelp = array();
|
||||
$tabhelp[32] = array('code'=>$langs->trans("EnterAnyCode"), 'category_type'=>$langs->trans("SetToYesIfGroupIsComputationOfOtherGroups"), 'formula'=>$langs->trans("EnterCalculationRuleIfPreviousFieldIsYes"));
|
||||
|
||||
// List of check for fields (NOT USED YET)
|
||||
$tabfieldcheck=array();
|
||||
$tabfieldcheck = array();
|
||||
$tabfieldcheck[32] = array();
|
||||
|
||||
// Complete all arrays with entries found into modules
|
||||
@@ -125,7 +125,7 @@ complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqls
|
||||
|
||||
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
|
||||
$elementList = array();
|
||||
$sourceList=array();
|
||||
$sourceList = array();
|
||||
|
||||
|
||||
|
||||
@@ -141,24 +141,24 @@ if (GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x',
|
||||
// Actions add or modify an entry into a dictionary
|
||||
if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
{
|
||||
$listfield=explode(',', str_replace(' ', '', $tabfield[$id]));
|
||||
$listfieldinsert=explode(',', $tabfieldinsert[$id]);
|
||||
$listfieldmodify=explode(',', $tabfieldinsert[$id]);
|
||||
$listfieldvalue=explode(',', $tabfieldvalue[$id]);
|
||||
$listfield = explode(',', str_replace(' ', '', $tabfield[$id]));
|
||||
$listfieldinsert = explode(',', $tabfieldinsert[$id]);
|
||||
$listfieldmodify = explode(',', $tabfieldinsert[$id]);
|
||||
$listfieldvalue = explode(',', $tabfieldvalue[$id]);
|
||||
|
||||
// Check that all fields are filled
|
||||
$ok=1;
|
||||
$ok = 1;
|
||||
foreach ($listfield as $f => $value)
|
||||
{
|
||||
if ($value == 'formula' && empty($_POST['formula'])) continue;
|
||||
if ($value == 'range_account' && empty($_POST['range_account'])) continue;
|
||||
if ($value == 'country' || $value == 'country_id') continue;
|
||||
if (! isset($_POST[$value]) || $_POST[$value]=='')
|
||||
if (!isset($_POST[$value]) || $_POST[$value] == '')
|
||||
{
|
||||
$ok=0;
|
||||
$fieldnamekey=$listfield[$f];
|
||||
$ok = 0;
|
||||
$fieldnamekey = $listfield[$f];
|
||||
// We take translate key of field
|
||||
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
|
||||
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey = 'Label';
|
||||
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
|
||||
if ($fieldnamekey == 'note') $fieldnamekey = 'Note';
|
||||
if ($fieldnamekey == 'type') $fieldnamekey = 'Type';
|
||||
@@ -170,23 +170,23 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
}
|
||||
if (isset($_POST["code"]))
|
||||
{
|
||||
if ($_POST["code"]=='0')
|
||||
if ($_POST["code"] == '0')
|
||||
{
|
||||
$ok=0;
|
||||
$ok = 0;
|
||||
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
|
||||
}
|
||||
}
|
||||
if (! is_numeric(GETPOST('position', 'alpha')))
|
||||
if (!is_numeric(GETPOST('position', 'alpha')))
|
||||
{
|
||||
$langs->loadLangs(array("errors"));
|
||||
$ok=0;
|
||||
$ok = 0;
|
||||
setEventMessages($langs->transnoentities('ErrorFieldMustBeANumeric', $langs->transnoentities("Position")), null, 'errors');
|
||||
}
|
||||
|
||||
// Clean some parameters
|
||||
if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"]=''; // If empty, we force to null
|
||||
if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"]=''; // If empty, we force to null
|
||||
if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null
|
||||
if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"] = ''; // If empty, we force to null
|
||||
if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"] = ''; // If empty, we force to null
|
||||
if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"] = ''; // If empty, we force to null
|
||||
|
||||
// Si verif ok et action add, on ajoute la ligne
|
||||
if ($ok && GETPOST('actionadd', 'alpha'))
|
||||
@@ -194,13 +194,13 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
if ($tabrowid[$id])
|
||||
{
|
||||
// Recupere id libre pour insertion
|
||||
$newid=0;
|
||||
$newid = 0;
|
||||
$sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id];
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$newid=($obj->newid + 1);
|
||||
$newid = ($obj->newid + 1);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
@@ -209,32 +209,32 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
// Add new entry
|
||||
$sql = "INSERT INTO ".$tabname[$id]." (";
|
||||
// List of fields
|
||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id], $listfieldinsert)) $sql.= $tabrowid[$id].",";
|
||||
$sql.= $tabfieldinsert[$id];
|
||||
$sql.=",active)";
|
||||
$sql.= " VALUES(";
|
||||
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) $sql .= $tabrowid[$id].",";
|
||||
$sql .= $tabfieldinsert[$id];
|
||||
$sql .= ",active)";
|
||||
$sql .= " VALUES(";
|
||||
|
||||
// List of values
|
||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id], $listfieldinsert)) $sql.= $newid.",";
|
||||
$i=0;
|
||||
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) $sql .= $newid.",";
|
||||
$i = 0;
|
||||
foreach ($listfieldinsert as $f => $value)
|
||||
{
|
||||
if ($value == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($i) $sql.=",";
|
||||
if ($_POST[$listfieldvalue[$i]] == '' && ! $listfieldvalue[$i] == 'formula') $sql.="null"; // For vat, we want/accept code = ''
|
||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
if ($i) $sql .= ",";
|
||||
if ($_POST[$listfieldvalue[$i]] == '' && !$listfieldvalue[$i] == 'formula') $sql .= "null"; // For vat, we want/accept code = ''
|
||||
else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
$i++;
|
||||
}
|
||||
$sql.=",1)";
|
||||
$sql .= ",1)";
|
||||
|
||||
dol_syslog("actionadd", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) // Add is ok
|
||||
{
|
||||
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||
$_POST=array('id'=>$id); // Clean $_POST array, we keep only
|
||||
$_POST = array('id'=>$id); // Clean $_POST array, we keep only
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -250,16 +250,16 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
// Si verif ok et action modify, on modifie la ligne
|
||||
if ($ok && GETPOST('actionmodify', 'alpha'))
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
|
||||
// Modify entry
|
||||
$sql = "UPDATE ".$tabname[$id]." SET ";
|
||||
// Modifie valeur des champs
|
||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id], $listfieldmodify))
|
||||
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify))
|
||||
{
|
||||
$sql.= $tabrowid[$id]."=";
|
||||
$sql.= "'".$db->escape($rowid)."', ";
|
||||
$sql .= $tabrowid[$id]."=";
|
||||
$sql .= "'".$db->escape($rowid)."', ";
|
||||
}
|
||||
$i = 0;
|
||||
foreach ($listfieldmodify as $field)
|
||||
@@ -270,18 +270,18 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
elseif ($field == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($i) $sql.=",";
|
||||
$sql.= $field."=";
|
||||
if ($_POST[$listfieldvalue[$i]] == '' && ! $listfieldvalue[$i] == 'range_account') $sql.="null"; // For range_account, we want/accept code = ''
|
||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
if ($i) $sql .= ",";
|
||||
$sql .= $field."=";
|
||||
if ($_POST[$listfieldvalue[$i]] == '' && !$listfieldvalue[$i] == 'range_account') $sql .= "null"; // For range_account, we want/accept code = ''
|
||||
else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
$i++;
|
||||
}
|
||||
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
|
||||
$sql .= " WHERE ".$rowidcol." = '".$rowid."'";
|
||||
|
||||
dol_syslog("actionmodify", LOG_DEBUG);
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql)
|
||||
if (!$resql)
|
||||
{
|
||||
setEventMessages($db->error(), null, 'errors');
|
||||
}
|
||||
@@ -296,14 +296,14 @@ if (GETPOST('actioncancel', 'alpha'))
|
||||
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
|
||||
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol." = '".$db->escape($rowid)."'";
|
||||
|
||||
dol_syslog("delete", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if (! $result)
|
||||
if (!$result)
|
||||
{
|
||||
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
|
||||
{
|
||||
@@ -319,8 +319,8 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
||||
// activate
|
||||
if ($action == $acts[0])
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'";
|
||||
@@ -339,8 +339,8 @@ if ($action == $acts[0])
|
||||
// disable
|
||||
if ($action == $acts[1])
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'";
|
||||
@@ -359,8 +359,8 @@ if ($action == $acts[1])
|
||||
// favorite
|
||||
if ($action == 'activate_favorite')
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'";
|
||||
@@ -379,8 +379,8 @@ if ($action == 'activate_favorite')
|
||||
// disable favorite
|
||||
if ($action == 'disable_favorite')
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'";
|
||||
@@ -402,13 +402,13 @@ if ($action == 'disable_favorite')
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formadmin=new FormAdmin($db);
|
||||
$formadmin = new FormAdmin($db);
|
||||
|
||||
llxHeader('', $langs->trans('DictionaryAccountancyCategory'));
|
||||
|
||||
$titre=$langs->trans($tablib[$id]);
|
||||
$linkback='';
|
||||
$titlepicto='title_setup';
|
||||
$titre = $langs->trans($tablib[$id]);
|
||||
$linkback = '';
|
||||
$titlepicto = 'title_setup';
|
||||
|
||||
print load_fiche_titre($titre, $linkback, $titlepicto);
|
||||
|
||||
@@ -417,7 +417,7 @@ print '<span class="opacitymedium">'.$langs->trans("AccountingAccountGroupsDesc"
|
||||
// Confirmation de la suppression de la ligne
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id.($search_country_id>0?'&search_country_id='.$search_country_id:''), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id.($search_country_id > 0 ? '&search_country_id='.$search_country_id : ''), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
|
||||
}
|
||||
//var_dump($elementList);
|
||||
|
||||
@@ -427,22 +427,22 @@ if ($action == 'delete')
|
||||
if ($id)
|
||||
{
|
||||
// Complete requete recherche valeurs avec critere de tri
|
||||
$sql=$tabsql[$id];
|
||||
$sql = $tabsql[$id];
|
||||
|
||||
if ($search_country_id > 0)
|
||||
{
|
||||
if (preg_match('/ WHERE /', $sql)) $sql.= " AND ";
|
||||
else $sql.=" WHERE ";
|
||||
$sql.= " (a.fk_country = ".$search_country_id." OR a.fk_country = 0)";
|
||||
if (preg_match('/ WHERE /', $sql)) $sql .= " AND ";
|
||||
else $sql .= " WHERE ";
|
||||
$sql .= " (a.fk_country = ".$search_country_id." OR a.fk_country = 0)";
|
||||
}
|
||||
|
||||
// If sort order is "country", we use country_code instead
|
||||
if ($sortfield == 'country') $sortfield='country_code';
|
||||
$sql.=$db->order($sortfield, $sortorder);
|
||||
$sql.=$db->plimit($listlimit+1, $offset);
|
||||
if ($sortfield == 'country') $sortfield = 'country_code';
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
$sql .= $db->plimit($listlimit + 1, $offset);
|
||||
//print $sql;
|
||||
|
||||
$fieldlist=explode(',', $tabfield[$id]);
|
||||
$fieldlist = explode(',', $tabfield[$id]);
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@@ -454,9 +454,9 @@ if ($id)
|
||||
// Form to add a new line
|
||||
if ($tabname[$id])
|
||||
{
|
||||
$alabelisused=0;
|
||||
$alabelisused = 0;
|
||||
|
||||
$fieldlist=explode(',', $tabfield[$id]);
|
||||
$fieldlist = explode(',', $tabfield[$id]);
|
||||
|
||||
// Line for title
|
||||
print '<tr class="liste_titre">';
|
||||
@@ -464,55 +464,55 @@ if ($id)
|
||||
{
|
||||
// Determine le nom du champ par rapport aux noms possibles
|
||||
// dans les dictionnaires de donnees
|
||||
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||
$class="left";
|
||||
if ($fieldlist[$field]=='type') {
|
||||
$valuetoshow = ucfirst($fieldlist[$field]); // Par defaut
|
||||
$valuetoshow = $langs->trans($valuetoshow); // try to translate
|
||||
$class = "left";
|
||||
if ($fieldlist[$field] == 'type') {
|
||||
if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") {
|
||||
$valuetoshow=$form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, ''));
|
||||
$valuetoshow = $form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, ''));
|
||||
} else {
|
||||
$valuetoshow=$langs->trans("Type");
|
||||
$valuetoshow = $langs->trans("Type");
|
||||
}
|
||||
}
|
||||
if ($fieldlist[$field]=='code') {
|
||||
$valuetoshow=$langs->trans("Code");
|
||||
if ($fieldlist[$field] == 'code') {
|
||||
$valuetoshow = $langs->trans("Code");
|
||||
}
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') {
|
||||
$valuetoshow=$langs->trans("Label");
|
||||
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
|
||||
$valuetoshow = $langs->trans("Label");
|
||||
}
|
||||
if ($fieldlist[$field]=='libelle_facture') {
|
||||
$valuetoshow=$langs->trans("LabelOnDocuments");
|
||||
if ($fieldlist[$field] == 'libelle_facture') {
|
||||
$valuetoshow = $langs->trans("LabelOnDocuments");
|
||||
}
|
||||
if ($fieldlist[$field]=='country') {
|
||||
$valuetoshow=$langs->trans("Country");
|
||||
if ($fieldlist[$field] == 'country') {
|
||||
$valuetoshow = $langs->trans("Country");
|
||||
}
|
||||
if ($fieldlist[$field]=='accountancy_code') {
|
||||
$valuetoshow=$langs->trans("AccountancyCode");
|
||||
if ($fieldlist[$field] == 'accountancy_code') {
|
||||
$valuetoshow = $langs->trans("AccountancyCode");
|
||||
}
|
||||
if ($fieldlist[$field]=='accountancy_code_sell') {
|
||||
$valuetoshow=$langs->trans("AccountancyCodeSell");
|
||||
if ($fieldlist[$field] == 'accountancy_code_sell') {
|
||||
$valuetoshow = $langs->trans("AccountancyCodeSell");
|
||||
}
|
||||
if ($fieldlist[$field]=='accountancy_code_buy') {
|
||||
$valuetoshow=$langs->trans("AccountancyCodeBuy");
|
||||
if ($fieldlist[$field] == 'accountancy_code_buy') {
|
||||
$valuetoshow = $langs->trans("AccountancyCodeBuy");
|
||||
}
|
||||
if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') {
|
||||
$valuetoshow=$langs->trans("Pcg_version");
|
||||
if ($fieldlist[$field] == 'pcg_version' || $fieldlist[$field] == 'fk_pcg_version') {
|
||||
$valuetoshow = $langs->trans("Pcg_version");
|
||||
}
|
||||
if ($fieldlist[$field]=='range_account') {
|
||||
$valuetoshow=$langs->trans("Comment");
|
||||
if ($fieldlist[$field] == 'range_account') {
|
||||
$valuetoshow = $langs->trans("Comment");
|
||||
}
|
||||
if ($fieldlist[$field]=='category_type') {
|
||||
$valuetoshow=$langs->trans("Calculated");
|
||||
if ($fieldlist[$field] == 'category_type') {
|
||||
$valuetoshow = $langs->trans("Calculated");
|
||||
}
|
||||
|
||||
if ($valuetoshow != '') {
|
||||
print '<td class="'.$class.'">';
|
||||
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
elseif (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
|
||||
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
elseif (!empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
|
||||
else print $valuetoshow;
|
||||
print '</td>';
|
||||
}
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
||||
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1;
|
||||
}
|
||||
|
||||
print '<td>';
|
||||
@@ -533,14 +533,14 @@ if ($id)
|
||||
foreach ($fieldlist as $key=>$val)
|
||||
{
|
||||
if (GETPOST($val) != '')
|
||||
$obj->$val=GETPOST($val);
|
||||
$obj->$val = GETPOST($val);
|
||||
}
|
||||
}
|
||||
|
||||
$tmpaction = 'create';
|
||||
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook=$hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
@@ -552,42 +552,42 @@ if ($id)
|
||||
print '</td>';
|
||||
print "</tr>";
|
||||
|
||||
$colspan=count($fieldlist)+3;
|
||||
$colspan = count($fieldlist) + 3;
|
||||
if ($id == 32) $colspan++;
|
||||
|
||||
print '<tr><td colspan="'.$colspan.'"> </td></tr>'; // Keep to have a line with enough height
|
||||
print '<tr><td colspan="'.$colspan.'"> </td></tr>'; // Keep to have a line with enough height
|
||||
}
|
||||
|
||||
// List of available record in database
|
||||
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$param = '&id='.$id;
|
||||
if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id;
|
||||
if ($search_country_id > 0) $param .= '&search_country_id='.$search_country_id;
|
||||
$paramwithsearch = $param;
|
||||
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
|
||||
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
|
||||
if (GETPOST('from', 'alpha')) $paramwithsearch.= '&from='.GETPOST('from', 'alpha');
|
||||
if ($sortorder) $paramwithsearch .= '&sortorder='.$sortorder;
|
||||
if ($sortfield) $paramwithsearch .= '&sortfield='.$sortfield;
|
||||
if (GETPOST('from', 'alpha')) $paramwithsearch .= '&from='.GETPOST('from', 'alpha');
|
||||
// There is several pages
|
||||
if ($num > $listlimit)
|
||||
{
|
||||
print '<tr class="none"><td class="right" colspan="'.(3+count($fieldlist)).'">';
|
||||
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
|
||||
print '<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).'">';
|
||||
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page + 1).'</span></li>');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Title line with search boxes
|
||||
print '<tr class="liste_titre liste_titre_add liste_titre_filter">';
|
||||
$filterfound=0;
|
||||
$filterfound = 0;
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
$showfield=1; // By defaut
|
||||
$showfield = 1; // By defaut
|
||||
|
||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
||||
if ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') { $showfield = 0; }
|
||||
|
||||
if ($showfield)
|
||||
{
|
||||
@@ -610,7 +610,7 @@ if ($id)
|
||||
print '<td class="liste_titre center">';
|
||||
if ($filterfound)
|
||||
{
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
}
|
||||
print '</td>';
|
||||
@@ -622,80 +622,80 @@ if ($id)
|
||||
{
|
||||
// Determine le nom du champ par rapport aux noms possibles
|
||||
// dans les dictionnaires de donnees
|
||||
$showfield=1; // By defaut
|
||||
$class="left";
|
||||
$sortable=1;
|
||||
$valuetoshow='';
|
||||
$showfield = 1; // By defaut
|
||||
$class = "left";
|
||||
$sortable = 1;
|
||||
$valuetoshow = '';
|
||||
|
||||
$valuetoshow=ucfirst($fieldlist[$field]); // By defaut
|
||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||
if ($fieldlist[$field]=='source') {
|
||||
$valuetoshow=$langs->trans("Contact");
|
||||
$valuetoshow = ucfirst($fieldlist[$field]); // By defaut
|
||||
$valuetoshow = $langs->trans($valuetoshow); // try to translate
|
||||
if ($fieldlist[$field] == 'source') {
|
||||
$valuetoshow = $langs->trans("Contact");
|
||||
}
|
||||
if ($fieldlist[$field]=='price') {
|
||||
$valuetoshow=$langs->trans("PriceUHT");
|
||||
if ($fieldlist[$field] == 'price') {
|
||||
$valuetoshow = $langs->trans("PriceUHT");
|
||||
}
|
||||
if ($fieldlist[$field]=='taux') {
|
||||
if ($fieldlist[$field] == 'taux') {
|
||||
if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") {
|
||||
$valuetoshow=$langs->trans("Rate");
|
||||
$valuetoshow = $langs->trans("Rate");
|
||||
} else {
|
||||
$valuetoshow=$langs->trans("Amount");
|
||||
$valuetoshow = $langs->trans("Amount");
|
||||
}
|
||||
$class='center';
|
||||
$class = 'center';
|
||||
}
|
||||
if ($fieldlist[$field]=='type') {
|
||||
$valuetoshow=$langs->trans("Type");
|
||||
if ($fieldlist[$field] == 'type') {
|
||||
$valuetoshow = $langs->trans("Type");
|
||||
}
|
||||
if ($fieldlist[$field]=='code') {
|
||||
$valuetoshow=$langs->trans("Code");
|
||||
if ($fieldlist[$field] == 'code') {
|
||||
$valuetoshow = $langs->trans("Code");
|
||||
}
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') {
|
||||
$valuetoshow=$langs->trans("Label");
|
||||
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
|
||||
$valuetoshow = $langs->trans("Label");
|
||||
}
|
||||
if ($fieldlist[$field]=='country') {
|
||||
$valuetoshow=$langs->trans("Country");
|
||||
if ($fieldlist[$field] == 'country') {
|
||||
$valuetoshow = $langs->trans("Country");
|
||||
}
|
||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') {
|
||||
$showfield=0;
|
||||
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') {
|
||||
$valuetoshow = $langs->trans("AccountancyCode");
|
||||
}
|
||||
if ($fieldlist[$field]=='accountancy_code_sell') {
|
||||
$valuetoshow=$langs->trans("AccountancyCodeSell");
|
||||
$sortable=0;
|
||||
if ($fieldlist[$field] == 'accountancy_code_sell') {
|
||||
$valuetoshow = $langs->trans("AccountancyCodeSell");
|
||||
$sortable = 0;
|
||||
}
|
||||
if ($fieldlist[$field]=='accountancy_code_buy') {
|
||||
$valuetoshow=$langs->trans("AccountancyCodeBuy");
|
||||
$sortable=0;
|
||||
if ($fieldlist[$field] == 'accountancy_code_buy') {
|
||||
$valuetoshow = $langs->trans("AccountancyCodeBuy");
|
||||
$sortable = 0;
|
||||
}
|
||||
if ($fieldlist[$field]=='fk_pcg_version') {
|
||||
$valuetoshow=$langs->trans("Pcg_version");
|
||||
if ($fieldlist[$field] == 'fk_pcg_version') {
|
||||
$valuetoshow = $langs->trans("Pcg_version");
|
||||
}
|
||||
if ($fieldlist[$field]=='account_parent') {
|
||||
$valuetoshow=$langs->trans("Accountsparent");
|
||||
if ($fieldlist[$field] == 'account_parent') {
|
||||
$valuetoshow = $langs->trans("Accountsparent");
|
||||
}
|
||||
if ($fieldlist[$field]=='pcg_type') {
|
||||
$valuetoshow=$langs->trans("Pcg_type");
|
||||
if ($fieldlist[$field] == 'pcg_type') {
|
||||
$valuetoshow = $langs->trans("Pcg_type");
|
||||
}
|
||||
if ($fieldlist[$field]=='pcg_subtype') {
|
||||
$valuetoshow=$langs->trans("Pcg_subtype");
|
||||
if ($fieldlist[$field] == 'pcg_subtype') {
|
||||
$valuetoshow = $langs->trans("Pcg_subtype");
|
||||
}
|
||||
if ($fieldlist[$field]=='type_template') {
|
||||
$valuetoshow=$langs->trans("TypeOfTemplate");
|
||||
if ($fieldlist[$field] == 'type_template') {
|
||||
$valuetoshow = $langs->trans("TypeOfTemplate");
|
||||
}
|
||||
if ($fieldlist[$field]=='range_account') {
|
||||
$valuetoshow=$langs->trans("Comment");
|
||||
if ($fieldlist[$field] == 'range_account') {
|
||||
$valuetoshow = $langs->trans("Comment");
|
||||
}
|
||||
if ($fieldlist[$field]=='category_type') {
|
||||
$valuetoshow=$langs->trans("Calculated");
|
||||
if ($fieldlist[$field] == 'category_type') {
|
||||
$valuetoshow = $langs->trans("Calculated");
|
||||
}
|
||||
// Affiche nom du champ
|
||||
if ($showfield) {
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "", $sortfield, $sortorder, $class.' ');
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "", $sortfield, $sortorder, $class.' ');
|
||||
}
|
||||
}
|
||||
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, 'center ');
|
||||
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, 'center ');
|
||||
print getTitleFieldOfList('');
|
||||
print getTitleFieldOfList('');
|
||||
print getTitleFieldOfList('');
|
||||
@@ -709,12 +709,12 @@ if ($id)
|
||||
$obj = $db->fetch_object($resql);
|
||||
//print_r($obj);
|
||||
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
||||
if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code)))
|
||||
if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code)))
|
||||
{
|
||||
$tmpaction='edit';
|
||||
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook=$hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
$tmpaction = 'edit';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
|
||||
// Show fields
|
||||
if (empty($reshook)) fieldListAccountingCategories($fieldlist, $obj, $tabname[$id], 'edit');
|
||||
@@ -725,7 +725,7 @@ if ($id)
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||
print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>';
|
||||
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
|
||||
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
@@ -733,71 +733,71 @@ if ($id)
|
||||
else
|
||||
{
|
||||
$tmpaction = 'view';
|
||||
$parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook=$hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
$showfield=1;
|
||||
$class="left";
|
||||
$valuetoshow=$obj->{$fieldlist[$field]};
|
||||
$showfield = 1;
|
||||
$class = "left";
|
||||
$valuetoshow = $obj->{$fieldlist[$field]};
|
||||
if ($value == 'category_type')
|
||||
{
|
||||
$valuetoshow = yn($valuetoshow);
|
||||
}
|
||||
elseif ($valuetoshow=='all') {
|
||||
$valuetoshow=$langs->trans('All');
|
||||
elseif ($valuetoshow == 'all') {
|
||||
$valuetoshow = $langs->trans('All');
|
||||
}
|
||||
elseif ($fieldlist[$field]=='country') {
|
||||
elseif ($fieldlist[$field] == 'country') {
|
||||
if (empty($obj->country_code))
|
||||
{
|
||||
$valuetoshow='-';
|
||||
$valuetoshow = '-';
|
||||
}
|
||||
else
|
||||
{
|
||||
$key=$langs->trans("Country".strtoupper($obj->country_code));
|
||||
$valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country);
|
||||
$key = $langs->trans("Country".strtoupper($obj->country_code));
|
||||
$valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country);
|
||||
}
|
||||
}
|
||||
elseif ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_country') {
|
||||
$key=$langs->trans("Country".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_country') {
|
||||
$key = $langs->trans("Country".strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != "Country".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
|
||||
}
|
||||
elseif ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_availability') {
|
||||
elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_availability') {
|
||||
$langs->loadLangs(array("propal"));
|
||||
$key=$langs->trans("AvailabilityType".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "AvailabilityType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
$key = $langs->trans("AvailabilityType".strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != "AvailabilityType".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
|
||||
}
|
||||
elseif ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_actioncomm') {
|
||||
$key=$langs->trans("Action".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "Action".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||
elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_actioncomm') {
|
||||
$key = $langs->trans("Action".strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != "Action".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
|
||||
}
|
||||
elseif ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') {
|
||||
$showfield=0;
|
||||
elseif ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') {
|
||||
$showfield = 0;
|
||||
}
|
||||
|
||||
$class='tddict';
|
||||
$class = 'tddict';
|
||||
// Show value for field
|
||||
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'">'.$valuetoshow.'</td>';
|
||||
}
|
||||
}
|
||||
|
||||
// Can an entry be erased or disabled ?
|
||||
$iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default
|
||||
$iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
|
||||
if (isset($obj->code))
|
||||
{
|
||||
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) { $iserasable = 0; $canbedisabled = 0; }
|
||||
}
|
||||
|
||||
$canbemodified=$iserasable;
|
||||
$canbemodified = $iserasable;
|
||||
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
|
||||
if ($param) $url .= '&'.$param;
|
||||
$url.='&';
|
||||
$url .= '&';
|
||||
|
||||
// Active
|
||||
print '<td class="center" class="nowrap">';
|
||||
@@ -865,38 +865,38 @@ $db->close();
|
||||
*/
|
||||
function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
{
|
||||
global $conf,$langs,$db;
|
||||
global $conf, $langs, $db;
|
||||
global $form, $mysoc;
|
||||
global $region_id;
|
||||
global $elementList,$sourceList,$localtax_typeList;
|
||||
global $elementList, $sourceList, $localtax_typeList;
|
||||
global $bc;
|
||||
|
||||
$formadmin = new FormAdmin($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
|
||||
if (!empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
|
||||
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
if ($fieldlist[$field] == 'country')
|
||||
{
|
||||
print '<td>';
|
||||
$fieldname='country';
|
||||
$fieldname = 'country';
|
||||
if ($context == 'add')
|
||||
{
|
||||
$fieldname='country_id';
|
||||
$fieldname = 'country_id';
|
||||
print $form->select_country(GETPOST('country_id', 'int'), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||
}
|
||||
else
|
||||
{
|
||||
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:$mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||
print $form->select_country((!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : $mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'country_id')
|
||||
{
|
||||
if (! in_array('country', $fieldlist)) // If there is already a field country, we don't show country_id (avoid duplicate)
|
||||
if (!in_array('country', $fieldlist)) // If there is already a field country, we don't show country_id (avoid duplicate)
|
||||
{
|
||||
$country_id = (! empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : 0);
|
||||
$country_id = (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : 0);
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$country_id.'">';
|
||||
print '</td>';
|
||||
@@ -904,21 +904,21 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'category_type') {
|
||||
print '<td>';
|
||||
print $form->selectyesno($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 1);
|
||||
print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1);
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
|
||||
print '<td><input type="text" class="flat minwidth100" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
|
||||
print '<td><input type="text" class="flat minwidth100" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
$size=''; $class='';
|
||||
if ($fieldlist[$field]=='code') $class='maxwidth100';
|
||||
if ($fieldlist[$field]=='position') $class='maxwidth50';
|
||||
if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent';
|
||||
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='category_type') $size='size="2" ';
|
||||
print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||
$size = ''; $class = '';
|
||||
if ($fieldlist[$field] == 'code') $class = 'maxwidth100';
|
||||
if ($fieldlist[$field] == 'position') $class = 'maxwidth50';
|
||||
if ($fieldlist[$field] == 'libelle') $class = 'quatrevingtpercent';
|
||||
if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'category_type') $size = 'size="2" ';
|
||||
print '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,12 +30,12 @@
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("compta","bills","admin","accountancy","salaries","loan"));
|
||||
$langs->loadLangs(array("compta", "bills", "admin", "accountancy", "salaries", "loan"));
|
||||
|
||||
// Security check
|
||||
if (empty($user->rights->accounting->chartofaccount))
|
||||
@@ -97,12 +97,12 @@ if (GETPOST('change_chart', 'alpha'))
|
||||
{
|
||||
$chartofaccounts = GETPOST('chartofaccounts', 'int');
|
||||
|
||||
if (! empty($chartofaccounts)) {
|
||||
if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) {
|
||||
$error ++;
|
||||
if (!empty($chartofaccounts)) {
|
||||
if (!dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,8 +153,8 @@ print load_fiche_titre($langs->trans('MenuDefaultAccounts'), $linkback, 'title_a
|
||||
print '<span class="opacitymedium">'.$langs->trans("DefaultBindingDesc").'</span><br>';
|
||||
print '<br>';
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
|
||||
@@ -166,14 +166,14 @@ foreach ($list_account_main as $key) {
|
||||
print '<tr class="oddeven value">';
|
||||
// Param
|
||||
$label = $langs->trans($key);
|
||||
$keydesc=$key.'_Desc';
|
||||
$keydesc = $key.'_Desc';
|
||||
|
||||
$htmltext = $langs->trans($keydesc);
|
||||
print '<td class="fieldrequired" width="50%">';
|
||||
print $form->textwithpicto($label, $htmltext);
|
||||
print '</td>';
|
||||
// Value
|
||||
print '<td>'; // Do not force class=right, or it align also the content of the select box
|
||||
print '<td>'; // Do not force class=right, or it align also the content of the select box
|
||||
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@@ -211,7 +211,7 @@ foreach ($list_account as $key) {
|
||||
print "</table>\n";
|
||||
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="button"></div>';
|
||||
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
@@ -32,13 +32,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("admin","compta","accountancy"));
|
||||
$langs->loadLangs(array("admin", "compta", "accountancy"));
|
||||
|
||||
$action=GETPOST('action', 'aZ09')?GETPOST('action', 'aZ09'):'view';
|
||||
$confirm=GETPOST('confirm', 'alpha');
|
||||
$id=35;
|
||||
$rowid=GETPOST('rowid', 'alpha');
|
||||
$code=GETPOST('code', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view';
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$id = 35;
|
||||
$rowid = GETPOST('rowid', 'alpha');
|
||||
$code = GETPOST('code', 'alpha');
|
||||
|
||||
// Security access
|
||||
if (empty($user->rights->accounting->chartofaccount))
|
||||
@@ -51,19 +51,19 @@ $acts[1] = "disable";
|
||||
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$actl[1] = img_picto($langs->trans("Activated"), 'switch_on');
|
||||
|
||||
$listoffset=GETPOST('listoffset', 'alpha');
|
||||
$listlimit=GETPOST('listlimit', 'int')>0?GETPOST('listlimit', 'int'):1000;
|
||||
$listoffset = GETPOST('listoffset', 'alpha');
|
||||
$listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000;
|
||||
$active = 1;
|
||||
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $listlimit * $page ;
|
||||
$offset = $listlimit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (empty($sortfield)) $sortfield='code';
|
||||
if (empty($sortorder)) $sortorder='ASC';
|
||||
if (empty($sortfield)) $sortfield = 'code';
|
||||
if (empty($sortorder)) $sortorder = 'ASC';
|
||||
|
||||
$error = 0;
|
||||
|
||||
@@ -74,52 +74,52 @@ $hookmanager->initHooks(array('admin'));
|
||||
// Put here declaration of dictionaries properties
|
||||
|
||||
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
|
||||
$taborder=array(35);
|
||||
$taborder = array(35);
|
||||
|
||||
// Name of SQL tables of dictionaries
|
||||
$tabname=array();
|
||||
$tabname[35]= MAIN_DB_PREFIX."accounting_journal";
|
||||
$tabname = array();
|
||||
$tabname[35] = MAIN_DB_PREFIX."accounting_journal";
|
||||
|
||||
// Dictionary labels
|
||||
$tablib=array();
|
||||
$tablib[35]= "DictionaryAccountancyJournal";
|
||||
$tablib = array();
|
||||
$tablib[35] = "DictionaryAccountancyJournal";
|
||||
|
||||
// Requests to extract data
|
||||
$tabsql=array();
|
||||
$tabsql[35]= "SELECT a.rowid as rowid, a.code as code, a.label, a.nature, a.active FROM ".MAIN_DB_PREFIX."accounting_journal as a";
|
||||
$tabsql = array();
|
||||
$tabsql[35] = "SELECT a.rowid as rowid, a.code as code, a.label, a.nature, a.active FROM ".MAIN_DB_PREFIX."accounting_journal as a";
|
||||
|
||||
// Criteria to sort dictionaries
|
||||
$tabsqlsort=array();
|
||||
$tabsqlsort[35]="code ASC";
|
||||
$tabsqlsort = array();
|
||||
$tabsqlsort[35] = "code ASC";
|
||||
|
||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||
$tabfield=array();
|
||||
$tabfield[35]= "code,label,nature";
|
||||
$tabfield = array();
|
||||
$tabfield[35] = "code,label,nature";
|
||||
|
||||
// Nom des champs d'edition pour modification d'un enregistrement
|
||||
$tabfieldvalue=array();
|
||||
$tabfieldvalue[35]= "code,label,nature";
|
||||
$tabfieldvalue = array();
|
||||
$tabfieldvalue[35] = "code,label,nature";
|
||||
|
||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||
$tabfieldinsert=array();
|
||||
$tabfieldinsert[35]= "code,label,nature";
|
||||
$tabfieldinsert = array();
|
||||
$tabfieldinsert[35] = "code,label,nature";
|
||||
|
||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
||||
// Example: "" if id field is "rowid" and has autoincrement on
|
||||
// "nameoffield" if id field is not "rowid" or has not autoincrement on
|
||||
$tabrowid=array();
|
||||
$tabrowid[35]= "";
|
||||
$tabrowid = array();
|
||||
$tabrowid[35] = "";
|
||||
|
||||
// Condition to show dictionary in setup page
|
||||
$tabcond=array();
|
||||
$tabcond[35]= ! empty($conf->accounting->enabled);
|
||||
$tabcond = array();
|
||||
$tabcond[35] = !empty($conf->accounting->enabled);
|
||||
|
||||
// List of help for fields
|
||||
$tabhelp=array();
|
||||
$tabhelp = array();
|
||||
$tabhelp[35] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
|
||||
// List of check for fields (NOT USED YET)
|
||||
$tabfieldcheck=array();
|
||||
$tabfieldcheck = array();
|
||||
$tabfieldcheck[35] = array();
|
||||
|
||||
// Complete all arrays with entries found into modules
|
||||
@@ -151,25 +151,25 @@ if (GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x',
|
||||
// Actions add or modify an entry into a dictionary
|
||||
if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
{
|
||||
$listfield=explode(',', str_replace(' ', '', $tabfield[$id]));
|
||||
$listfieldinsert=explode(',', $tabfieldinsert[$id]);
|
||||
$listfieldmodify=explode(',', $tabfieldinsert[$id]);
|
||||
$listfieldvalue=explode(',', $tabfieldvalue[$id]);
|
||||
$listfield = explode(',', str_replace(' ', '', $tabfield[$id]));
|
||||
$listfieldinsert = explode(',', $tabfieldinsert[$id]);
|
||||
$listfieldmodify = explode(',', $tabfieldinsert[$id]);
|
||||
$listfieldvalue = explode(',', $tabfieldvalue[$id]);
|
||||
|
||||
// Check that all fields are filled
|
||||
$ok=1;
|
||||
$ok = 1;
|
||||
foreach ($listfield as $f => $value)
|
||||
{
|
||||
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
|
||||
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey = 'Label';
|
||||
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
|
||||
if ($fieldnamekey == 'nature') $fieldnamekey = 'NatureOfJournal';
|
||||
}
|
||||
// Other checks
|
||||
if (isset($_POST["code"]))
|
||||
{
|
||||
if ($_POST["code"]=='0')
|
||||
if ($_POST["code"] == '0')
|
||||
{
|
||||
$ok=0;
|
||||
$ok = 0;
|
||||
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
|
||||
}
|
||||
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
||||
@@ -178,16 +178,16 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
|
||||
}*/
|
||||
}
|
||||
if (! GETPOST('label', 'alpha'))
|
||||
if (!GETPOST('label', 'alpha'))
|
||||
{
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors');
|
||||
$ok=0;
|
||||
$ok = 0;
|
||||
}
|
||||
|
||||
// Clean some parameters
|
||||
if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"]=''; // If empty, we force to null
|
||||
if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"]=''; // If empty, we force to null
|
||||
if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null
|
||||
if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"] = ''; // If empty, we force to null
|
||||
if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"] = ''; // If empty, we force to null
|
||||
if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"] = ''; // If empty, we force to null
|
||||
|
||||
// Si verif ok et action add, on ajoute la ligne
|
||||
if ($ok && GETPOST('actionadd', 'alpha'))
|
||||
@@ -195,13 +195,13 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
if ($tabrowid[$id])
|
||||
{
|
||||
// Recupere id libre pour insertion
|
||||
$newid=0;
|
||||
$newid = 0;
|
||||
$sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id];
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$newid=($obj->newid + 1);
|
||||
$newid = ($obj->newid + 1);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
@@ -210,34 +210,34 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
// Add new entry
|
||||
$sql = "INSERT INTO ".$tabname[$id]." (";
|
||||
// List of fields
|
||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id], $listfieldinsert))
|
||||
$sql.= $tabrowid[$id].",";
|
||||
$sql.= $tabfieldinsert[$id];
|
||||
$sql.=",active,entity)";
|
||||
$sql.= " VALUES(";
|
||||
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert))
|
||||
$sql .= $tabrowid[$id].",";
|
||||
$sql .= $tabfieldinsert[$id];
|
||||
$sql .= ",active,entity)";
|
||||
$sql .= " VALUES(";
|
||||
|
||||
// List of values
|
||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id], $listfieldinsert))
|
||||
$sql.= $newid.",";
|
||||
$i=0;
|
||||
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert))
|
||||
$sql .= $newid.",";
|
||||
$i = 0;
|
||||
foreach ($listfieldinsert as $f => $value)
|
||||
{
|
||||
if ($value == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($i) $sql.=",";
|
||||
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; // For vat, we want/accept code = ''
|
||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
if ($i) $sql .= ",";
|
||||
if ($_POST[$listfieldvalue[$i]] == '') $sql .= "null"; // For vat, we want/accept code = ''
|
||||
else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
$i++;
|
||||
}
|
||||
$sql.=",1,".$conf->entity.")";
|
||||
$sql .= ",1,".$conf->entity.")";
|
||||
|
||||
dol_syslog("actionadd", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) // Add is ok
|
||||
{
|
||||
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||
$_POST=array('id'=>$id); // Clean $_POST array, we keep only
|
||||
$_POST = array('id'=>$id); // Clean $_POST array, we keep only
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -253,16 +253,16 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
// Si verif ok et action modify, on modifie la ligne
|
||||
if ($ok && GETPOST('actionmodify', 'alpha'))
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
|
||||
// Modify entry
|
||||
$sql = "UPDATE ".$tabname[$id]." SET ";
|
||||
// Modifie valeur des champs
|
||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id], $listfieldmodify))
|
||||
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify))
|
||||
{
|
||||
$sql.= $tabrowid[$id]."=";
|
||||
$sql.= "'".$db->escape($rowid)."', ";
|
||||
$sql .= $tabrowid[$id]."=";
|
||||
$sql .= "'".$db->escape($rowid)."', ";
|
||||
}
|
||||
$i = 0;
|
||||
foreach ($listfieldmodify as $field)
|
||||
@@ -273,19 +273,19 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
elseif ($field == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($i) $sql.=",";
|
||||
$sql.= $field."=";
|
||||
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
if ($i) $sql .= ",";
|
||||
$sql .= $field."=";
|
||||
if ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10)) $sql .= "null"; // For vat, we want/accept code = ''
|
||||
else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
$i++;
|
||||
}
|
||||
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
|
||||
$sql.=" AND entity = ".$conf->entity;
|
||||
$sql .= " WHERE ".$rowidcol." = '".$rowid."'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
||||
dol_syslog("actionmodify", LOG_DEBUG);
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql)
|
||||
if (!$resql)
|
||||
{
|
||||
setEventMessages($db->error(), null, 'errors');
|
||||
}
|
||||
@@ -300,15 +300,15 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
|
||||
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
|
||||
$sql.=" AND entity = ".$conf->entity;
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
||||
dol_syslog("delete", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if (! $result)
|
||||
if (!$result)
|
||||
{
|
||||
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
|
||||
{
|
||||
@@ -324,8 +324,8 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
||||
// activate
|
||||
if ($action == $acts[0])
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
||||
@@ -333,7 +333,7 @@ if ($action == $acts[0])
|
||||
elseif ($code) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$code."'";
|
||||
}
|
||||
$sql.=" AND entity = ".$conf->entity;
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
@@ -345,8 +345,8 @@ if ($action == $acts[0])
|
||||
// disable
|
||||
if ($action == $acts[1])
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
||||
@@ -354,7 +354,7 @@ if ($action == $acts[1])
|
||||
elseif ($code) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$code."'";
|
||||
}
|
||||
$sql.=" AND entity = ".$conf->entity;
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
@@ -369,16 +369,16 @@ if ($action == $acts[1])
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formadmin=new FormAdmin($db);
|
||||
$formadmin = new FormAdmin($db);
|
||||
|
||||
llxHeader();
|
||||
|
||||
$titre=$langs->trans("DictionarySetup");
|
||||
$linkback='';
|
||||
$titre = $langs->trans("DictionarySetup");
|
||||
$linkback = '';
|
||||
if ($id)
|
||||
{
|
||||
$titre.=' - '.$langs->trans($tablib[$id]);
|
||||
$titlepicto='title_accountancy';
|
||||
$titre .= ' - '.$langs->trans($tablib[$id]);
|
||||
$titlepicto = 'title_accountancy';
|
||||
}
|
||||
|
||||
print load_fiche_titre($titre, $linkback, $titlepicto);
|
||||
@@ -387,7 +387,7 @@ print load_fiche_titre($titre, $linkback, $titlepicto);
|
||||
// Confirmation de la suppression de la ligne
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
|
||||
}
|
||||
//var_dump($elementList);
|
||||
|
||||
@@ -397,15 +397,15 @@ if ($action == 'delete')
|
||||
if ($id)
|
||||
{
|
||||
// Complete requete recherche valeurs avec critere de tri
|
||||
$sql=$tabsql[$id];
|
||||
$sql.= " WHERE a.entity = ".$conf->entity;
|
||||
$sql = $tabsql[$id];
|
||||
$sql .= " WHERE a.entity = ".$conf->entity;
|
||||
|
||||
// If sort order is "country", we use country_code instead
|
||||
if ($sortfield == 'country') $sortfield='country_code';
|
||||
$sql.=$db->order($sortfield, $sortorder);
|
||||
$sql.=$db->plimit($listlimit+1, $offset);
|
||||
if ($sortfield == 'country') $sortfield = 'country_code';
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
$sql .= $db->plimit($listlimit + 1, $offset);
|
||||
|
||||
$fieldlist=explode(',', $tabfield[$id]);
|
||||
$fieldlist = explode(',', $tabfield[$id]);
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@@ -417,9 +417,9 @@ if ($id)
|
||||
// Form to add a new line
|
||||
if ($tabname[$id])
|
||||
{
|
||||
$alabelisused=0;
|
||||
$alabelisused = 0;
|
||||
|
||||
$fieldlist=explode(',', $tabfield[$id]);
|
||||
$fieldlist = explode(',', $tabfield[$id]);
|
||||
|
||||
// Line for title
|
||||
print '<tr class="liste_titre">';
|
||||
@@ -427,27 +427,27 @@ if ($id)
|
||||
{
|
||||
// Determine le nom du champ par rapport aux noms possibles
|
||||
// dans les dictionnaires de donnees
|
||||
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||
$class="left";
|
||||
if ($fieldlist[$field]=='code') {
|
||||
$valuetoshow=$langs->trans("Code");
|
||||
$valuetoshow = ucfirst($fieldlist[$field]); // Par defaut
|
||||
$valuetoshow = $langs->trans($valuetoshow); // try to translate
|
||||
$class = "left";
|
||||
if ($fieldlist[$field] == 'code') {
|
||||
$valuetoshow = $langs->trans("Code");
|
||||
}
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') {
|
||||
$valuetoshow=$langs->trans("Label");
|
||||
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
|
||||
$valuetoshow = $langs->trans("Label");
|
||||
}
|
||||
if ($fieldlist[$field]=='nature') {
|
||||
$valuetoshow=$langs->trans("NatureOfJournal");
|
||||
if ($fieldlist[$field] == 'nature') {
|
||||
$valuetoshow = $langs->trans("NatureOfJournal");
|
||||
}
|
||||
|
||||
if ($valuetoshow != '') {
|
||||
print '<td class="'.$class.'">';
|
||||
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
elseif (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
|
||||
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
elseif (!empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
|
||||
else print $valuetoshow;
|
||||
print '</td>';
|
||||
}
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
||||
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1;
|
||||
}
|
||||
|
||||
print '<td>';
|
||||
@@ -468,14 +468,14 @@ if ($id)
|
||||
foreach ($fieldlist as $key=>$val)
|
||||
{
|
||||
if (GETPOST($val) != '')
|
||||
$obj->$val=GETPOST($val);
|
||||
$obj->$val = GETPOST($val);
|
||||
}
|
||||
}
|
||||
|
||||
$tmpaction = 'create';
|
||||
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook=$hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
@@ -487,31 +487,31 @@ if ($id)
|
||||
print '</td>';
|
||||
print "</tr>";
|
||||
|
||||
print '<tr><td colspan="7"> </td></tr>'; // Keep to have a line with enough height
|
||||
print '<tr><td colspan="7"> </td></tr>'; // Keep to have a line with enough height
|
||||
}
|
||||
|
||||
|
||||
|
||||
// List of available record in database
|
||||
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$param = '&id='.$id;
|
||||
if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id;
|
||||
if ($search_country_id > 0) $param .= '&search_country_id='.$search_country_id;
|
||||
$paramwithsearch = $param;
|
||||
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
|
||||
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
|
||||
if (GETPOST('from', 'alpha')) $paramwithsearch.= '&from='.GETPOST('from', 'alpha');
|
||||
if ($sortorder) $paramwithsearch .= '&sortorder='.$sortorder;
|
||||
if ($sortfield) $paramwithsearch .= '&sortfield='.$sortfield;
|
||||
if (GETPOST('from', 'alpha')) $paramwithsearch .= '&from='.GETPOST('from', 'alpha');
|
||||
|
||||
// There is several pages
|
||||
if ($num > $listlimit)
|
||||
{
|
||||
print '<tr class="none"><td class="right" colspan="'.(3+count($fieldlist)).'">';
|
||||
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
|
||||
print '<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).'">';
|
||||
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page + 1).'</span></li>');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@@ -536,10 +536,10 @@ if ($id)
|
||||
{
|
||||
// Determine le nom du champ par rapport aux noms possibles
|
||||
// dans les dictionnaires de donnees
|
||||
$showfield=1; // By defaut
|
||||
$class="left";
|
||||
$sortable=1;
|
||||
$valuetoshow='';
|
||||
$showfield = 1; // By defaut
|
||||
$class = "left";
|
||||
$sortable = 1;
|
||||
$valuetoshow = '';
|
||||
/*
|
||||
$tmparray=getLabelOfField($fieldlist[$field]);
|
||||
$showfield=$tmp['showfield'];
|
||||
@@ -547,24 +547,24 @@ if ($id)
|
||||
$align=$tmp['align'];
|
||||
$sortable=$tmp['sortable'];
|
||||
*/
|
||||
$valuetoshow=ucfirst($fieldlist[$field]); // By defaut
|
||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||
if ($fieldlist[$field]=='code') {
|
||||
$valuetoshow=$langs->trans("Code");
|
||||
$valuetoshow = ucfirst($fieldlist[$field]); // By defaut
|
||||
$valuetoshow = $langs->trans($valuetoshow); // try to translate
|
||||
if ($fieldlist[$field] == 'code') {
|
||||
$valuetoshow = $langs->trans("Code");
|
||||
}
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') {
|
||||
$valuetoshow=$langs->trans("Label");
|
||||
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
|
||||
$valuetoshow = $langs->trans("Label");
|
||||
}
|
||||
if ($fieldlist[$field]=='nature') {
|
||||
$valuetoshow=$langs->trans("NatureOfJournal");
|
||||
if ($fieldlist[$field] == 'nature') {
|
||||
$valuetoshow = $langs->trans("NatureOfJournal");
|
||||
}
|
||||
|
||||
// Affiche nom du champ
|
||||
if ($showfield) {
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "", $sortfield, $sortorder, $class.' ');
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "", $sortfield, $sortorder, $class.' ');
|
||||
}
|
||||
}
|
||||
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, 'center ');
|
||||
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, 'center ');
|
||||
print getTitleFieldOfList('');
|
||||
print getTitleFieldOfList('');
|
||||
print getTitleFieldOfList('');
|
||||
@@ -578,12 +578,12 @@ if ($id)
|
||||
$obj = $db->fetch_object($resql);
|
||||
//print_r($obj);
|
||||
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
||||
if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code)))
|
||||
if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code)))
|
||||
{
|
||||
$tmpaction='edit';
|
||||
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook=$hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
$tmpaction = 'edit';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
|
||||
// Show fields
|
||||
if (empty($reshook)) fieldListJournal($fieldlist, $obj, $tabname[$id], 'edit');
|
||||
@@ -593,44 +593,44 @@ if ($id)
|
||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>';
|
||||
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmpaction = 'view';
|
||||
$parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook=$hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
$langs->load("accountancy");
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
$showfield=1;
|
||||
$class="left";
|
||||
$valuetoshow=$obj->{$fieldlist[$field]};
|
||||
if ($valuetoshow=='all') {
|
||||
$valuetoshow=$langs->trans('All');
|
||||
$showfield = 1;
|
||||
$class = "left";
|
||||
$valuetoshow = $obj->{$fieldlist[$field]};
|
||||
if ($valuetoshow == 'all') {
|
||||
$valuetoshow = $langs->trans('All');
|
||||
}
|
||||
elseif ($fieldlist[$field]=='nature' && $tabname[$id]==MAIN_DB_PREFIX.'accounting_journal') {
|
||||
$key=$langs->trans("AccountingJournalType".strtoupper($obj->nature));
|
||||
$valuetoshow=($obj->nature && $key != "AccountingJournalType".strtoupper($langs->trans($obj->nature))?$key:$obj->{$fieldlist[$field]});
|
||||
elseif ($fieldlist[$field] == 'nature' && $tabname[$id] == MAIN_DB_PREFIX.'accounting_journal') {
|
||||
$key = $langs->trans("AccountingJournalType".strtoupper($obj->nature));
|
||||
$valuetoshow = ($obj->nature && $key != "AccountingJournalType".strtoupper($langs->trans($obj->nature)) ? $key : $obj->{$fieldlist[$field]});
|
||||
}
|
||||
elseif ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'accounting_journal') {
|
||||
$valuetoshow=$langs->trans($obj->label);
|
||||
elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'accounting_journal') {
|
||||
$valuetoshow = $langs->trans($obj->label);
|
||||
}
|
||||
|
||||
$class='tddict';
|
||||
$class = 'tddict';
|
||||
// Show value for field
|
||||
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'">'.$valuetoshow.'</td>';
|
||||
}
|
||||
}
|
||||
|
||||
// Can an entry be erased or disabled ?
|
||||
$iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default
|
||||
$iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
|
||||
if (isset($obj->code) && $id != 10) {
|
||||
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) {
|
||||
$iserasable = 0;
|
||||
@@ -644,11 +644,11 @@ if ($id)
|
||||
}
|
||||
}
|
||||
|
||||
$canbemodified=$iserasable;
|
||||
$canbemodified = $iserasable;
|
||||
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
|
||||
if ($param) $url .= '&'.$param;
|
||||
$url.='&';
|
||||
$url .= '&';
|
||||
|
||||
// Active
|
||||
print '<td class="nowrap center">';
|
||||
@@ -708,10 +708,10 @@ $db->close();
|
||||
*/
|
||||
function fieldListJournal($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
{
|
||||
global $conf,$langs,$db;
|
||||
global $conf, $langs, $db;
|
||||
global $form, $mysoc;
|
||||
global $region_id;
|
||||
global $elementList,$sourceList,$localtax_typeList;
|
||||
global $elementList, $sourceList, $localtax_typeList;
|
||||
global $bc;
|
||||
|
||||
$formadmin = new FormAdmin($db);
|
||||
@@ -722,20 +722,20 @@ function fieldListJournal($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
if ($fieldlist[$field] == 'nature')
|
||||
{
|
||||
print '<td>';
|
||||
print $form->selectarray('nature', $sourceList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
|
||||
print $form->selectarray('nature', $sourceList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''));
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
|
||||
print '<td><input type="text" class="flat minwidth100" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
|
||||
print '<td><input type="text" class="flat minwidth100" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
$size=''; $class='';
|
||||
if ($fieldlist[$field]=='code') $class='maxwidth100';
|
||||
if ($fieldlist[$field]=='label') $class='quatrevingtpercent';
|
||||
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" ';
|
||||
print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||
$size = ''; $class = '';
|
||||
if ($fieldlist[$field] == 'code') $class = 'maxwidth100';
|
||||
if ($fieldlist[$field] == 'label') $class = 'quatrevingtpercent';
|
||||
if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'sens' || $fieldlist[$field] == 'category_type') $size = 'size="2" ';
|
||||
print '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,14 +25,14 @@
|
||||
* \brief List operation of book keeping
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("accountancy"));
|
||||
@@ -107,12 +107,12 @@ $formaccounting = new FormAccounting($db);
|
||||
$formother = new FormOther($db);
|
||||
$form = new Form($db);
|
||||
|
||||
if (! in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction']) && GETPOST('page', 'int') == '' && ! GETPOST('noreset', 'int') && $user->rights->accounting->mouvements->export)
|
||||
if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !isset($_POST['begin']) && !isset($_GET['begin']) && !isset($_POST['formfilteraction']) && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->rights->accounting->mouvements->export)
|
||||
{
|
||||
if (empty($search_date_start) && empty($search_date_end) && ! GETPOSTISSET('restore_lastsearch_values'))
|
||||
if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('restore_lastsearch_values'))
|
||||
{
|
||||
$query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
|
||||
$query.= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1";
|
||||
$query .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1";
|
||||
$res = $db->query($query);
|
||||
|
||||
if ($res->num_rows > 0) {
|
||||
@@ -155,7 +155,7 @@ $arrayfields = array(
|
||||
|
||||
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']);
|
||||
|
||||
$listofformat=AccountancyExport::getType();
|
||||
$listofformat = AccountancyExport::getType();
|
||||
$formatexportset = $conf->global->ACCOUNTING_EXPORT_MODELCSV;
|
||||
if (empty($listofformat[$formatexportset])) $formatexportset = 1;
|
||||
|
||||
@@ -351,7 +351,7 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme
|
||||
}
|
||||
|
||||
// Make a redirect to avoid to launch the delete later after a back button
|
||||
header("Location: list.php".($param?'?'.$param:''));
|
||||
header("Location: list.php".($param ? '?'.$param : ''));
|
||||
exit;
|
||||
}
|
||||
else
|
||||
@@ -372,15 +372,15 @@ if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->suppri
|
||||
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
|
||||
}
|
||||
|
||||
header("Location: list.php?noreset=1".($param?'&'.$param:''));
|
||||
header("Location: list.php?noreset=1".($param ? '&'.$param : ''));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if ($action == 'setreexport') {
|
||||
$setreexport = GETPOST('value', 'int');
|
||||
if (! dolibarr_set_const($db, "ACCOUNTING_REEXPORT", $setreexport, 'yesno', 0, '', $conf->entity)) $error++;
|
||||
if (!dolibarr_set_const($db, "ACCOUNTING_REEXPORT", $setreexport, 'yesno', 0, '', $conf->entity)) $error++;
|
||||
|
||||
if (! $error) {
|
||||
if (!$error) {
|
||||
if ($conf->global->ACCOUNTING_REEXPORT == 1) {
|
||||
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsEnable"), null, 'mesgs');
|
||||
} else {
|
||||
@@ -421,27 +421,27 @@ $sql .= " t.piece_num,";
|
||||
$sql .= " t.date_creation,";
|
||||
$sql .= " t.tms as date_modification,";
|
||||
$sql .= " t.date_export";
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $object->table_element . ' as t';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.' as t';
|
||||
// Manage filter
|
||||
$sqlwhere = array ();
|
||||
$sqlwhere = array();
|
||||
if (count($filter) > 0) {
|
||||
foreach ($filter as $key => $value) {
|
||||
if ($key == 't.doc_date') {
|
||||
$sqlwhere[] = $key . '=\'' . $db->idate($value) . '\'';
|
||||
$sqlwhere[] = $key.'=\''.$db->idate($value).'\'';
|
||||
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
|
||||
$sqlwhere[] = $key . '\'' . $db->idate($value) . '\'';
|
||||
$sqlwhere[] = $key.'\''.$db->idate($value).'\'';
|
||||
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') {
|
||||
$sqlwhere[] = $key . '\'' . $db->escape($value) . '\'';
|
||||
$sqlwhere[] = $key.'\''.$db->escape($value).'\'';
|
||||
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
|
||||
$sqlwhere[] = $key . '=' . $value;
|
||||
$sqlwhere[] = $key.'='.$value;
|
||||
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
|
||||
$sqlwhere[] = $key . ' LIKE \'' . $db->escape($value) . '%\'';
|
||||
$sqlwhere[] = $key.' LIKE \''.$db->escape($value).'%\'';
|
||||
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
|
||||
$sqlwhere[] = $key . '\'' . $db->idate($value) . '\'';
|
||||
$sqlwhere[] = $key.'\''.$db->idate($value).'\'';
|
||||
} elseif ($key == 't.tms>=' || $key == 't.tms<=') {
|
||||
$sqlwhere[] = $key . '\'' . $db->idate($value) . '\'';
|
||||
$sqlwhere[] = $key.'\''.$db->idate($value).'\'';
|
||||
} elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
|
||||
$sqlwhere[] = $key . '\'' . $db->idate($value) . '\'';
|
||||
$sqlwhere[] = $key.'\''.$db->idate($value).'\'';
|
||||
} elseif ($key == 't.credit' || $key == 't.debit') {
|
||||
$sqlwhere[] = natural_search($key, $value, 1, 1);
|
||||
} else {
|
||||
@@ -449,14 +449,14 @@ if (count($filter) > 0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql.= ' WHERE t.entity IN (' . getEntity('accountancy') . ')';
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity('accountancy').')';
|
||||
if ($conf->global->ACCOUNTING_REEXPORT == 0) {
|
||||
$sql .= " AND t.date_export IS NULL";
|
||||
}
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' AND ' . implode(' AND ', $sqlwhere);
|
||||
$sql .= ' AND '.implode(' AND ', $sqlwhere);
|
||||
}
|
||||
if (! empty($sortfield)) {
|
||||
if (!empty($sortfield)) {
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
}
|
||||
//print $sql;
|
||||
@@ -478,14 +478,14 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) {
|
||||
$accountancyexport = new AccountancyExport($db);
|
||||
$accountancyexport->export($object->lines, $formatexportset);
|
||||
|
||||
if (! empty($accountancyexport->errors))
|
||||
if (!empty($accountancyexport->errors))
|
||||
{
|
||||
setEventMessages('', $accountancyexport->errors, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
// Specify as export : update field date_export
|
||||
$error=0;
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
|
||||
if (is_array($object->lines))
|
||||
@@ -494,13 +494,13 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) {
|
||||
{
|
||||
$now = dol_now();
|
||||
|
||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping";
|
||||
$sql .= " SET date_export = '" . $db->idate($now) . "'";
|
||||
$sql .= " WHERE rowid = " . $movement->id;
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
|
||||
$sql .= " SET date_export = '".$db->idate($now)."'";
|
||||
$sql .= " WHERE rowid = ".$movement->id;
|
||||
|
||||
dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=" . $sql, LOG_DEBUG);
|
||||
dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=".$sql, LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if (! $result)
|
||||
if (!$result)
|
||||
{
|
||||
$error++;
|
||||
break;
|
||||
@@ -508,7 +508,7 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) {
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
// setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExported"), null, 'mesgs');
|
||||
@@ -550,10 +550,10 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if (! $resql)
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
@@ -574,7 +574,7 @@ if ($action == 'delmouv') {
|
||||
print $formconfirm;
|
||||
}
|
||||
if ($action == 'delbookkeepingyear') {
|
||||
$form_question = array ();
|
||||
$form_question = array();
|
||||
$delyear = GETPOST('delyear');
|
||||
$deljournal = GETPOST('deljournal');
|
||||
|
||||
@@ -604,10 +604,10 @@ if ($action == 'delbookkeepingyear') {
|
||||
}
|
||||
|
||||
//$param=''; param started before
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@@ -620,27 +620,27 @@ if (count($filter)) $buttonLabel = $langs->trans("ExportFilteredList");
|
||||
else $buttonLabel = $langs->trans("ExportList");
|
||||
|
||||
// Button re-export
|
||||
if (! empty($conf->global->ACCOUNTING_REEXPORT)) {
|
||||
$newcardbutton ='<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&value=0'.($param?'&'.$param:'').'">'.img_picto($langs->trans("Activated"), 'switch_on').'</a> ';
|
||||
if (!empty($conf->global->ACCOUNTING_REEXPORT)) {
|
||||
$newcardbutton = '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&value=0'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Activated"), 'switch_on').'</a> ';
|
||||
} else {
|
||||
$newcardbutton ='<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&value=1'.($param?'&'.$param:'').'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a> ';
|
||||
$newcardbutton = '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&value=1'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a> ';
|
||||
}
|
||||
$newcardbutton.= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>';
|
||||
$newcardbutton .= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>';
|
||||
|
||||
$newcardbutton.= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:''), $user->rights->accounting->mouvements->export);
|
||||
$newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param ? '&'.$param : ''), $user->rights->accounting->mouvements->export);
|
||||
|
||||
$newcardbutton.= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param);
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param);
|
||||
|
||||
$newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create', '', $user->rights->accounting->mouvements->creer);
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create', '', $user->rights->accounting->mouvements->creer);
|
||||
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit);
|
||||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||
else $moreforfilter = $hookmanager->resPrint;
|
||||
|
||||
@@ -720,111 +720,111 @@ if (!empty($arrayfields['t.subledger_account']['checked']))
|
||||
print '</td>';
|
||||
}
|
||||
// Label operation
|
||||
if (! empty($arrayfields['t.label_operation']['checked']))
|
||||
if (!empty($arrayfields['t.label_operation']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" size="7" class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/>';
|
||||
print '<input type="text" size="7" class="flat" name="search_mvt_label" value="'.$search_mvt_label.'"/>';
|
||||
print '</td>';
|
||||
}
|
||||
// Debit
|
||||
if (! empty($arrayfields['t.debit']['checked']))
|
||||
if (!empty($arrayfields['t.debit']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Credit
|
||||
if (! empty($arrayfields['t.credit']['checked']))
|
||||
if (!empty($arrayfields['t.credit']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Lettering code
|
||||
if (! empty($arrayfields['t.lettering_code']['checked']))
|
||||
if (!empty($arrayfields['t.lettering_code']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<input type="text" size="3" class="flat" name="search_lettering_code" value="' . $search_lettering_code . '"/>';
|
||||
print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.'"/>';
|
||||
print '</td>';
|
||||
}
|
||||
// Code journal
|
||||
if (! empty($arrayfields['t.code_journal']['checked']))
|
||||
if (!empty($arrayfields['t.code_journal']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
|
||||
print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="'.$search_ledger_code.'"></td>';
|
||||
}
|
||||
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$parameters = array('arrayfields'=>$arrayfields);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
// Date creation
|
||||
if (! empty($arrayfields['t.date_creation']['checked']))
|
||||
if (!empty($arrayfields['t.date_creation']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_date_creation_start, 'date_creation_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_date_creation_end, 'date_creation_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['t.tms']['checked']))
|
||||
if (!empty($arrayfields['t.tms']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_date_modification_start, 'date_modification_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_date_modification_end, 'date_modification_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
// Date export
|
||||
if (! empty($arrayfields['t.date_export']['checked']))
|
||||
if (!empty($arrayfields['t.date_export']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_date_export_start, 'date_export_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_date_export_end, 'date_export_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre center">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (! empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.numero_compte']['checked'])) print_liste_field_titre($arrayfields['t.numero_compte']['label'], $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.subledger_account']['checked'])) print_liste_field_titre($arrayfields['t.subledger_account']['label'], $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (! empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (! empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (! empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['t.numero_compte']['checked'])) print_liste_field_titre($arrayfields['t.numero_compte']['label'], $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['t.subledger_account']['checked'])) print_liste_field_titre($arrayfields['t.subledger_account']['label'], $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (!empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (!empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
// Hook fields
|
||||
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['t.date_creation']['checked'])) print_liste_field_titre($arrayfields['t.date_creation']['label'], $_SERVER['PHP_SELF'], "t.date_creation", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], "t.tms", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (! empty($arrayfields['t.date_export']['checked'])) print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['t.date_creation']['checked'])) print_liste_field_titre($arrayfields['t.date_creation']['label'], $_SERVER['PHP_SELF'], "t.date_creation", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], "t.tms", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['t.date_export']['checked'])) print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
@@ -833,12 +833,12 @@ $line = new BookKeepingLine();
|
||||
|
||||
// Loop on record
|
||||
// --------------------------------------------------------------------
|
||||
$i=0;
|
||||
$totalarray=array();
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) break; // Should not happen
|
||||
if (empty($obj)) break; // Should not happen
|
||||
|
||||
$line->id = $obj->rowid;
|
||||
$line->doc_date = $db->jdate($obj->doc_date);
|
||||
@@ -1006,8 +1006,8 @@ print '</div>';
|
||||
|
||||
// TODO Replace this with mass delete action
|
||||
if ($user->rights->accounting->mouvements->supprimer_tous) {
|
||||
print '<div class="tabsAction tabsActionNoBottom">' . "\n";
|
||||
print '<a class="butActionDelete" name="button_delmvt" href="' . $_SERVER["PHP_SELF"] . '?action=delbookkeepingyear' . ($param ? '&' . $param : '') . '">' . $langs->trans("DeleteMvt") . '</a>';
|
||||
print '<div class="tabsAction tabsActionNoBottom">'."\n";
|
||||
print '<a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear'.($param ? '&'.$param : '').'">'.$langs->trans("DeleteMvt").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
* \brief Class accountancy export
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
|
||||
|
||||
/**
|
||||
* Manage the different format accountancy export
|
||||
@@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
|
||||
class AccountancyExport
|
||||
{
|
||||
// Type of export. Used into $conf->global->ACCOUNTING_EXPORT_MODELCSV
|
||||
public static $EXPORT_TYPE_CONFIGURABLE = 1; // CSV
|
||||
public static $EXPORT_TYPE_CONFIGURABLE = 1; // CSV
|
||||
public static $EXPORT_TYPE_AGIRIS = 10;
|
||||
public static $EXPORT_TYPE_EBP = 15;
|
||||
public static $EXPORT_TYPE_CEGID = 20;
|
||||
@@ -83,7 +83,7 @@ class AccountancyExport
|
||||
|
||||
$this->db = &$db;
|
||||
$this->separator = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$this->end_line = empty($conf->global->ACCOUNTING_EXPORT_ENDLINE)?"\n":($conf->global->ACCOUNTING_EXPORT_ENDLINE==1?"\n":"\r\n");
|
||||
$this->end_line = empty($conf->global->ACCOUNTING_EXPORT_ENDLINE) ? "\n" : ($conf->global->ACCOUNTING_EXPORT_ENDLINE == 1 ? "\n" : "\r\n");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -125,7 +125,7 @@ class AccountancyExport
|
||||
*/
|
||||
private static function getFormatCode($type)
|
||||
{
|
||||
$formatcode = array (
|
||||
$formatcode = array(
|
||||
self::$EXPORT_TYPE_CONFIGURABLE => 'csv',
|
||||
self::$EXPORT_TYPE_CEGID => 'cegid',
|
||||
self::$EXPORT_TYPE_COALA => 'coala',
|
||||
@@ -153,14 +153,14 @@ class AccountancyExport
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
return array (
|
||||
return array(
|
||||
'param' => array(
|
||||
self::$EXPORT_TYPE_CONFIGURABLE => array(
|
||||
'label' => $langs->trans('Modelcsv_configurable'),
|
||||
'ACCOUNTING_EXPORT_FORMAT' => empty($conf->global->ACCOUNTING_EXPORT_FORMAT)?'txt':$conf->global->ACCOUNTING_EXPORT_FORMAT,
|
||||
'ACCOUNTING_EXPORT_SEPARATORCSV' => empty($conf->global->ACCOUNTING_EXPORT_SEPARATORCSV)?',':$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV,
|
||||
'ACCOUNTING_EXPORT_ENDLINE' => empty($conf->global->ACCOUNTING_EXPORT_ENDLINE)?1:$conf->global->ACCOUNTING_EXPORT_ENDLINE,
|
||||
'ACCOUNTING_EXPORT_DATE' => empty($conf->global->ACCOUNTING_EXPORT_DATE)?'%d%m%Y':$conf->global->ACCOUNTING_EXPORT_DATE,
|
||||
'ACCOUNTING_EXPORT_FORMAT' => empty($conf->global->ACCOUNTING_EXPORT_FORMAT) ? 'txt' : $conf->global->ACCOUNTING_EXPORT_FORMAT,
|
||||
'ACCOUNTING_EXPORT_SEPARATORCSV' => empty($conf->global->ACCOUNTING_EXPORT_SEPARATORCSV) ? ',' : $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV,
|
||||
'ACCOUNTING_EXPORT_ENDLINE' => empty($conf->global->ACCOUNTING_EXPORT_ENDLINE) ? 1 : $conf->global->ACCOUNTING_EXPORT_ENDLINE,
|
||||
'ACCOUNTING_EXPORT_DATE' => empty($conf->global->ACCOUNTING_EXPORT_DATE) ? '%d%m%Y' : $conf->global->ACCOUNTING_EXPORT_DATE,
|
||||
),
|
||||
self::$EXPORT_TYPE_CEGID => array(
|
||||
'label' => $langs->trans('Modelcsv_CEGID'),
|
||||
@@ -209,11 +209,11 @@ class AccountancyExport
|
||||
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
|
||||
),
|
||||
),
|
||||
'cr'=> array (
|
||||
'cr'=> array(
|
||||
'1' => $langs->trans("Unix"),
|
||||
'2' => $langs->trans("Windows")
|
||||
),
|
||||
'format' => array (
|
||||
'format' => array(
|
||||
'csv' => $langs->trans("csv"),
|
||||
'txt' => $langs->trans("txt")
|
||||
),
|
||||
@@ -231,13 +231,13 @@ class AccountancyExport
|
||||
public function export(&$TData, $formatexportset)
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $search_date_end; // Used into /accountancy/tpl/export_journal.tpl.php
|
||||
global $search_date_end; // Used into /accountancy/tpl/export_journal.tpl.php
|
||||
|
||||
// Define name of file to save
|
||||
$filename = 'general_ledger-'.$this->getFormatCode($formatexportset);
|
||||
$type_export = 'general_ledger';
|
||||
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
|
||||
|
||||
|
||||
switch ($formatexportset) {
|
||||
@@ -303,13 +303,13 @@ class AccountancyExport
|
||||
$separator = ";";
|
||||
$end_line = "\n";
|
||||
|
||||
print $date . $separator;
|
||||
print $line->code_journal . $separator;
|
||||
print length_accountg($line->numero_compte) . $separator;
|
||||
print length_accounta($line->subledger_account) . $separator;
|
||||
print $line->sens . $separator;
|
||||
print price($line->montant) . $separator;
|
||||
print $line->label_operation . $separator;
|
||||
print $date.$separator;
|
||||
print $line->code_journal.$separator;
|
||||
print length_accountg($line->numero_compte).$separator;
|
||||
print length_accounta($line->subledger_account).$separator;
|
||||
print $line->sens.$separator;
|
||||
print price($line->montant).$separator;
|
||||
print $line->label_operation.$separator;
|
||||
print $line->doc_ref;
|
||||
print $end_line;
|
||||
}
|
||||
@@ -328,22 +328,22 @@ class AccountancyExport
|
||||
$separator = ";";
|
||||
$end_line = "\n";
|
||||
|
||||
print $line->code_journal . $separator;
|
||||
print $date . $separator;
|
||||
print $line->piece_num . $separator;
|
||||
print length_accountg($line->numero_compte) . $separator;
|
||||
print '' . $separator;
|
||||
print $line->label_operation . $separator;
|
||||
print $date . $separator;
|
||||
if ($line->sens=='D') {
|
||||
print price($line->montant) . $separator;
|
||||
print '' . $separator;
|
||||
}elseif ($line->sens=='C') {
|
||||
print '' . $separator;
|
||||
print price($line->montant) . $separator;
|
||||
print $line->code_journal.$separator;
|
||||
print $date.$separator;
|
||||
print $line->piece_num.$separator;
|
||||
print length_accountg($line->numero_compte).$separator;
|
||||
print ''.$separator;
|
||||
print $line->label_operation.$separator;
|
||||
print $date.$separator;
|
||||
if ($line->sens == 'D') {
|
||||
print price($line->montant).$separator;
|
||||
print ''.$separator;
|
||||
}elseif ($line->sens == 'C') {
|
||||
print ''.$separator;
|
||||
print price($line->montant).$separator;
|
||||
}
|
||||
print $line->doc_ref . $separator;
|
||||
print $line->label_operation . $separator;
|
||||
print $line->doc_ref.$separator;
|
||||
print $line->label_operation.$separator;
|
||||
print $end_line;
|
||||
}
|
||||
}
|
||||
@@ -362,15 +362,15 @@ class AccountancyExport
|
||||
|
||||
foreach ($objectLines as $line) {
|
||||
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
|
||||
print $date . $separator;
|
||||
print $line->code_journal . $separator;
|
||||
print length_accountg($line->numero_compte) . $separator;
|
||||
print $line->piece_num . $separator;
|
||||
print $line->doc_ref . $separator;
|
||||
print price($line->debit) . $separator;
|
||||
print price($line->credit) . $separator;
|
||||
print 'E' . $separator;
|
||||
print length_accountg($line->subledger_account) . $separator;
|
||||
print $date.$separator;
|
||||
print $line->code_journal.$separator;
|
||||
print length_accountg($line->numero_compte).$separator;
|
||||
print $line->piece_num.$separator;
|
||||
print $line->doc_ref.$separator;
|
||||
print price($line->debit).$separator;
|
||||
print price($line->credit).$separator;
|
||||
print 'E'.$separator;
|
||||
print length_accountg($line->subledger_account).$separator;
|
||||
print $end_line;
|
||||
}
|
||||
}
|
||||
@@ -389,26 +389,26 @@ class AccountancyExport
|
||||
$end_line = "\n";
|
||||
|
||||
foreach ($objectLines as $line) {
|
||||
print $line->piece_num . $separator;
|
||||
print $line->piece_num.$separator;
|
||||
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
|
||||
print $date . $separator;
|
||||
print $date.$separator;
|
||||
|
||||
if (empty($line->subledger_account)) {
|
||||
print 'G' . $separator;
|
||||
print length_accounta($line->numero_compte) . $separator;
|
||||
print 'G'.$separator;
|
||||
print length_accounta($line->numero_compte).$separator;
|
||||
} else {
|
||||
if (substr($line->numero_compte, 0, 3) == '411') {
|
||||
print 'C' . $separator;
|
||||
print 'C'.$separator;
|
||||
}
|
||||
if (substr($line->numero_compte, 0, 3) == '401') {
|
||||
print 'F' . $separator;
|
||||
print 'F'.$separator;
|
||||
}
|
||||
print length_accountg($line->subledger_account) . $separator;
|
||||
print length_accountg($line->subledger_account).$separator;
|
||||
}
|
||||
|
||||
print price($line->debit) . $separator;
|
||||
print price($line->credit) . $separator;
|
||||
print dol_trunc($line->label_operation, 32) . $separator;
|
||||
print price($line->debit).$separator;
|
||||
print price($line->credit).$separator;
|
||||
print dol_trunc($line->label_operation, 32).$separator;
|
||||
print $end_line;
|
||||
}
|
||||
}
|
||||
@@ -423,23 +423,23 @@ class AccountancyExport
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$end_line ="\r\n";
|
||||
$end_line = "\r\n";
|
||||
|
||||
$i = 1;
|
||||
$date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be yyyymmdd
|
||||
foreach ($TData as $data) {
|
||||
$code_compta = $data->numero_compte;
|
||||
if (! empty($data->subledger_account))
|
||||
if (!empty($data->subledger_account))
|
||||
$code_compta = $data->subledger_account;
|
||||
|
||||
$Tab = array ();
|
||||
$Tab = array();
|
||||
$Tab['num_ecriture'] = str_pad($i, 5);
|
||||
$Tab['code_journal'] = str_pad($data->code_journal, 2);
|
||||
$Tab['date_ecriture'] = $date_ecriture;
|
||||
$Tab['date_ope'] = dol_print_date($data->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||
$Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 12), 12);
|
||||
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 11), 11);
|
||||
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref) . dol_string_unaccent($data->label_operation), 25), 25);
|
||||
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).dol_string_unaccent($data->label_operation), 25), 25);
|
||||
$Tab['montant'] = str_pad(abs($data->montant), 13, ' ', STR_PAD_LEFT);
|
||||
$Tab['type_montant'] = str_pad($data->sens, 1);
|
||||
$Tab['vide'] = str_repeat(' ', 18);
|
||||
@@ -449,7 +449,7 @@ class AccountancyExport
|
||||
$Tab['end_line'] = $end_line;
|
||||
|
||||
print implode($Tab);
|
||||
$i ++;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -463,17 +463,17 @@ class AccountancyExport
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$end_line ="\r\n";
|
||||
$end_line = "\r\n";
|
||||
|
||||
//We should use dol_now function not time however this is wrong date to transfert in accounting
|
||||
//$date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
||||
//$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
||||
foreach ($TData as $data) {
|
||||
$code_compta = $data->numero_compte;
|
||||
if (! empty($data->subledger_account))
|
||||
if (!empty($data->subledger_account))
|
||||
$code_compta = $data->subledger_account;
|
||||
|
||||
$Tab = array ();
|
||||
$Tab = array();
|
||||
$Tab['type_ligne'] = 'M';
|
||||
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 8), 8);
|
||||
$Tab['code_journal'] = str_pad(self::trunc($data->code_journal, 2), 2);
|
||||
@@ -484,19 +484,19 @@ class AccountancyExport
|
||||
//$Tab['date_ecriture'] = $date_ecriture;
|
||||
$Tab['date_ecriture'] = dol_print_date($data->doc_date, '%d%m%y');
|
||||
$Tab['filler'] = ' ';
|
||||
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref) . ' ' . dol_string_unaccent($data->label_operation), 20), 20);
|
||||
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 20), 20);
|
||||
$Tab['sens'] = $data->sens; // C or D
|
||||
$Tab['signe_montant'] = '+';
|
||||
|
||||
//elarifr le montant doit etre en centimes sans point decimal !
|
||||
$Tab['montant'] = str_pad(abs($data->montant*100), 12, '0', STR_PAD_LEFT); // TODO manage negative amount
|
||||
$Tab['montant'] = str_pad(abs($data->montant * 100), 12, '0', STR_PAD_LEFT); // TODO manage negative amount
|
||||
// $Tab['montant'] = str_pad(abs($data->montant), 12, '0', STR_PAD_LEFT); // TODO manage negative amount
|
||||
$Tab['contrepartie'] = str_repeat(' ', 8);
|
||||
|
||||
// elarifr: date format must be fixed format : 6 char ddmmyy = %d%m%yand not defined by user / dolibarr setting
|
||||
if (! empty($data->date_echeance))
|
||||
if (!empty($data->date_echeance))
|
||||
//$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||
$Tab['date_echeance'] = dol_print_date($data->date_echeance, '%d%m%y'); // elarifr: format must be ddmmyy
|
||||
$Tab['date_echeance'] = dol_print_date($data->date_echeance, '%d%m%y'); // elarifr: format must be ddmmyy
|
||||
else
|
||||
$Tab['date_echeance'] = '000000';
|
||||
|
||||
@@ -551,20 +551,20 @@ class AccountancyExport
|
||||
foreach ($objectLines as $line) {
|
||||
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||
|
||||
print $line->id . $separator;
|
||||
print $date . $separator;
|
||||
print $line->code_journal . $separator;
|
||||
print $line->id.$separator;
|
||||
print $date.$separator;
|
||||
print $line->code_journal.$separator;
|
||||
if (empty($line->subledger_account)) {
|
||||
print $line->numero_compte . $separator;
|
||||
print $line->numero_compte.$separator;
|
||||
} else {
|
||||
print $line->subledger_account . $separator;
|
||||
print $line->subledger_account.$separator;
|
||||
}
|
||||
//print substr(length_accountg($line->numero_compte), 0, 2) . $separator;
|
||||
print '"'.dol_trunc($line->label_operation, 40, 'right', 'UTF-8', 1).'"' . $separator;
|
||||
print '"'.dol_trunc($line->label_operation, 40, 'right', 'UTF-8', 1).'"'.$separator;
|
||||
print '"'.dol_trunc($line->piece_num, 15, 'right', 'UTF-8', 1).'"'.$separator;
|
||||
print price2num(abs($line->montant)).$separator;
|
||||
print $line->sens.$separator;
|
||||
print $date . $separator;
|
||||
print $date.$separator;
|
||||
//print 'EUR';
|
||||
print $end_line;
|
||||
}
|
||||
@@ -586,25 +586,25 @@ class AccountancyExport
|
||||
foreach ($objectLines as $line) {
|
||||
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||
|
||||
print $line->piece_num . $separator;
|
||||
print self::toAnsi($line->label_operation) . $separator;
|
||||
print $date . $separator;
|
||||
print self::toAnsi($line->label_operation) . $separator;
|
||||
print $line->piece_num.$separator;
|
||||
print self::toAnsi($line->label_operation).$separator;
|
||||
print $date.$separator;
|
||||
print self::toAnsi($line->label_operation).$separator;
|
||||
|
||||
if (empty($line->subledger_account)) {
|
||||
print length_accountg($line->numero_compte) . $separator;
|
||||
print self::toAnsi($line->label_compte) . $separator;
|
||||
print length_accountg($line->numero_compte).$separator;
|
||||
print self::toAnsi($line->label_compte).$separator;
|
||||
} else {
|
||||
print length_accounta($line->subledger_account) . $separator;
|
||||
print self::toAnsi($line->subledger_label) . $separator;
|
||||
print length_accounta($line->subledger_account).$separator;
|
||||
print self::toAnsi($line->subledger_label).$separator;
|
||||
}
|
||||
|
||||
print self::toAnsi($line->doc_ref) . $separator;
|
||||
print price($line->debit) . $separator;
|
||||
print price($line->credit) . $separator;
|
||||
print price($line->montant) . $separator;
|
||||
print $line->sens . $separator;
|
||||
print $line->lettering_code . $separator;
|
||||
print self::toAnsi($line->doc_ref).$separator;
|
||||
print price($line->debit).$separator;
|
||||
print price($line->credit).$separator;
|
||||
print price($line->montant).$separator;
|
||||
print $line->sens.$separator;
|
||||
print $line->lettering_code.$separator;
|
||||
print $line->code_journal;
|
||||
print $end_line;
|
||||
}
|
||||
@@ -625,17 +625,17 @@ class AccountancyExport
|
||||
foreach ($objectLines as $line) {
|
||||
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
|
||||
|
||||
print $date . $separator;
|
||||
print $line->code_journal . $separator;
|
||||
print $date.$separator;
|
||||
print $line->code_journal.$separator;
|
||||
if (empty($line->subledger_account)) {
|
||||
print length_accountg($line->numero_compte) . $separator;
|
||||
print length_accountg($line->numero_compte).$separator;
|
||||
} else {
|
||||
print length_accounta($line->subledger_account) . $separator;
|
||||
print length_accounta($line->subledger_account).$separator;
|
||||
}
|
||||
print $line->doc_ref . $separator;
|
||||
print $line->label_operation . $separator;
|
||||
print price($line->debit) . $separator;
|
||||
print price($line->credit) . $separator;
|
||||
print $line->doc_ref.$separator;
|
||||
print $line->label_operation.$separator;
|
||||
print price($line->debit).$separator;
|
||||
print price($line->credit).$separator;
|
||||
|
||||
print $end_line;
|
||||
}
|
||||
@@ -668,7 +668,7 @@ class AccountancyExport
|
||||
$tab[] = price2num($line->montant);
|
||||
$tab[] = $line->code_journal;
|
||||
|
||||
print implode($separator, $tab) . $this->end_line;
|
||||
print implode($separator, $tab).$this->end_line;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -683,23 +683,23 @@ class AccountancyExport
|
||||
$separator = "\t";
|
||||
$end_line = "\n";
|
||||
|
||||
print "JournalCode" . $separator;
|
||||
print "JournalLib" . $separator;
|
||||
print "EcritureNum" . $separator;
|
||||
print "EcritureDate" . $separator;
|
||||
print "CompteNum" . $separator;
|
||||
print "CompteLib" . $separator;
|
||||
print "CompAuxNum" . $separator;
|
||||
print "CompAuxLib" . $separator;
|
||||
print "PieceRef" . $separator;
|
||||
print "PieceDate" . $separator;
|
||||
print "EcritureLib" . $separator;
|
||||
print "Debit" . $separator;
|
||||
print "Credit" . $separator;
|
||||
print "EcritureLet" . $separator;
|
||||
print "DateLet" . $separator;
|
||||
print "ValidDate" . $separator;
|
||||
print "Montantdevise" . $separator;
|
||||
print "JournalCode".$separator;
|
||||
print "JournalLib".$separator;
|
||||
print "EcritureNum".$separator;
|
||||
print "EcritureDate".$separator;
|
||||
print "CompteNum".$separator;
|
||||
print "CompteLib".$separator;
|
||||
print "CompAuxNum".$separator;
|
||||
print "CompAuxLib".$separator;
|
||||
print "PieceRef".$separator;
|
||||
print "PieceDate".$separator;
|
||||
print "EcritureLib".$separator;
|
||||
print "Debit".$separator;
|
||||
print "Credit".$separator;
|
||||
print "EcritureLet".$separator;
|
||||
print "DateLet".$separator;
|
||||
print "ValidDate".$separator;
|
||||
print "Montantdevise".$separator;
|
||||
print "Idevise";
|
||||
print $end_line;
|
||||
|
||||
@@ -709,55 +709,55 @@ class AccountancyExport
|
||||
$date_valid = dol_print_date($line->date_validated, '%d%m%Y');
|
||||
|
||||
// FEC:JournalCode
|
||||
print $line->code_journal . $separator;
|
||||
print $line->code_journal.$separator;
|
||||
|
||||
// FEC:JournalLib
|
||||
print $line->journal_label . $separator;
|
||||
print $line->journal_label.$separator;
|
||||
|
||||
// FEC:EcritureNum
|
||||
print $line->piece_num . $separator;
|
||||
print $line->piece_num.$separator;
|
||||
|
||||
// FEC:EcritureDate
|
||||
print $date_creation . $separator;
|
||||
print $date_creation.$separator;
|
||||
|
||||
// FEC:CompteNum
|
||||
print $line->numero_compte . $separator;
|
||||
print $line->numero_compte.$separator;
|
||||
|
||||
// FEC:CompteLib
|
||||
print $line->label_compte . $separator;
|
||||
print $line->label_compte.$separator;
|
||||
|
||||
// FEC:CompAuxNum
|
||||
print $line->subledger_account . $separator;
|
||||
print $line->subledger_account.$separator;
|
||||
|
||||
// FEC:CompAuxLib
|
||||
print $line->subledger_label . $separator;
|
||||
print $line->subledger_label.$separator;
|
||||
|
||||
// FEC:PieceRef
|
||||
print $line->doc_ref . $separator;
|
||||
print $line->doc_ref.$separator;
|
||||
|
||||
// FEC:PieceDate
|
||||
print $date_doc . $separator;
|
||||
print $date_doc.$separator;
|
||||
|
||||
// FEC:EcritureLib
|
||||
print $line->label_operation . $separator;
|
||||
print $line->label_operation.$separator;
|
||||
|
||||
// FEC:Debit
|
||||
print price2num($line->debit) . $separator;
|
||||
print price2num($line->debit).$separator;
|
||||
|
||||
// FEC:Credit
|
||||
print price2num($line->credit) . $separator;
|
||||
print price2num($line->credit).$separator;
|
||||
|
||||
// FEC:EcritureLet
|
||||
print $line->lettering_code . $separator;
|
||||
print $line->lettering_code.$separator;
|
||||
|
||||
// FEC:DateLet
|
||||
print $line->date_lettering . $separator;
|
||||
print $line->date_lettering.$separator;
|
||||
|
||||
// FEC:ValidDate
|
||||
print $date_valid . $separator;
|
||||
print $date_valid.$separator;
|
||||
|
||||
// FEC:Montantdevise
|
||||
print $line->multicurrency_amount . $separator;
|
||||
print $line->multicurrency_amount.$separator;
|
||||
|
||||
// FEC:Idevise
|
||||
print $line->multicurrency_code;
|
||||
@@ -785,121 +785,121 @@ class AccountancyExport
|
||||
// Print header line
|
||||
print "Blg,Datum,Kto,S/H,Grp,GKto,SId,SIdx,KIdx,BTyp,MTyp,Code,Netto,Steuer,FW-Betrag,Tx1,Tx2,PkKey,OpId,Flag";
|
||||
print $this->end_line;
|
||||
$thisPieceNum= "";
|
||||
$thisPieceAccountNr= "";
|
||||
$aSize= count($objectLines);
|
||||
$thisPieceNum = "";
|
||||
$thisPieceAccountNr = "";
|
||||
$aSize = count($objectLines);
|
||||
foreach ($objectLines as $aIndex=>$line)
|
||||
{
|
||||
$sammelBuchung= false;
|
||||
if ($aIndex-2 >= 0 && $objectLines[$aIndex-2]->piece_num == $line->piece_num)
|
||||
$sammelBuchung = false;
|
||||
if ($aIndex - 2 >= 0 && $objectLines[$aIndex - 2]->piece_num == $line->piece_num)
|
||||
{
|
||||
$sammelBuchung= true;
|
||||
$sammelBuchung = true;
|
||||
}
|
||||
elseif ($aIndex+2 < $aSize && $objectLines[$aIndex+2]->piece_num == $line->piece_num)
|
||||
elseif ($aIndex + 2 < $aSize && $objectLines[$aIndex + 2]->piece_num == $line->piece_num)
|
||||
{
|
||||
$sammelBuchung= true;
|
||||
$sammelBuchung = true;
|
||||
}
|
||||
elseif ($aIndex+1 < $aSize
|
||||
&& $objectLines[$aIndex+1]->piece_num == $line->piece_num
|
||||
&& $aIndex-1 < $aSize
|
||||
&& $objectLines[$aIndex-1]->piece_num == $line->piece_num
|
||||
elseif ($aIndex + 1 < $aSize
|
||||
&& $objectLines[$aIndex + 1]->piece_num == $line->piece_num
|
||||
&& $aIndex - 1 < $aSize
|
||||
&& $objectLines[$aIndex - 1]->piece_num == $line->piece_num
|
||||
)
|
||||
{
|
||||
$sammelBuchung= true;
|
||||
$sammelBuchung = true;
|
||||
}
|
||||
|
||||
//Blg
|
||||
print $line->piece_num . $this->separator;
|
||||
print $line->piece_num.$this->separator;
|
||||
|
||||
// Datum
|
||||
$date = dol_print_date($line->doc_date, '%d.%m.%Y');
|
||||
print $date . $this->separator;
|
||||
print $date.$this->separator;
|
||||
|
||||
// Kto
|
||||
print length_accountg($line->numero_compte) . $this->separator;
|
||||
print length_accountg($line->numero_compte).$this->separator;
|
||||
// S/H
|
||||
if ($line->sens == 'D')
|
||||
{
|
||||
print 'S' . $this->separator;
|
||||
print 'S'.$this->separator;
|
||||
}
|
||||
else
|
||||
{
|
||||
print 'H' . $this->separator;
|
||||
print 'H'.$this->separator;
|
||||
}
|
||||
//Grp
|
||||
print self::trunc($line->code_journal, 1) . $this->separator;
|
||||
print self::trunc($line->code_journal, 1).$this->separator;
|
||||
// GKto
|
||||
if (empty($line->code_tiers))
|
||||
{
|
||||
if ($line->piece_num == $thisPieceNum)
|
||||
{
|
||||
print length_accounta($thisPieceAccountNr) . $this->separator;
|
||||
print length_accounta($thisPieceAccountNr).$this->separator;
|
||||
}
|
||||
else
|
||||
{
|
||||
print "div" . $this->separator;
|
||||
print "div".$this->separator;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print length_accounta($line->code_tiers) . $this->separator;
|
||||
print length_accounta($line->code_tiers).$this->separator;
|
||||
}
|
||||
//SId
|
||||
print $this->separator;
|
||||
//SIdx
|
||||
print "0" . $this->separator;
|
||||
print "0".$this->separator;
|
||||
//KIdx
|
||||
print "0" . $this->separator;
|
||||
print "0".$this->separator;
|
||||
//BTyp
|
||||
print "0" . $this->separator;
|
||||
print "0".$this->separator;
|
||||
|
||||
//MTyp 1=Fibu Einzelbuchung 2=Sammebuchung
|
||||
if ($sammelBuchung)
|
||||
{
|
||||
print "2" . $this->separator;
|
||||
print "2".$this->separator;
|
||||
}
|
||||
else
|
||||
{
|
||||
print "1" . $this->separator;
|
||||
print "1".$this->separator;
|
||||
}
|
||||
// Code
|
||||
print '""' . $this->separator;
|
||||
print '""'.$this->separator;
|
||||
// Netto
|
||||
if ($line->montant >= 0)
|
||||
{
|
||||
print $line->montant . $this->separator;
|
||||
print $line->montant.$this->separator;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $line->montant*-1 . $this->separator;
|
||||
print ($line->montant * -1).$this->separator;
|
||||
}
|
||||
// Steuer
|
||||
print "0.00" . $this->separator;
|
||||
print "0.00".$this->separator;
|
||||
// FW-Betrag
|
||||
print "0.00" . $this->separator;
|
||||
print "0.00".$this->separator;
|
||||
// Tx1
|
||||
$line1= self::toAnsi($line->label_compte, 29);
|
||||
$line1 = self::toAnsi($line->label_compte, 29);
|
||||
if ($line1 == "LIQ" || $line1 == "LIQ Beleg ok" || strlen($line1) <= 3)
|
||||
{
|
||||
$line1= "";
|
||||
$line1 = "";
|
||||
}
|
||||
$line2= self::toAnsi($line->doc_ref, 29);
|
||||
$line2 = self::toAnsi($line->doc_ref, 29);
|
||||
if (strlen($line1) == 0)
|
||||
{
|
||||
$line1= $line2;
|
||||
$line2= "";
|
||||
$line1 = $line2;
|
||||
$line2 = "";
|
||||
}
|
||||
if (strlen($line1) > 0 && strlen($line2) > 0 && (strlen($line1) + strlen($line2)) < 27)
|
||||
{
|
||||
$line1= $line1 . ' / ' . $line2;
|
||||
$line2= "";
|
||||
$line1 = $line1.' / '.$line2;
|
||||
$line2 = "";
|
||||
}
|
||||
|
||||
print '"' . self::toAnsi($line1). '"' . $this->separator;
|
||||
print '"'.self::toAnsi($line1).'"'.$this->separator;
|
||||
// Tx2
|
||||
print '"' . self::toAnsi($line2). '"' . $this->separator;
|
||||
print '"'.self::toAnsi($line2).'"'.$this->separator;
|
||||
//PkKey
|
||||
print "0" . $this->separator;
|
||||
print "0".$this->separator;
|
||||
//OpId
|
||||
print $this->separator;
|
||||
|
||||
@@ -910,8 +910,8 @@ class AccountancyExport
|
||||
|
||||
if ($line->piece_num !== $thisPieceNum)
|
||||
{
|
||||
$thisPieceNum= $line->piece_num;
|
||||
$thisPieceAccountNr= $line->numero_compte;
|
||||
$thisPieceNum = $line->piece_num;
|
||||
$thisPieceAccountNr = $line->numero_compte;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -932,23 +932,23 @@ class AccountancyExport
|
||||
|
||||
foreach ($objectLines as $line) {
|
||||
$date_document = dol_print_date($line->doc_date, '%Y%m%d');
|
||||
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
|
||||
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
|
||||
|
||||
// TYPE
|
||||
$type_enregistrement = 'E'; // For write movement
|
||||
print $type_enregistrement . $separator;
|
||||
print $type_enregistrement.$separator;
|
||||
// JNAL
|
||||
print substr($line->code_journal, 0, 2) . $separator;
|
||||
print substr($line->code_journal, 0, 2).$separator;
|
||||
// NECR
|
||||
print $line->id . $separator;
|
||||
print $line->id.$separator;
|
||||
// NPIE
|
||||
print $line->piece_num . $separator;
|
||||
print $line->piece_num.$separator;
|
||||
// DATP
|
||||
print $date_document . $separator;
|
||||
print $date_document.$separator;
|
||||
// LIBE
|
||||
print $line->label_operation . $separator;
|
||||
print $line->label_operation.$separator;
|
||||
// DATH
|
||||
print $line->date_lim_reglement . $separator;
|
||||
print $line->date_lim_reglement.$separator;
|
||||
// CNPI
|
||||
if ($line->doc_type == 'supplier_invoice') {
|
||||
if ($line->montant < 0) {
|
||||
@@ -965,7 +965,7 @@ class AccountancyExport
|
||||
} else {
|
||||
$nature_piece = '';
|
||||
}
|
||||
print $nature_piece . $separator;
|
||||
print $nature_piece.$separator;
|
||||
// RACI
|
||||
/*
|
||||
if (! empty($line->subledger_account)) {
|
||||
@@ -983,28 +983,28 @@ class AccountancyExport
|
||||
*/
|
||||
print $separator; // deprecated CPTG & CPTA use instead
|
||||
// MONT
|
||||
print price(abs($line->montant), 0, '', 1, 2) . $separator;
|
||||
print price(abs($line->montant), 0, '', 1, 2).$separator;
|
||||
// CODC
|
||||
print $line->sens . $separator;
|
||||
print $line->sens.$separator;
|
||||
// CPTG
|
||||
print length_accountg($line->numero_compte) . $separator;
|
||||
print length_accountg($line->numero_compte).$separator;
|
||||
// DATE
|
||||
print $date_creation . $separator;
|
||||
print $date_creation.$separator;
|
||||
// CLET
|
||||
print $line->lettering_code . $separator;
|
||||
print $line->lettering_code.$separator;
|
||||
// DATL
|
||||
print $line->date_lettering . $separator;
|
||||
print $line->date_lettering.$separator;
|
||||
// CPTA
|
||||
if (! empty($line->subledger_account)) {
|
||||
print length_accounta($line->subledger_account) . $separator;
|
||||
if (!empty($line->subledger_account)) {
|
||||
print length_accounta($line->subledger_account).$separator;
|
||||
} else {
|
||||
print $separator;
|
||||
}
|
||||
// CNAT
|
||||
if ($line->doc_type == 'supplier_invoice' && ! empty($line->subledger_account)) {
|
||||
print 'F' . $separator;
|
||||
} elseif ($line->doc_type == 'customer_invoice' && ! empty($line->subledger_account)) {
|
||||
print 'C' . $separator;
|
||||
if ($line->doc_type == 'supplier_invoice' && !empty($line->subledger_account)) {
|
||||
print 'F'.$separator;
|
||||
} elseif ($line->doc_type == 'customer_invoice' && !empty($line->subledger_account)) {
|
||||
print 'C'.$separator;
|
||||
} else {
|
||||
print $separator;
|
||||
}
|
||||
@@ -1017,17 +1017,17 @@ class AccountancyExport
|
||||
// DATV
|
||||
print $separator;
|
||||
// REFD
|
||||
print $line->doc_ref . $separator;
|
||||
print $line->doc_ref.$separator;
|
||||
// CODH
|
||||
print $separator;
|
||||
// NSEQ
|
||||
print $separator;
|
||||
// MTDV
|
||||
print '0' . $separator;
|
||||
print '0'.$separator;
|
||||
// CODV
|
||||
print $separator;
|
||||
// TXDV
|
||||
print '0' . $separator;
|
||||
print '0'.$separator;
|
||||
// MOPM
|
||||
print $separator;
|
||||
// BONP
|
||||
@@ -1066,43 +1066,43 @@ class AccountancyExport
|
||||
/*
|
||||
* Charlemagne export need header
|
||||
*/
|
||||
print $langs->transnoentitiesnoconv('Date') . $separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('Journal'), 6) . $separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('Account'), 15) . $separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('LabelAccount'), 60) . $separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('Piece'), 20) . $separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('LabelOperation'), 60) . $separator;
|
||||
print $langs->transnoentitiesnoconv('Amount') . $separator;
|
||||
print 'S' . $separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('Analytic') . ' 1', 15) . $separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('AnalyticLabel') . ' 1', 60) . $separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('Analytic') . ' 2', 15) . $separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('AnalyticLabel') . ' 2', 60) . $separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('Analytic') . ' 3', 15) . $separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('AnalyticLabel') . ' 3', 60) . $separator;
|
||||
print $langs->transnoentitiesnoconv('Date').$separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('Journal'), 6).$separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('Account'), 15).$separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('LabelAccount'), 60).$separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('Piece'), 20).$separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('LabelOperation'), 60).$separator;
|
||||
print $langs->transnoentitiesnoconv('Amount').$separator;
|
||||
print 'S'.$separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('Analytic').' 1', 15).$separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('AnalyticLabel').' 1', 60).$separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('Analytic').' 2', 15).$separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('AnalyticLabel').' 2', 60).$separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('Analytic').' 3', 15).$separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('AnalyticLabel').' 3', 60).$separator;
|
||||
print $end_line;
|
||||
|
||||
foreach($objectLines as $line) {
|
||||
foreach ($objectLines as $line) {
|
||||
$date = dol_print_date($line->doc_date, '%Y%m%d');
|
||||
print $date . $separator; //Date
|
||||
print $date.$separator; //Date
|
||||
|
||||
print self::trunc($line->code_journal, 6) . $separator; //Journal code
|
||||
print self::trunc($line->code_journal, 6).$separator; //Journal code
|
||||
|
||||
if(!empty($line->subledger_account)) $account = $line->subledger_account;
|
||||
if (!empty($line->subledger_account)) $account = $line->subledger_account;
|
||||
else $account = $line->numero_compte;
|
||||
print self::trunc($account, 15) . $separator;//Account number
|
||||
print self::trunc($account, 15).$separator; //Account number
|
||||
|
||||
print self::trunc($line->label_compte, 60) . $separator;//Account label
|
||||
print self::trunc($line->doc_ref, 20) . $separator;//Piece
|
||||
print self::trunc($line->label_operation, 60) . $separator;//Operation label
|
||||
print price(abs($line->montant)) . $separator;//Amount
|
||||
print $line->sens . $separator;//Direction
|
||||
print $separator;//Analytic
|
||||
print $separator;//Analytic
|
||||
print $separator;//Analytic
|
||||
print $separator;//Analytic
|
||||
print $separator;//Analytic
|
||||
print $separator;//Analytic
|
||||
print self::trunc($line->label_compte, 60).$separator; //Account label
|
||||
print self::trunc($line->doc_ref, 20).$separator; //Piece
|
||||
print self::trunc($line->label_operation, 60).$separator; //Operation label
|
||||
print price(abs($line->montant)).$separator; //Amount
|
||||
print $line->sens.$separator; //Direction
|
||||
print $separator; //Analytic
|
||||
print $separator; //Analytic
|
||||
print $separator; //Analytic
|
||||
print $separator; //Analytic
|
||||
print $separator; //Analytic
|
||||
print $separator; //Analytic
|
||||
print $end_line;
|
||||
}
|
||||
}
|
||||
@@ -1129,10 +1129,10 @@ class AccountancyExport
|
||||
*/
|
||||
public static function toAnsi($str, $size = -1)
|
||||
{
|
||||
$retVal= dol_string_nohtmltag($str, 1, 'Windows-1251');
|
||||
$retVal = dol_string_nohtmltag($str, 1, 'Windows-1251');
|
||||
if ($retVal >= 0 && $size >= 0)
|
||||
{
|
||||
$retVal= mb_substr($retVal, 0, $size, 'Windows-1251');
|
||||
$retVal = mb_substr($retVal, 0, $size, 'Windows-1251');
|
||||
}
|
||||
return $retVal;
|
||||
}
|
||||
|
||||
@@ -29,17 +29,17 @@
|
||||
* \brief Page with expense reports journal
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("commercial", "compta","bills","other","accountancy","trips","errors"));
|
||||
$langs->loadLangs(array("commercial", "compta", "bills", "other", "accountancy", "trips", "errors"));
|
||||
|
||||
$id_journal = GETPOST('id_journal', 'int');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
@@ -75,13 +75,13 @@ $pastmonth = strftime("%m", dol_now()) - 1;
|
||||
$pastmonthyear = $year_current;
|
||||
if ($pastmonth == 0) {
|
||||
$pastmonth = 12;
|
||||
$pastmonthyear --;
|
||||
$pastmonthyear--;
|
||||
}
|
||||
|
||||
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
||||
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
||||
|
||||
if (! GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form
|
||||
if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form
|
||||
{
|
||||
$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false);
|
||||
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
||||
@@ -91,62 +91,62 @@ $sql = "SELECT er.rowid, er.ref, er.date_debut as de,";
|
||||
$sql .= " erd.rowid as erdid, erd.comments, erd.total_ht, erd.total_tva, erd.total_localtax1, erd.total_localtax2, erd.tva_tx, erd.total_ttc, erd.fk_code_ventilation, erd.vat_src_code, ";
|
||||
$sql .= " u.rowid as uid, u.firstname, u.lastname, u.accountancy_code as user_accountancy_account,";
|
||||
$sql .= " f.accountancy_code, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "user as u ON u.rowid = er.fk_user_author";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as f ON f.id = erd.fk_c_type_fees";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."expensereport as er ON er.rowid = erd.fk_expensereport";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = er.fk_user_author";
|
||||
$sql .= " WHERE er.fk_statut > 0";
|
||||
$sql .= " AND erd.fk_code_ventilation > 0";
|
||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy
|
||||
if ($date_start && $date_end)
|
||||
$sql .= " AND er.date_debut >= '" . $db->idate($date_start) . "' AND er.date_debut <= '" . $db->idate($date_end) . "'";
|
||||
$sql .= " AND er.date_debut >= '".$db->idate($date_start)."' AND er.date_debut <= '".$db->idate($date_end)."'";
|
||||
// Already in bookkeeping or not
|
||||
if ($in_bookkeeping == 'already')
|
||||
{
|
||||
$sql .= " AND er.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
|
||||
$sql .= " AND er.rowid IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
|
||||
}
|
||||
if ($in_bookkeeping == 'notyet')
|
||||
{
|
||||
$sql .= " AND er.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
|
||||
$sql .= " AND er.rowid NOT IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
|
||||
}
|
||||
$sql .= " ORDER BY er.date_debut";
|
||||
|
||||
dol_syslog('accountancy/journal/expensereportsjournal.php', LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$taber = array ();
|
||||
$tabht = array ();
|
||||
$tabtva = array ();
|
||||
$def_tva = array ();
|
||||
$tabttc = array ();
|
||||
$tablocaltax1 = array ();
|
||||
$tablocaltax2 = array ();
|
||||
$tabuser = array ();
|
||||
$taber = array();
|
||||
$tabht = array();
|
||||
$tabtva = array();
|
||||
$def_tva = array();
|
||||
$tabttc = array();
|
||||
$tablocaltax1 = array();
|
||||
$tablocaltax2 = array();
|
||||
$tabuser = array();
|
||||
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
// Variables
|
||||
$account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT)) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined';
|
||||
$account_vat = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : 'NotDefined';
|
||||
$account_salary = (!empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT)) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined';
|
||||
$account_vat = (!empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : 'NotDefined';
|
||||
|
||||
$i = 0;
|
||||
while ( $i < $num ) {
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
// Controls
|
||||
$compta_user = (! empty($obj->user_accountancy_account)) ? $obj->user_accountancy_account : $account_salary;
|
||||
$compta_user = (!empty($obj->user_accountancy_account)) ? $obj->user_accountancy_account : $account_salary;
|
||||
$compta_fees = $obj->compte;
|
||||
|
||||
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
||||
$compta_tva = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $account_vat);
|
||||
$compta_localtax1 = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||
$compta_localtax2 = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), $mysoc, $mysoc, 0);
|
||||
$compta_tva = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $account_vat);
|
||||
$compta_localtax1 = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||
$compta_localtax2 = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||
|
||||
// Define array to display all VAT rates that use this accounting account $compta_tva
|
||||
if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code))
|
||||
if (price2num($obj->tva_tx) || !empty($obj->vat_src_code))
|
||||
{
|
||||
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')]=(vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':''));
|
||||
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '')] = (vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''));
|
||||
}
|
||||
|
||||
$taber[$obj->rowid]["date"] = $db->jdate($obj->de);
|
||||
@@ -155,24 +155,24 @@ if ($result) {
|
||||
$taber[$obj->rowid]["fk_expensereportdet"] = $obj->erdid;
|
||||
|
||||
// Avoid warnings
|
||||
if (! isset($tabttc[$obj->rowid][$compta_user])) $tabttc[$obj->rowid][$compta_user] = 0;
|
||||
if (! isset($tabht[$obj->rowid][$compta_fees])) $tabht[$obj->rowid][$compta_fees] = 0;
|
||||
if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0;
|
||||
if (! isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1] = 0;
|
||||
if (! isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
|
||||
if (!isset($tabttc[$obj->rowid][$compta_user])) $tabttc[$obj->rowid][$compta_user] = 0;
|
||||
if (!isset($tabht[$obj->rowid][$compta_fees])) $tabht[$obj->rowid][$compta_fees] = 0;
|
||||
if (!isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0;
|
||||
if (!isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1] = 0;
|
||||
if (!isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
|
||||
|
||||
$tabttc[$obj->rowid][$compta_user] += $obj->total_ttc;
|
||||
$tabht[$obj->rowid][$compta_fees] += $obj->total_ht;
|
||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
||||
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1;
|
||||
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2;
|
||||
$tabuser[$obj->rowid] = array (
|
||||
$tabuser[$obj->rowid] = array(
|
||||
'id' => $obj->uid,
|
||||
'name' => dolGetFirstLastname($obj->firstname, $obj->lastname),
|
||||
'user_accountancy_code' => $obj->user_accountancy_account
|
||||
);
|
||||
|
||||
$i ++;
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
@@ -193,7 +193,7 @@ if ($action == 'writebookkeeping') {
|
||||
$db->begin();
|
||||
|
||||
// Thirdparty
|
||||
if (! $errorforline)
|
||||
if (!$errorforline)
|
||||
{
|
||||
foreach ($tabttc[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
@@ -244,7 +244,7 @@ if ($action == 'writebookkeeping') {
|
||||
}
|
||||
|
||||
// Fees
|
||||
if (! $errorforline)
|
||||
if (!$errorforline)
|
||||
{
|
||||
foreach ($tabht[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
@@ -295,10 +295,10 @@ if ($action == 'writebookkeeping') {
|
||||
}
|
||||
|
||||
// VAT
|
||||
if (! $errorforline)
|
||||
if (!$errorforline)
|
||||
{
|
||||
$listoftax=array(0, 1, 2);
|
||||
foreach($listoftax as $numtax)
|
||||
$listoftax = array(0, 1, 2);
|
||||
foreach ($listoftax as $numtax)
|
||||
{
|
||||
$arrayofvat = $tabtva;
|
||||
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||
@@ -362,7 +362,7 @@ if ($action == 'writebookkeeping') {
|
||||
setEventMessages('Try to insert a non balanced transaction in book for '.$val["ref"].'. Canceled. Surely a bug.', null, 'errors');
|
||||
}
|
||||
|
||||
if (! $errorforline)
|
||||
if (!$errorforline)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
@@ -373,7 +373,7 @@ if ($action == 'writebookkeeping') {
|
||||
if ($error >= 10)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped"), null, 'errors');
|
||||
break; // Break in the foreach
|
||||
break; // Break in the foreach
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -392,21 +392,21 @@ if ($action == 'writebookkeeping') {
|
||||
setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings');
|
||||
}
|
||||
|
||||
$action='';
|
||||
$action = '';
|
||||
|
||||
// Must reload data, so we make a redirect
|
||||
if (count($tabpay) != $error)
|
||||
{
|
||||
$param='id_journal='.$id_journal;
|
||||
$param.='&date_startday='.$date_startday;
|
||||
$param.='&date_startmonth='.$date_startmonth;
|
||||
$param.='&date_startyear='.$date_startyear;
|
||||
$param.='&date_endday='.$date_endday;
|
||||
$param.='&date_endmonth='.$date_endmonth;
|
||||
$param.='&date_endyear='.$date_endyear;
|
||||
$param.='&in_bookkeeping='.$in_bookkeeping;
|
||||
$param = 'id_journal='.$id_journal;
|
||||
$param .= '&date_startday='.$date_startday;
|
||||
$param .= '&date_startmonth='.$date_startmonth;
|
||||
$param .= '&date_startyear='.$date_startyear;
|
||||
$param .= '&date_endday='.$date_endday;
|
||||
$param .= '&date_endmonth='.$date_endmonth;
|
||||
$param .= '&date_endyear='.$date_endyear;
|
||||
$param .= '&in_bookkeeping='.$in_bookkeeping;
|
||||
|
||||
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||
header("Location: ".$_SERVER['PHP_SELF'].($param ? '?'.$param : ''));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -426,15 +426,15 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
|
||||
$filename = 'journal';
|
||||
$type_export = 'journal';
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
|
||||
|
||||
// CSV header line
|
||||
print '"' . $langs->transnoentitiesnoconv("Date") . '"' . $sep;
|
||||
print '"' . $langs->transnoentitiesnoconv("Piece") . '"' . $sep;
|
||||
print '"' . $langs->transnoentitiesnoconv("AccountAccounting") . '"' . $sep;
|
||||
print '"' . $langs->transnoentitiesnoconv("LabelOperation") . '"' . $sep;
|
||||
print '"' . $langs->transnoentitiesnoconv("Debit") . '"' . $sep;
|
||||
print '"' . $langs->transnoentitiesnoconv("Credit") . '"' . $sep;
|
||||
print '"'.$langs->transnoentitiesnoconv("Date").'"'.$sep;
|
||||
print '"'.$langs->transnoentitiesnoconv("Piece").'"'.$sep;
|
||||
print '"'.$langs->transnoentitiesnoconv("AccountAccounting").'"'.$sep;
|
||||
print '"'.$langs->transnoentitiesnoconv("LabelOperation").'"'.$sep;
|
||||
print '"'.$langs->transnoentitiesnoconv("Debit").'"'.$sep;
|
||||
print '"'.$langs->transnoentitiesnoconv("Credit").'"'.$sep;
|
||||
print "\n";
|
||||
|
||||
foreach ($taber as $key => $val) {
|
||||
@@ -486,18 +486,18 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
if (empty($action) || $action == 'view') {
|
||||
llxHeader('', $langs->trans("ExpenseReportsJournal"));
|
||||
|
||||
$nom = $langs->trans("ExpenseReportsJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
|
||||
$nom = $langs->trans("ExpenseReportsJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
|
||||
$nomlink = '';
|
||||
$periodlink = '';
|
||||
$exportlink = '';
|
||||
$builddate=dol_now();
|
||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||
$builddate = dol_now();
|
||||
$description .= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||
|
||||
$listofchoices=array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger"));
|
||||
$period = $form->selectDate($date_start?$date_start:-1, 'date_start', 0, 0, 0, '', 1, 0) . ' - ' . $form->selectDate($date_end?$date_end:-1, 'date_end', 0, 0, 0, '', 1, 0);
|
||||
$period .= ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||
$listofchoices = array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger"));
|
||||
$period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0);
|
||||
$period .= ' - '.$langs->trans("JournalizationInLedgerStatus").' '.$form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||
|
||||
$varlink = 'id_journal=' . $id_journal;
|
||||
$varlink = 'id_journal='.$id_journal;
|
||||
|
||||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||
|
||||
@@ -508,13 +508,13 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
print '<div class="tabsAction tabsActionNoBottom">';
|
||||
|
||||
if (! empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
|
||||
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
||||
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />';
|
||||
}
|
||||
else {
|
||||
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
else print '<a href="#" class="butActionRefused classfortooltip" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>';
|
||||
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="'.$langs->trans("WriteBookKeeping").'" onclick="writebookkeeping();" />';
|
||||
else print '<a href="#" class="butActionRefused classfortooltip" name="writebookkeeping">'.$langs->trans("WriteBookKeeping").'</a>';
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
@@ -543,13 +543,13 @@ if (empty($action) || $action == 'view') {
|
||||
print '<div class="div-table-responsive">';
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print "<td>" . $langs->trans("Date") . "</td>";
|
||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("ExpenseReportRef") . ")</td>";
|
||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||
print "<td>" . $langs->trans("LabelOperation") . "</td>";
|
||||
print '<td class="right">' . $langs->trans("Debit") . "</td>";
|
||||
print '<td class="right">' . $langs->trans("Credit") . "</td>";
|
||||
print "<td>".$langs->trans("Date")."</td>";
|
||||
print "<td>".$langs->trans("Piece").' ('.$langs->trans("ExpenseReportRef").")</td>";
|
||||
print "<td>".$langs->trans("AccountAccounting")."</td>";
|
||||
print "<td>".$langs->trans("SubledgerAccount")."</td>";
|
||||
print "<td>".$langs->trans("LabelOperation")."</td>";
|
||||
print '<td class="right">'.$langs->trans("Debit")."</td>";
|
||||
print '<td class="right">'.$langs->trans("Credit")."</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$r = '';
|
||||
@@ -572,8 +572,8 @@ if (empty($action) || $action == 'view') {
|
||||
if ($mt) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<!-- Fees -->";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
||||
print "<td>".$date."</td>";
|
||||
print "<td>".$expensereportstatic->getNomUrl(1)."</td>";
|
||||
$userstatic->id = $tabuser[$key]['id'];
|
||||
$userstatic->name = $tabuser[$key]['name'];
|
||||
// Account
|
||||
@@ -590,9 +590,9 @@ if (empty($action) || $action == 'view') {
|
||||
print '</td>';
|
||||
$userstatic->id = $tabuser[$key]['id'];
|
||||
$userstatic->name = $tabuser[$key]['name'];
|
||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $accountingaccount->label . "</td>";
|
||||
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "<td>".$userstatic->getNomUrl(0, 'user', 16).' - '.$accountingaccount->label."</td>";
|
||||
print '<td class="right nowraponall">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
print '<td class="right nowraponall">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
@@ -604,8 +604,8 @@ if (empty($action) || $action == 'view') {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print "<!-- Thirdparty -->";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
||||
print "<td>".$date."</td>";
|
||||
print "<td>".$expensereportstatic->getNomUrl(1)."</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accounta($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT);
|
||||
@@ -624,9 +624,9 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
else print $accountoshow;
|
||||
print '</td>';
|
||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("SubledgerAccount") . "</td>";
|
||||
print '<td class="right nowraponall">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
|
||||
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "<td>".$userstatic->getNomUrl(0, 'user', 16).' - '.$langs->trans("SubledgerAccount")."</td>";
|
||||
print '<td class="right nowraponall">'.($mt < 0 ? -price(-$mt) : '')."</td>";
|
||||
print '<td class="right nowraponall">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
|
||||
@@ -29,17 +29,17 @@
|
||||
* \brief Page with purchases journal
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("commercial", "compta","bills","other","accountancy","errors"));
|
||||
$langs->loadLangs(array("commercial", "compta", "bills", "other", "accountancy", "errors"));
|
||||
|
||||
$id_journal = GETPOST('id_journal', 'int');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
@@ -60,12 +60,12 @@ if ($user->socid > 0)
|
||||
accessforbidden();
|
||||
|
||||
$hookmanager->initHooks(array('purchasesjournal'));
|
||||
$parameters=array();
|
||||
$parameters = array();
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
$reshook=$hookmanager->executeHooks('doActions', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
|
||||
@@ -80,13 +80,13 @@ $pastmonth = strftime("%m", dol_now()) - 1;
|
||||
$pastmonthyear = $year_current;
|
||||
if ($pastmonth == 0) {
|
||||
$pastmonth = 12;
|
||||
$pastmonthyear --;
|
||||
$pastmonthyear--;
|
||||
}
|
||||
|
||||
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
||||
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
||||
|
||||
if (! GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form
|
||||
if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form
|
||||
{
|
||||
$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false);
|
||||
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
||||
@@ -96,53 +96,53 @@ $sql = "SELECT f.rowid, f.ref as ref, f.type, f.datef as df, f.libelle,f.ref_sup
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
||||
$sql .= " p.accountancy_code_buy , aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = fd.fk_facture_fourn";
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as fd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = fd.fk_facture_fourn";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
|
||||
$sql .= " WHERE f.fk_statut > 0";
|
||||
$sql .= " AND fd.fk_code_ventilation > 0";
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . FactureFournisseur::TYPE_STANDARD . "," . FactureFournisseur::TYPE_REPLACEMENT . "," . FactureFournisseur::TYPE_CREDIT_NOTE . "," . FactureFournisseur::TYPE_SITUATION . ")";
|
||||
$sql .= " AND f.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
|
||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_SITUATION.")";
|
||||
} else {
|
||||
$sql .= " AND f.type IN (" . FactureFournisseur::TYPE_STANDARD . "," . FactureFournisseur::TYPE_REPLACEMENT . "," . FactureFournisseur::TYPE_CREDIT_NOTE . "," . FactureFournisseur::TYPE_DEPOSIT . "," . FactureFournisseur::TYPE_SITUATION . ")";
|
||||
$sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_DEPOSIT.",".FactureFournisseur::TYPE_SITUATION.")";
|
||||
}
|
||||
if ($date_start && $date_end)
|
||||
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
||||
$sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||
// Already in bookkeeping or not
|
||||
if ($in_bookkeeping == 'already')
|
||||
{
|
||||
$sql .= " AND f.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice')";
|
||||
$sql .= " AND f.rowid IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice')";
|
||||
}
|
||||
if ($in_bookkeeping == 'notyet')
|
||||
{
|
||||
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice')";
|
||||
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice')";
|
||||
}
|
||||
$sql .= " ORDER BY f.datef";
|
||||
|
||||
dol_syslog('accountancy/journal/purchasesjournal.php', LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$tabfac = array ();
|
||||
$tabht = array ();
|
||||
$tabtva = array ();
|
||||
$def_tva = array ();
|
||||
$tabttc = array ();
|
||||
$tablocaltax1 = array ();
|
||||
$tablocaltax2 = array ();
|
||||
$tabcompany = array ();
|
||||
$tabfac = array();
|
||||
$tabht = array();
|
||||
$tabtva = array();
|
||||
$def_tva = array();
|
||||
$tabttc = array();
|
||||
$tablocaltax1 = array();
|
||||
$tablocaltax2 = array();
|
||||
$tabcompany = array();
|
||||
$tabother = array();
|
||||
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
// Variables
|
||||
$cptfour = ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined';
|
||||
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : 'NotDefined';
|
||||
$cpttva = (!empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : 'NotDefined';
|
||||
|
||||
$i = 0;
|
||||
while ( $i < $num ) {
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
// Controls
|
||||
@@ -151,21 +151,21 @@ if ($result) {
|
||||
$compta_prod = $obj->compte;
|
||||
if (empty($compta_prod)) {
|
||||
if ($obj->product_type == 0)
|
||||
$compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : 'NotDefined';
|
||||
$compta_prod = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : 'NotDefined';
|
||||
else
|
||||
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : 'NotDefined';
|
||||
$compta_prod = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : 'NotDefined';
|
||||
}
|
||||
|
||||
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
||||
$compta_tva = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||
$compta_localtax1 = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||
$compta_localtax2 = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||
$compta_counterpart_tva_npr = (! empty($conf->global->ACCOUNTING_COUNTERPART_VAT_NPR)) ? $conf->global->ACCOUNTING_COUNTERPART_VAT_NPR : 'NotDefined';
|
||||
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), $mysoc, $mysoc, 0);
|
||||
$compta_tva = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||
$compta_localtax1 = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||
$compta_localtax2 = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||
$compta_counterpart_tva_npr = (!empty($conf->global->ACCOUNTING_COUNTERPART_VAT_NPR)) ? $conf->global->ACCOUNTING_COUNTERPART_VAT_NPR : 'NotDefined';
|
||||
|
||||
// Define array to display all VAT rates that use this accounting account $compta_tva
|
||||
if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code))
|
||||
if (price2num($obj->tva_tx) || !empty($obj->vat_src_code))
|
||||
{
|
||||
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')]=(vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':''));
|
||||
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '')] = (vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''));
|
||||
}
|
||||
|
||||
$line = new SupplierInvoiceLine($db);
|
||||
@@ -173,31 +173,31 @@ if ($result) {
|
||||
|
||||
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
|
||||
$tabfac[$obj->rowid]["datereg"] = $db->jdate($obj->dlr);
|
||||
$tabfac[$obj->rowid]["ref"] = $obj->ref_supplier . ' (' . $obj->ref . ')';
|
||||
$tabfac[$obj->rowid]["ref"] = $obj->ref_supplier.' ('.$obj->ref.')';
|
||||
$tabfac[$obj->rowid]["refsologest"] = $obj->ref;
|
||||
$tabfac[$obj->rowid]["refsuppliersologest"] = $obj->ref_supplier;
|
||||
$tabfac[$obj->rowid]["type"] = $obj->type;
|
||||
$tabfac[$obj->rowid]["description"] = $obj->description;
|
||||
$tabfac[$obj->rowid]["close_code"] = $obj->close_code; // close_code = 'replaced' for replacement invoices (not used in most european countries)
|
||||
$tabfac[$obj->rowid]["close_code"] = $obj->close_code; // close_code = 'replaced' for replacement invoices (not used in most european countries)
|
||||
//$tabfac[$obj->rowid]["fk_facturefourndet"] = $obj->fdid;
|
||||
|
||||
// Avoid warnings
|
||||
if (! isset($tabttc[$obj->rowid][$compta_soc])) $tabttc[$obj->rowid][$compta_soc] = 0;
|
||||
if (! isset($tabht[$obj->rowid][$compta_prod])) $tabht[$obj->rowid][$compta_prod] = 0;
|
||||
if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0;
|
||||
if (! isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1] = 0;
|
||||
if (! isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
|
||||
if (!isset($tabttc[$obj->rowid][$compta_soc])) $tabttc[$obj->rowid][$compta_soc] = 0;
|
||||
if (!isset($tabht[$obj->rowid][$compta_prod])) $tabht[$obj->rowid][$compta_prod] = 0;
|
||||
if (!isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0;
|
||||
if (!isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1] = 0;
|
||||
if (!isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
|
||||
|
||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
||||
if (! empty($line->tva_npr)) // Add an entry for counterpart
|
||||
if (!empty($line->tva_npr)) // Add an entry for counterpart
|
||||
{
|
||||
$tabother[$obj->rowid][$compta_counterpart_tva_npr] += $obj->total_tva;
|
||||
}
|
||||
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1;
|
||||
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2;
|
||||
$tabcompany[$obj->rowid] = array (
|
||||
$tabcompany[$obj->rowid] = array(
|
||||
'id' => $obj->socid,
|
||||
'name' => $obj->name,
|
||||
'code_fournisseur' => $obj->code_fournisseur,
|
||||
@@ -215,16 +215,16 @@ $errorforinvoice = array();
|
||||
// Loop in invoices to detect lines with not binding lines
|
||||
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||
$sql = "SELECT COUNT(fd.rowid) as nb";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
|
||||
$sql.= " WHERE fd.product_type <= 2 AND fd.fk_code_ventilation <= 0";
|
||||
$sql.= " AND fd.total_ttc <> 0 AND fk_facture_fourn = ".$key;
|
||||
$resql=$db->query($sql);
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as fd";
|
||||
$sql .= " WHERE fd.product_type <= 2 AND fd.fk_code_ventilation <= 0";
|
||||
$sql .= " AND fd.total_ttc <> 0 AND fk_facture_fourn = ".$key;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj->nb > 0)
|
||||
{
|
||||
$errorforinvoice[$key]='somelinesarenotbound';
|
||||
$errorforinvoice[$key] = 'somelinesarenotbound';
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
@@ -271,7 +271,7 @@ if ($action == 'writebookkeeping') {
|
||||
if ($invoicestatic->close_code == FactureFournisseur::CLOSECODE_REPLACED)
|
||||
{
|
||||
$replacedinvoice = 1;
|
||||
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
|
||||
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
|
||||
if ($alreadydispatched) $replacedinvoice = 2;
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ if ($action == 'writebookkeeping') {
|
||||
}
|
||||
|
||||
// Thirdparty
|
||||
if (! $errorforline)
|
||||
if (!$errorforline)
|
||||
{
|
||||
foreach ($tabttc[$key] as $k => $mt) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
@@ -473,7 +473,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->date_creation = $now;
|
||||
$bookkeeping->doc_type = 'supplier_invoice';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
@@ -497,14 +497,14 @@ if ($action == 'writebookkeeping') {
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key]='alreadyjournalized';
|
||||
$errorforinvoice[$key] = 'alreadyjournalized';
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key]='other';
|
||||
$errorforinvoice[$key] = 'other';
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
}
|
||||
@@ -513,15 +513,15 @@ if ($action == 'writebookkeeping') {
|
||||
}
|
||||
|
||||
// Protection against a bug on lines before
|
||||
if (! $errorforline && (price2num($totaldebit) != price2num($totalcredit)))
|
||||
if (!$errorforline && (price2num($totaldebit) != price2num($totalcredit)))
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key]='amountsnotbalanced';
|
||||
$errorforinvoice[$key] = 'amountsnotbalanced';
|
||||
setEventMessages('Try to insert a non balanced transaction in book for '.$invoicestatic->ref.'. Canceled. Surely a bug.', null, 'errors');
|
||||
}
|
||||
|
||||
if (! $errorforline)
|
||||
if (!$errorforline)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
@@ -532,7 +532,7 @@ if ($action == 'writebookkeeping') {
|
||||
if ($error >= 10)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped"), null, 'errors');
|
||||
break; // Break in the foreach
|
||||
break; // Break in the foreach
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -551,20 +551,20 @@ if ($action == 'writebookkeeping') {
|
||||
setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings');
|
||||
}
|
||||
|
||||
$action='';
|
||||
$action = '';
|
||||
|
||||
// Must reload data, so we make a redirect
|
||||
if (count($tabpay) != $error)
|
||||
{
|
||||
$param='id_journal='.$id_journal;
|
||||
$param.='&date_startday='.$date_startday;
|
||||
$param.='&date_startmonth='.$date_startmonth;
|
||||
$param.='&date_startyear='.$date_startyear;
|
||||
$param.='&date_endday='.$date_endday;
|
||||
$param.='&date_endmonth='.$date_endmonth;
|
||||
$param.='&date_endyear='.$date_endyear;
|
||||
$param.='&in_bookkeeping='.$in_bookkeeping;
|
||||
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||
$param = 'id_journal='.$id_journal;
|
||||
$param .= '&date_startday='.$date_startday;
|
||||
$param .= '&date_startmonth='.$date_startmonth;
|
||||
$param .= '&date_startyear='.$date_startyear;
|
||||
$param .= '&date_endday='.$date_endday;
|
||||
$param .= '&date_endmonth='.$date_endmonth;
|
||||
$param .= '&date_endyear='.$date_endyear;
|
||||
$param .= '&in_bookkeeping='.$in_bookkeeping;
|
||||
header("Location: ".$_SERVER['PHP_SELF'].($param ? '?'.$param : ''));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -581,7 +581,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
|
||||
$filename = 'journal';
|
||||
$type_export = 'journal';
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
|
||||
|
||||
$companystatic = new Fournisseur($db);
|
||||
$invoicestatic = new FactureFournisseur($db);
|
||||
@@ -610,7 +610,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
if ($invoicestatic->close_code == FactureFournisseur::CLOSECODE_REPLACED)
|
||||
{
|
||||
$replacedinvoice = 1;
|
||||
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
|
||||
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
|
||||
if ($alreadydispatched) $replacedinvoice = 2;
|
||||
}
|
||||
|
||||
@@ -623,18 +623,18 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
// Third party
|
||||
foreach ($tabttc[$key] as $k => $mt) {
|
||||
//if ($mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["refsologest"] . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)). '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $langs->trans("Thirdparty") . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Thirdparty") . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep;
|
||||
print '"' . $journal . '"' ;
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["refsologest"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER.'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$val["refsuppliersologest"].' - '.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
print "\n";
|
||||
//}
|
||||
}
|
||||
@@ -644,18 +644,18 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
//if ($mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["refsologest"] . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '""' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
||||
print '"' . $journal . '"' ;
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["refsologest"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '""'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($accountingaccount->label, 32)).'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$val["refsuppliersologest"].' - '.dol_trunc($accountingaccount->label, 32).'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
print "\n";
|
||||
//}
|
||||
}
|
||||
@@ -669,18 +669,18 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
|
||||
foreach ($arrayofvat[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["refsologest"] . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '""' . $sep;
|
||||
print '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key] . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . join(', ', $def_tva[$key][$k]) .' %' . ($numtax?' - Localtax '.$numtax:'') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
||||
print '"' . $journal . '"' ;
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["refsologest"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '""'.$sep;
|
||||
print '"'.$langs->trans("VAT").' - '.$def_tva[$key].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$val["refsuppliersologest"].' - '.$langs->trans("VAT").join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : '').'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
@@ -690,18 +690,18 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
{
|
||||
foreach ($tabother[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["refsologest"] . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)). '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $langs->trans("Thirdparty") . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . ' NPR"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep;
|
||||
print '"' . $journal . '"' ;
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["refsologest"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$val["refsuppliersologest"].' - '.$langs->trans("VAT").' NPR"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
@@ -713,23 +713,23 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
if (empty($action) || $action == 'view') {
|
||||
llxHeader('', $langs->trans("PurchasesJournal"));
|
||||
|
||||
$nom = $langs->trans("PurchasesJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
|
||||
$nom = $langs->trans("PurchasesJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
|
||||
$nomlink = '';
|
||||
$periodlink = '';
|
||||
$exportlink = '';
|
||||
$builddate=dol_now();
|
||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$builddate = dol_now();
|
||||
$description .= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$description .= $langs->trans("DepositsAreNotIncluded");
|
||||
} else {
|
||||
$description .= $langs->trans("DepositsAreIncluded");
|
||||
}
|
||||
|
||||
$listofchoices=array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger"));
|
||||
$period = $form->selectDate($date_start?$date_start:-1, 'date_start', 0, 0, 0, '', 1, 0) . ' - ' . $form->selectDate($date_end?$date_end:-1, 'date_end', 0, 0, 0, '', 1, 0);
|
||||
$period .= ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||
$listofchoices = array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger"));
|
||||
$period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0);
|
||||
$period .= ' - '.$langs->trans("JournalizationInLedgerStatus").' '.$form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||
|
||||
$varlink = 'id_journal=' . $id_journal;
|
||||
$varlink = 'id_journal='.$id_journal;
|
||||
|
||||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||
|
||||
@@ -740,13 +740,13 @@ if (empty($action) || $action == 'view') {
|
||||
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
}
|
||||
print '<div class="tabsAction tabsActionNoBottom">';
|
||||
if (! empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
|
||||
if (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
|
||||
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />';
|
||||
}
|
||||
else {
|
||||
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
else print '<a href="#" class="butActionRefused classfortooltip" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>';
|
||||
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="'.$langs->trans("WriteBookKeeping").'" onclick="writebookkeeping();" />';
|
||||
else print '<a href="#" class="butActionRefused classfortooltip" name="writebookkeeping">'.$langs->trans("WriteBookKeeping").'</a>';
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
@@ -775,13 +775,13 @@ if (empty($action) || $action == 'view') {
|
||||
print '<div class="div-table-responsive">';
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print "<td>" . $langs->trans("Date") . "</td>";
|
||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||
print "<td>" . $langs->trans("LabelOperation") . "</td>";
|
||||
print '<td class="center">' . $langs->trans("Debit") . "</td>";
|
||||
print '<td class="center">' . $langs->trans("Credit") . "</td>";
|
||||
print "<td>".$langs->trans("Date")."</td>";
|
||||
print "<td>".$langs->trans("Piece").' ('.$langs->trans("InvoiceRef").")</td>";
|
||||
print "<td>".$langs->trans("AccountAccounting")."</td>";
|
||||
print "<td>".$langs->trans("SubledgerAccount")."</td>";
|
||||
print "<td>".$langs->trans("LabelOperation")."</td>";
|
||||
print '<td class="center">'.$langs->trans("Debit")."</td>";
|
||||
print '<td class="center">'.$langs->trans("Credit")."</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$r = '';
|
||||
@@ -813,7 +813,7 @@ if (empty($action) || $action == 'view') {
|
||||
if ($invoicestatic->close_code == FactureFournisseur::CLOSECODE_REPLACED)
|
||||
{
|
||||
$replacedinvoice = 1;
|
||||
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
|
||||
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
|
||||
if ($alreadydispatched) $replacedinvoice = 2;
|
||||
}
|
||||
|
||||
@@ -822,8 +822,8 @@ if (empty($action) || $action == 'view') {
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print "<!-- Replaced invoice -->";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td><strike>" . $invoicestatic->getNomUrl(1) . "</strike></td>";
|
||||
print "<td>".$date."</td>";
|
||||
print "<td><strike>".$invoicestatic->getNomUrl(1)."</strike></td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
print $langs->trans("Replaced");
|
||||
@@ -843,8 +843,8 @@ if (empty($action) || $action == 'view') {
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print "<!-- Some lines are not bound -->";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
print "<td>".$date."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
print '<span class="error">'.$langs->trans('ErrorInvoiceContainsLinesNotYetBoundedShort', $val['ref']).'</span>';
|
||||
@@ -929,8 +929,8 @@ if (empty($action) || $action == 'view') {
|
||||
if ($mt) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<!-- VAT -->";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
print "<td>".$date."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($k);
|
||||
@@ -944,10 +944,10 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td>";
|
||||
print '</td>';
|
||||
print "<td>";
|
||||
print $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("VAT"). ' '.join(', ', $def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
|
||||
print $companystatic->getNomUrl(0, 'supplier', 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : '');
|
||||
print "</td>";
|
||||
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print '<td class="right nowraponall">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
print '<td class="right nowraponall">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
@@ -960,8 +960,8 @@ if (empty($action) || $action == 'view') {
|
||||
if ($mt) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<!-- VAT counterpart NPR -->";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
print "<td>".$date."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($k);
|
||||
@@ -974,9 +974,9 @@ if (empty($action) || $action == 'view') {
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
print '</td>';
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("VAT") . " NPR (counterpart)</td>";
|
||||
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "<td>".$companystatic->getNomUrl(0, 'supplier', 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("VAT")." NPR (counterpart)</td>";
|
||||
print '<td class="right nowraponall">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print '<td class="right nowraponall">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,17 +31,17 @@
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("commercial", "compta","bills","other","accountancy","errors"));
|
||||
$langs->loadLangs(array("commercial", "compta", "bills", "other", "accountancy", "errors"));
|
||||
|
||||
$id_journal = GETPOST('id_journal', 'int');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
@@ -62,13 +62,13 @@ if ($user->socid > 0)
|
||||
accessforbidden();
|
||||
|
||||
$hookmanager->initHooks(array('sellsjournal'));
|
||||
$parameters=array();
|
||||
$parameters = array();
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$reshook=$hookmanager->executeHooks('doActions', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
|
||||
@@ -83,13 +83,13 @@ $pastmonth = strftime("%m", dol_now()) - 1;
|
||||
$pastmonthyear = $year_current;
|
||||
if ($pastmonth == 0) {
|
||||
$pastmonth = 12;
|
||||
$pastmonthyear --;
|
||||
$pastmonthyear--;
|
||||
}
|
||||
|
||||
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
||||
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
||||
|
||||
if (! GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form
|
||||
if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form
|
||||
{
|
||||
$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false);
|
||||
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
||||
@@ -132,45 +132,45 @@ $sql .= " ORDER BY f.datef";
|
||||
dol_syslog('accountancy/journal/sellsjournal.php', LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$tabfac = array ();
|
||||
$tabht = array ();
|
||||
$tabtva = array ();
|
||||
$def_tva = array ();
|
||||
$tabttc = array ();
|
||||
$tablocaltax1 = array ();
|
||||
$tablocaltax2 = array ();
|
||||
$tabcompany = array ();
|
||||
$tabfac = array();
|
||||
$tabht = array();
|
||||
$tabtva = array();
|
||||
$def_tva = array();
|
||||
$tabttc = array();
|
||||
$tablocaltax1 = array();
|
||||
$tablocaltax2 = array();
|
||||
$tabcompany = array();
|
||||
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
// Variables
|
||||
$cptcli = (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "")) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined';
|
||||
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : 'NotDefined';
|
||||
$cpttva = (!empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : 'NotDefined';
|
||||
|
||||
$i = 0;
|
||||
while ( $i < $num ) {
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
// Controls
|
||||
$compta_soc = (! empty($obj->code_compta)) ? $obj->code_compta : $cptcli;
|
||||
$compta_soc = (!empty($obj->code_compta)) ? $obj->code_compta : $cptcli;
|
||||
|
||||
$compta_prod = $obj->compte;
|
||||
if (empty($compta_prod)) {
|
||||
if ($obj->product_type == 0)
|
||||
$compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : 'NotDefined';
|
||||
$compta_prod = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : 'NotDefined';
|
||||
else
|
||||
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : 'NotDefined';
|
||||
$compta_prod = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : 'NotDefined';
|
||||
}
|
||||
|
||||
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
||||
$compta_tva = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
$compta_localtax1 = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
$compta_localtax2 = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), $mysoc, $mysoc, 0);
|
||||
$compta_tva = (!empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
$compta_localtax1 = (!empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
$compta_localtax2 = (!empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
|
||||
// Define array to display all VAT rates that use this accounting account $compta_tva
|
||||
if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code))
|
||||
if (price2num($obj->tva_tx) || !empty($obj->vat_src_code))
|
||||
{
|
||||
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')]=(vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':''));
|
||||
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '')] = (vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''));
|
||||
}
|
||||
|
||||
$line = new FactureLigne($db);
|
||||
@@ -196,29 +196,29 @@ if ($result) {
|
||||
$tabfac[$obj->rowid]["ref"] = $obj->ref;
|
||||
$tabfac[$obj->rowid]["type"] = $obj->type;
|
||||
$tabfac[$obj->rowid]["description"] = $obj->label_compte;
|
||||
$tabfac[$obj->rowid]["close_code"] = $obj->close_code; // close_code = 'replaced' for replacement invoices (not used in most european countries)
|
||||
$tabfac[$obj->rowid]["close_code"] = $obj->close_code; // close_code = 'replaced' for replacement invoices (not used in most european countries)
|
||||
//$tabfac[$obj->rowid]["fk_facturedet"] = $obj->fdid;
|
||||
|
||||
// Avoid warnings
|
||||
if (! isset($tabttc[$obj->rowid][$compta_soc])) $tabttc[$obj->rowid][$compta_soc] = 0;
|
||||
if (! isset($tabht[$obj->rowid][$compta_prod])) $tabht[$obj->rowid][$compta_prod] = 0;
|
||||
if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0;
|
||||
if (! isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1] = 0;
|
||||
if (! isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
|
||||
if (!isset($tabttc[$obj->rowid][$compta_soc])) $tabttc[$obj->rowid][$compta_soc] = 0;
|
||||
if (!isset($tabht[$obj->rowid][$compta_prod])) $tabht[$obj->rowid][$compta_prod] = 0;
|
||||
if (!isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0;
|
||||
if (!isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1] = 0;
|
||||
if (!isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
|
||||
|
||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc * $situation_ratio;
|
||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio;
|
||||
if (empty($line->tva_npr)) $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio; // We ignore line if VAT is a NPR
|
||||
if (empty($line->tva_npr)) $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio; // We ignore line if VAT is a NPR
|
||||
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1 * $situation_ratio;
|
||||
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2 * $situation_ratio;
|
||||
$tabcompany[$obj->rowid] = array (
|
||||
$tabcompany[$obj->rowid] = array(
|
||||
'id' => $obj->socid,
|
||||
'name' => $obj->name,
|
||||
'code_client' => $obj->code_client,
|
||||
'code_compta' => $compta_soc
|
||||
);
|
||||
|
||||
$i ++;
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
@@ -229,16 +229,16 @@ $errorforinvoice = array();
|
||||
// Loop in invoices to detect lines with not binding lines
|
||||
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||
$sql = "SELECT COUNT(fd.rowid) as nb";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql.= " WHERE fd.product_type <= 2 AND fd.fk_code_ventilation <= 0";
|
||||
$sql.= " AND fd.total_ttc <> 0 AND fk_facture = ".$key;
|
||||
$resql=$db->query($sql);
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
||||
$sql .= " WHERE fd.product_type <= 2 AND fd.fk_code_ventilation <= 0";
|
||||
$sql .= " AND fd.total_ttc <> 0 AND fk_facture = ".$key;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj->nb > 0)
|
||||
{
|
||||
$errorforinvoice[$key]='somelinesarenotbound';
|
||||
$errorforinvoice[$key] = 'somelinesarenotbound';
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
@@ -282,7 +282,7 @@ if ($action == 'writebookkeeping') {
|
||||
if ($invoicestatic->close_code == Facture::CLOSECODE_REPLACED)
|
||||
{
|
||||
$replacedinvoice = 1;
|
||||
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
|
||||
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
|
||||
if ($alreadydispatched) $replacedinvoice = 2;
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@ if ($action == 'writebookkeeping') {
|
||||
}
|
||||
|
||||
// Thirdparty
|
||||
if (! $errorforline)
|
||||
if (!$errorforline)
|
||||
{
|
||||
foreach ($tabttc[$key] as $k => $mt) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
@@ -367,7 +367,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->date_creation = $now;
|
||||
$bookkeeping->doc_type = 'customer_invoice';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
@@ -392,14 +392,14 @@ if ($action == 'writebookkeeping') {
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key]='alreadyjournalized';
|
||||
$errorforinvoice[$key] = 'alreadyjournalized';
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key]='other';
|
||||
$errorforinvoice[$key] = 'other';
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
}
|
||||
@@ -454,14 +454,14 @@ if ($action == 'writebookkeeping') {
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key]='alreadyjournalized';
|
||||
$errorforinvoice[$key] = 'alreadyjournalized';
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key]='other';
|
||||
$errorforinvoice[$key] = 'other';
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
}
|
||||
@@ -471,15 +471,15 @@ if ($action == 'writebookkeeping') {
|
||||
}
|
||||
|
||||
// Protection against a bug on lines before
|
||||
if (! $errorforline && (price2num($totaldebit) != price2num($totalcredit)))
|
||||
if (!$errorforline && (price2num($totaldebit) != price2num($totalcredit)))
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key]='amountsnotbalanced';
|
||||
$errorforinvoice[$key] = 'amountsnotbalanced';
|
||||
setEventMessages('Try to insert a non balanced transaction in book for '.$invoicestatic->ref.'. Canceled. Surely a bug.', null, 'errors');
|
||||
}
|
||||
|
||||
if (! $errorforline)
|
||||
if (!$errorforline)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
@@ -490,7 +490,7 @@ if ($action == 'writebookkeeping') {
|
||||
if ($error >= 10)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped"), null, 'errors');
|
||||
break; // Break in the foreach
|
||||
break; // Break in the foreach
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -509,20 +509,20 @@ if ($action == 'writebookkeeping') {
|
||||
setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings');
|
||||
}
|
||||
|
||||
$action='';
|
||||
$action = '';
|
||||
|
||||
// Must reload data, so we make a redirect
|
||||
if (count($tabpay) != $error)
|
||||
{
|
||||
$param='id_journal='.$id_journal;
|
||||
$param.='&date_startday='.$date_startday;
|
||||
$param.='&date_startmonth='.$date_startmonth;
|
||||
$param.='&date_startyear='.$date_startyear;
|
||||
$param.='&date_endday='.$date_endday;
|
||||
$param.='&date_endmonth='.$date_endmonth;
|
||||
$param.='&date_endyear='.$date_endyear;
|
||||
$param.='&in_bookkeeping='.$in_bookkeeping;
|
||||
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||
$param = 'id_journal='.$id_journal;
|
||||
$param .= '&date_startday='.$date_startday;
|
||||
$param .= '&date_startmonth='.$date_startmonth;
|
||||
$param .= '&date_startyear='.$date_startyear;
|
||||
$param .= '&date_endday='.$date_endday;
|
||||
$param .= '&date_endmonth='.$date_endmonth;
|
||||
$param .= '&date_endyear='.$date_endyear;
|
||||
$param .= '&in_bookkeeping='.$in_bookkeeping;
|
||||
header("Location: ".$_SERVER['PHP_SELF'].($param ? '?'.$param : ''));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -541,7 +541,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
|
||||
$filename = 'journal';
|
||||
$type_export = 'journal';
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
|
||||
|
||||
$companystatic = new Client($db);
|
||||
$invoicestatic = new Facture($db);
|
||||
@@ -568,7 +568,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
if ($invoicestatic->close_code == Facture::CLOSECODE_REPLACED)
|
||||
{
|
||||
$replacedinvoice = 1;
|
||||
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
|
||||
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
|
||||
if ($alreadydispatched) $replacedinvoice = 2;
|
||||
}
|
||||
|
||||
@@ -581,18 +581,18 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
// Third party
|
||||
foreach ($tabttc[$key] as $k => $mt) {
|
||||
//if ($mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $langs->trans("Thirdparty") . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Thirdparty") . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . $journal . '"';
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["ref"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.$conf->global->ACCOUNTING_ACCOUNT_CUSTOMER.'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$invoicestatic->ref.' - '.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
print "\n";
|
||||
//}
|
||||
}
|
||||
@@ -602,18 +602,18 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
//if ($mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '""' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . $journal . '"';
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["ref"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '""'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($accountingaccount->label, 32)).'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.dol_trunc($accountingaccount->label, 32).'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
print "\n";
|
||||
//}
|
||||
}
|
||||
@@ -627,18 +627,18 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
|
||||
foreach ($arrayofvat[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '""' . $sep;
|
||||
print '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key] . ' %"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . join(', ', $def_tva[$key][$k]) .' %' . ($numtax?' - Localtax '.$numtax:'') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . $journal . '"';
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["ref"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '""'.$sep;
|
||||
print '"'.$langs->trans("VAT").' - '.$def_tva[$key].' %"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$invoicestatic->ref.' - '.$langs->trans("VAT").join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : '').'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
@@ -651,22 +651,22 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
if (empty($action) || $action == 'view') {
|
||||
llxHeader('', $langs->trans("SellsJournal"));
|
||||
|
||||
$nom = $langs->trans("SellsJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
|
||||
$nom = $langs->trans("SellsJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
|
||||
$nomlink = '';
|
||||
$periodlink = '';
|
||||
$exportlink = '';
|
||||
$builddate=dol_now();
|
||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
|
||||
$builddate = dol_now();
|
||||
$description .= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
|
||||
$description .= $langs->trans("DepositsAreNotIncluded");
|
||||
else
|
||||
$description .= $langs->trans("DepositsAreIncluded");
|
||||
|
||||
$listofchoices=array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger"));
|
||||
$period = $form->selectDate($date_start?$date_start:-1, 'date_start', 0, 0, 0, '', 1, 0) . ' - ' . $form->selectDate($date_end?$date_end:-1, 'date_end', 0, 0, 0, '', 1, 0);
|
||||
$period .= ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||
$listofchoices = array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger"));
|
||||
$period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0);
|
||||
$period .= ' - '.$langs->trans("JournalizationInLedgerStatus").' '.$form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||
|
||||
$varlink = 'id_journal=' . $id_journal;
|
||||
$varlink = 'id_journal='.$id_journal;
|
||||
|
||||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||
|
||||
@@ -677,13 +677,13 @@ if (empty($action) || $action == 'view') {
|
||||
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
}
|
||||
print '<div class="tabsAction tabsActionNoBottom">';
|
||||
if (! empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
|
||||
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />';
|
||||
}
|
||||
else {
|
||||
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
else print '<a href="#" class="butActionRefused classfortooltip" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>';
|
||||
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="'.$langs->trans("WriteBookKeeping").'" onclick="writebookkeeping();" />';
|
||||
else print '<a href="#" class="butActionRefused classfortooltip" name="writebookkeeping">'.$langs->trans("WriteBookKeeping").'</a>';
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
@@ -712,13 +712,13 @@ if (empty($action) || $action == 'view') {
|
||||
print '<div class="div-table-responsive">';
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print "<td>" . $langs->trans("Date") . "</td>";
|
||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||
print "<td>" . $langs->trans("LabelOperation") . "</td>";
|
||||
print '<td class="center">' . $langs->trans("Debit") . "</td>";
|
||||
print '<td class="center">' . $langs->trans("Credit") . "</td>";
|
||||
print "<td>".$langs->trans("Date")."</td>";
|
||||
print "<td>".$langs->trans("Piece").' ('.$langs->trans("InvoiceRef").")</td>";
|
||||
print "<td>".$langs->trans("AccountAccounting")."</td>";
|
||||
print "<td>".$langs->trans("SubledgerAccount")."</td>";
|
||||
print "<td>".$langs->trans("LabelOperation")."</td>";
|
||||
print '<td class="center">'.$langs->trans("Debit")."</td>";
|
||||
print '<td class="center">'.$langs->trans("Credit")."</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$r = '';
|
||||
@@ -748,7 +748,7 @@ if (empty($action) || $action == 'view') {
|
||||
if ($invoicestatic->close_code == Facture::CLOSECODE_REPLACED)
|
||||
{
|
||||
$replacedinvoice = 1;
|
||||
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
|
||||
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
|
||||
if ($alreadydispatched) $replacedinvoice = 2;
|
||||
}
|
||||
|
||||
@@ -757,8 +757,8 @@ if (empty($action) || $action == 'view') {
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print "<!-- Replaced invoice -->";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td><strike>" . $invoicestatic->getNomUrl(1) . "</strike></td>";
|
||||
print "<td>".$date."</td>";
|
||||
print "<td><strike>".$invoicestatic->getNomUrl(1)."</strike></td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
print $langs->trans("Replaced");
|
||||
@@ -778,8 +778,8 @@ if (empty($action) || $action == 'view') {
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print "<!-- Some lines are not bound -->";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
print "<td>".$date."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
print '<span class="error">'.$langs->trans('ErrorInvoiceContainsLinesNotYetBoundedShort', $val['ref']).'</span>';
|
||||
@@ -867,8 +867,8 @@ if (empty($action) || $action == 'view') {
|
||||
if ($mt) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<!-- VAT -->";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
print "<td>".$date."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($k);
|
||||
@@ -881,10 +881,10 @@ if (empty($action) || $action == 'view') {
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
print '</td>';
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT"). ' '.join(', ', $def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
|
||||
print "<td>".$companystatic->getNomUrl(0, 'customer', 16).' - '.$invoicestatic->ref.' - '.$langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : '');
|
||||
print "</td>";
|
||||
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print '<td class="right nowraponall">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print '<td class="right nowraponall">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ class AdherentType extends CommonObject
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut, d.duration, d.subscription, d.mail_valid, d.note, d.vote";
|
||||
$sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut as status, d.duration, d.subscription, d.mail_valid, d.note, d.vote";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
|
||||
$sql .= " WHERE d.rowid = ".(int) $rowid;
|
||||
|
||||
@@ -506,7 +506,8 @@ class AdherentType extends CommonObject
|
||||
$this->ref = $obj->rowid;
|
||||
$this->label = $obj->label;
|
||||
$this->morphy = $obj->morphy;
|
||||
$this->statut = $obj->statut;
|
||||
$this->statut = $obj->status; // deprecated
|
||||
$this->status = $obj->status;
|
||||
$this->duration = $obj->duration;
|
||||
$this->duration_value = substr($obj->duration, 0, dol_strlen($obj->duration)-1);
|
||||
$this->duration_unit = substr($obj->duration, -1);
|
||||
@@ -668,14 +669,43 @@ class AdherentType extends CommonObject
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* getLibStatut
|
||||
*
|
||||
* @return string Return status of a type of member
|
||||
*/
|
||||
public function getLibStatut()
|
||||
{
|
||||
return '';
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return label of status (activity, closed)
|
||||
*
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
|
||||
* @return string Label of status
|
||||
*/
|
||||
public function getLibStatut($mode = 0)
|
||||
{
|
||||
return $this->LibStatut($this->status, $mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the label of a given status
|
||||
*
|
||||
* @param int $status Status id
|
||||
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto
|
||||
* @return string Status label
|
||||
*/
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
$langs->load('companies');
|
||||
|
||||
$statusType = 'status4';
|
||||
if ($status == 0) $statusType = 'status5';
|
||||
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
||||
{
|
||||
$this->labelStatus[0] = $langs->trans("ActivityCeased");
|
||||
$this->labelStatus[1] = $langs->trans("InActivity");
|
||||
$this->labelStatusShort[0] = $langs->trans("ActivityCeased");
|
||||
$this->labelStatusShort[1] = $langs->trans("InActivity");
|
||||
}
|
||||
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
|
||||
@@ -36,10 +36,10 @@ $hookmanager = new HookManager($db);
|
||||
$hookmanager->initHooks(array('membersindex'));
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("companies","members"));
|
||||
$langs->loadLangs(array("companies", "members"));
|
||||
|
||||
// Security check
|
||||
$result=restrictedArea($user, 'adherent');
|
||||
$result = restrictedArea($user, 'adherent');
|
||||
|
||||
|
||||
/*
|
||||
@@ -117,7 +117,7 @@ if ($result)
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$MemberUpToDate[$objp->fk_adherent_type]=$objp->somme;
|
||||
$MemberUpToDate[$objp->fk_adherent_type] = $objp->somme;
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
@@ -128,12 +128,12 @@ if ($result)
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
|
||||
if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useless due to the global search combo
|
||||
if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useless due to the global search combo
|
||||
{
|
||||
// Search contact/address
|
||||
if (! empty($conf->adherent->enabled) && $user->rights->adherent->lire)
|
||||
if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire)
|
||||
{
|
||||
$listofsearchfields['search_member']=array('text'=>'Member');
|
||||
$listofsearchfields['search_member'] = array('text'=>'Member');
|
||||
}
|
||||
|
||||
if (count($listofsearchfields))
|
||||
@@ -142,8 +142,8 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder nohover centpercent">';
|
||||
$i=0;
|
||||
foreach($listofsearchfields as $key => $value)
|
||||
$i = 0;
|
||||
foreach ($listofsearchfields as $key => $value)
|
||||
{
|
||||
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
|
||||
print '<tr class="oddeven">';
|
||||
@@ -171,33 +171,33 @@ if ($conf->use_javascript_ajax)
|
||||
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
|
||||
print '<tr><td class="center" colspan="2">';
|
||||
|
||||
$SommeA=0;
|
||||
$SommeB=0;
|
||||
$SommeC=0;
|
||||
$SommeD=0;
|
||||
$total=0;
|
||||
$dataval=array();
|
||||
$datalabels=array();
|
||||
$i=0;
|
||||
$SommeA = 0;
|
||||
$SommeB = 0;
|
||||
$SommeC = 0;
|
||||
$SommeD = 0;
|
||||
$total = 0;
|
||||
$dataval = array();
|
||||
$datalabels = array();
|
||||
$i = 0;
|
||||
foreach ($AdherentType as $key => $adhtype)
|
||||
{
|
||||
$datalabels[]=array($i,$adhtype->getNomUrl(0, dol_size(16)));
|
||||
$dataval['draft'][]=array($i,isset($MemberToValidate[$key])?$MemberToValidate[$key]:0);
|
||||
$dataval['notuptodate'][]=array($i,isset($MembersValidated[$key])?$MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0):0);
|
||||
$dataval['uptodate'][]=array($i,isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0);
|
||||
$dataval['resiliated'][]=array($i,isset($MembersResiliated[$key])?$MembersResiliated[$key]:0);
|
||||
$SommeA+=isset($MemberToValidate[$key])?$MemberToValidate[$key]:0;
|
||||
$SommeB+=isset($MembersValidated[$key])?$MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0):0;
|
||||
$SommeC+=isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0;
|
||||
$SommeD+=isset($MembersResiliated[$key])?$MembersResiliated[$key]:0;
|
||||
$datalabels[] = array($i, $adhtype->getNomUrl(0, dol_size(16)));
|
||||
$dataval['draft'][] = array($i, isset($MemberToValidate[$key]) ? $MemberToValidate[$key] : 0);
|
||||
$dataval['notuptodate'][] = array($i, isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : 0);
|
||||
$dataval['uptodate'][] = array($i, isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0);
|
||||
$dataval['resiliated'][] = array($i, isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0);
|
||||
$SommeA += isset($MemberToValidate[$key]) ? $MemberToValidate[$key] : 0;
|
||||
$SommeB += isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : 0;
|
||||
$SommeC += isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0;
|
||||
$SommeD += isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0;
|
||||
$i++;
|
||||
}
|
||||
$total = $SommeA + $SommeB + $SommeC + $SommeD;
|
||||
$dataseries=array();
|
||||
$dataseries[]=array($langs->trans("MenuMembersNotUpToDate"), round($SommeB));
|
||||
$dataseries[]=array($langs->trans("MenuMembersUpToDate"), round($SommeC));
|
||||
$dataseries[]=array($langs->trans("MembersStatusResiliated"), round($SommeD));
|
||||
$dataseries[]=array($langs->trans("MembersStatusToValid"), round($SommeA));
|
||||
$dataseries = array();
|
||||
$dataseries[] = array($langs->trans("MenuMembersNotUpToDate"), round($SommeB));
|
||||
$dataseries[] = array($langs->trans("MenuMembersUpToDate"), round($SommeC));
|
||||
$dataseries[] = array($langs->trans("MembersStatusResiliated"), round($SommeD));
|
||||
$dataseries[] = array($langs->trans("MembersStatusToValid"), round($SommeA));
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
@@ -207,11 +207,11 @@ if ($conf->use_javascript_ajax)
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setWidth('100%');
|
||||
$dolgraph->draw('idgraphstatus');
|
||||
print $dolgraph->show($total?0:1);
|
||||
print $dolgraph->show($total ? 0 : 1);
|
||||
|
||||
print '</td></tr>';
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">';
|
||||
print $SommeA+$SommeB+$SommeC+$SommeD;
|
||||
print $SommeA + $SommeB + $SommeC + $SommeD;
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
@@ -239,11 +239,11 @@ if ($result)
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$year=dol_print_date($db->jdate($objp->dateh), "%Y");
|
||||
$Total[$year]=(isset($Total[$year])?$Total[$year]:0)+$objp->subscription;
|
||||
$Number[$year]=(isset($Number[$year])?$Number[$year]:0)+1;
|
||||
$tot+=$objp->subscription;
|
||||
$numb+=1;
|
||||
$year = dol_print_date($db->jdate($objp->dateh), "%Y");
|
||||
$Total[$year] = (isset($Total[$year]) ? $Total[$year] : 0) + $objp->subscription;
|
||||
$Number[$year] = (isset($Number[$year]) ? $Number[$year] : 0) + 1;
|
||||
$tot += $objp->subscription;
|
||||
$numb += 1;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@@ -275,7 +275,7 @@ foreach ($Total as $key=>$value)
|
||||
print "<td><a href=\"./subscription/list.php?date_select=$key\">$key</a></td>";
|
||||
print "<td class=\"right\">".$Number[$key]."</td>";
|
||||
print "<td class=\"right\">".price($value)."</td>";
|
||||
print "<td class=\"right\">".price(price2num($value/$Number[$key], 'MT'))."</td>";
|
||||
print "<td class=\"right\">".price(price2num($value / $Number[$key], 'MT'))."</td>";
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
@@ -285,7 +285,7 @@ print '<tr class="liste_total">';
|
||||
print '<td>'.$langs->trans("Total").'</td>';
|
||||
print "<td class=\"right\">".$numb."</td>";
|
||||
print '<td class="right">'.price($tot)."</td>";
|
||||
print "<td class=\"right\">".price(price2num($numb>0?($tot/$numb):0, 'MT'))."</td>";
|
||||
print "<td class=\"right\">".price(price2num($numb > 0 ? ($tot / $numb) : 0, 'MT'))."</td>";
|
||||
print "</tr>\n";
|
||||
print "</table></div>";
|
||||
print "<br>\n";
|
||||
@@ -296,18 +296,18 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
/*
|
||||
* Latest modified members
|
||||
*/
|
||||
$max=5;
|
||||
$max = 5;
|
||||
|
||||
$sql = "SELECT a.rowid, a.statut, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
|
||||
$sql.= " a.tms as datem, datefin as date_end_subscription,";
|
||||
$sql.= " ta.rowid as typeid, ta.libelle as label, ta.subscription";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta";
|
||||
$sql.= " WHERE a.entity IN (".getEntity('adherent').")";
|
||||
$sql.= " AND a.fk_adherent_type = ta.rowid";
|
||||
$sql.= $db->order("a.tms", "DESC");
|
||||
$sql.= $db->plimit($max, 0);
|
||||
$sql .= " a.tms as datem, datefin as date_end_subscription,";
|
||||
$sql .= " ta.rowid as typeid, ta.libelle as label, ta.subscription";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta";
|
||||
$sql .= " WHERE a.entity IN (".getEntity('adherent').")";
|
||||
$sql .= " AND a.fk_adherent_type = ta.rowid";
|
||||
$sql .= $db->order("a.tms", "DESC");
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
@@ -359,18 +359,18 @@ else
|
||||
/*
|
||||
* Last modified subscriptions
|
||||
*/
|
||||
$max=5;
|
||||
$max = 5;
|
||||
|
||||
$sql = "SELECT a.rowid, a.statut, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
|
||||
$sql.= " datefin as date_end_subscription,";
|
||||
$sql.= " c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.subscription";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."subscription as c";
|
||||
$sql.= " WHERE a.entity IN (".getEntity('adherent').")";
|
||||
$sql.= " AND c.fk_adherent = a.rowid";
|
||||
$sql.= $db->order("c.tms", "DESC");
|
||||
$sql.= $db->plimit($max, 0);
|
||||
$sql .= " datefin as date_end_subscription,";
|
||||
$sql .= " c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.subscription";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."subscription as c";
|
||||
$sql .= " WHERE a.entity IN (".getEntity('adherent').")";
|
||||
$sql .= " AND c.fk_adherent = a.rowid";
|
||||
$sql .= $db->order("c.tms", "DESC");
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
@@ -386,25 +386,25 @@ if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
print '<tr class="oddeven">';
|
||||
$subscriptionstatic->id=$obj->cid;
|
||||
$subscriptionstatic->ref=$obj->cid;
|
||||
$staticmember->id=$obj->rowid;
|
||||
$staticmember->lastname=$obj->lastname;
|
||||
$staticmember->firstname=$obj->firstname;
|
||||
if (! empty($obj->fk_soc)) {
|
||||
$subscriptionstatic->id = $obj->cid;
|
||||
$subscriptionstatic->ref = $obj->cid;
|
||||
$staticmember->id = $obj->rowid;
|
||||
$staticmember->lastname = $obj->lastname;
|
||||
$staticmember->firstname = $obj->firstname;
|
||||
if (!empty($obj->fk_soc)) {
|
||||
$staticmember->fk_soc = $obj->fk_soc;
|
||||
$staticmember->fetch_thirdparty();
|
||||
$staticmember->name=$staticmember->thirdparty->name;
|
||||
$staticmember->name = $staticmember->thirdparty->name;
|
||||
} else {
|
||||
$staticmember->name=$obj->company;
|
||||
$staticmember->name = $obj->company;
|
||||
}
|
||||
$staticmember->ref=$staticmember->getFullName($langs);
|
||||
$staticmember->ref = $staticmember->getFullName($langs);
|
||||
print '<td>'.$subscriptionstatic->getNomUrl(1).'</td>';
|
||||
print '<td>'.$staticmember->getNomUrl(1, 32, 'subscription').'</td>';
|
||||
print '<td>'.get_date_range($db->jdate($obj->date_start), $db->jdate($obj->date_end)).'</td>';
|
||||
print '<td class="right">'.price($obj->subscription).'</td>';
|
||||
//print '<td class="right">'.$staticmember->LibStatut($obj->statut,($obj->subscription=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($obj->datem?$obj->datem:$obj->datec), 'dayhour').'</td>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($obj->datem ? $obj->datem : $obj->datec), 'dayhour').'</td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
@@ -433,10 +433,10 @@ foreach ($AdherentType as $key => $adhtype)
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$adhtype->getNomUrl(1, dol_size(32)).'</td>';
|
||||
print '<td class="right">'.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0?$MemberToValidate[$key]:'').' '.$staticmember->LibStatut(-1, $adhtype->subscription, 0, 3).'</td>';
|
||||
print '<td class="right">'.(isset($MembersValidated[$key]) && ($MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0) > 0) ? $MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0):'').' '.$staticmember->LibStatut(1, $adhtype->subscription, 0, 3).'</td>';
|
||||
print '<td class="right">'.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1, $adhtype->subscription, $now, 3).'</td>';
|
||||
print '<td class="right">'.(isset($MembersResiliated[$key]) && $MembersResiliated[$key]> 0 ?$MembersResiliated[$key]:'').' '.$staticmember->LibStatut(0, $adhtype->subscription, 0, 3).'</td>';
|
||||
print '<td class="right">'.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0 ? $MemberToValidate[$key] : '').' '.$staticmember->LibStatut(-1, $adhtype->subscription, 0, 3).'</td>';
|
||||
print '<td class="right">'.(isset($MembersValidated[$key]) && ($MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) > 0) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : '').' '.$staticmember->LibStatut(1, $adhtype->subscription, 0, 3).'</td>';
|
||||
print '<td class="right">'.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key] : '').' '.$staticmember->LibStatut(1, $adhtype->subscription, $now, 3).'</td>';
|
||||
print '<td class="right">'.(isset($MembersResiliated[$key]) && $MembersResiliated[$key] > 0 ? $MembersResiliated[$key] : '').' '.$staticmember->LibStatut(0, $adhtype->subscription, 0, 3).'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
print '<tr class="liste_total">';
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
if (empty($conf) || !is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
@@ -32,8 +32,8 @@ $langs = $GLOBALS['langs'];
|
||||
$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
$langs->load("members");
|
||||
|
||||
$total=0;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
$total = 0;
|
||||
foreach ($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
echo '<tr class="oddeven">';
|
||||
echo '<td>'.$langs->trans("Subscription").'</td>';
|
||||
|
||||
@@ -226,7 +226,7 @@ if (!$rowid && $action != 'create' && $action != 'edit')
|
||||
{
|
||||
//dol_fiche_head('');
|
||||
|
||||
$sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.vote, d.statut, d.morphy";
|
||||
$sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.vote, d.statut as status, d.morphy";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
|
||||
$sql .= " WHERE d.entity IN (".getEntity('member_type').")";
|
||||
|
||||
@@ -280,6 +280,7 @@ if (!$rowid && $action != 'create' && $action != 'edit')
|
||||
$membertype->id = $objp->rowid;
|
||||
$membertype->ref = $objp->rowid;
|
||||
$membertype->label = $objp->rowid;
|
||||
$membertype->status = $objp->status;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
@@ -294,13 +295,7 @@ if (!$rowid && $action != 'create' && $action != 'edit')
|
||||
print '</td>';
|
||||
print '<td class="center">'.yn($objp->subscription).'</td>';
|
||||
print '<td class="center">'.yn($objp->vote).'</td>';
|
||||
print '<td class="center">';
|
||||
if (!empty($objp->statut)) {
|
||||
print img_picto($langs->trans("InActivity"), 'statut4');
|
||||
} else {
|
||||
print img_picto($langs->trans("ActivityCeased"), 'statut5');
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="center">'.$membertype->getLibStatut(5).'</td>';
|
||||
if ($user->rights->adherent->configurer)
|
||||
print '<td class="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
|
||||
else
|
||||
@@ -432,15 +427,7 @@ if ($rowid > 0)
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Status").'</td><td>';
|
||||
if (!empty($object->statut)) {
|
||||
print img_picto($langs->trans('TypeStatusActive'), 'statut4').' '.$langs->trans("InActivity");
|
||||
} else {
|
||||
print img_picto($langs->trans('TypeStatusInactive'), 'statut5').' '.$langs->trans("ActivityCeased");
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
// Morphy
|
||||
// Morphy
|
||||
print '<tr><td>'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib($object->morphy).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@@ -53,8 +53,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
|
||||
{
|
||||
$code=$reg[1];
|
||||
$value=(GETPOST($code, 'alpha') ? GETPOST($code, 'alpha') : 1);
|
||||
$code = $reg[1];
|
||||
$value = (GETPOST($code, 'alpha') ? GETPOST($code, 'alpha') : 1);
|
||||
if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
@@ -68,7 +68,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
|
||||
|
||||
if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg))
|
||||
{
|
||||
$code=$reg[1];
|
||||
$code = $reg[1];
|
||||
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
@@ -88,21 +88,21 @@ if ($action == 'set')
|
||||
}
|
||||
elseif ($action == 'specimen') // For orders
|
||||
{
|
||||
$modele=GETPOST('module', 'alpha');
|
||||
$modele = GETPOST('module', 'alpha');
|
||||
|
||||
$commande = new CommandeFournisseur($db);
|
||||
$commande->initAsSpecimen();
|
||||
$commande->thirdparty=$specimenthirdparty;
|
||||
$commande->thirdparty = $specimenthirdparty;
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
$file = ''; $classname = ''; $filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php", 0);
|
||||
$file = dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php", 0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$filefound = 1;
|
||||
$classname = "pdf_".$modele;
|
||||
break;
|
||||
}
|
||||
@@ -171,18 +171,18 @@ elseif ($action == 'setdoc')
|
||||
* View
|
||||
*/
|
||||
|
||||
$formactions=new FormActions($db);
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
$formactions = new FormActions($db);
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
$wikihelp='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
$wikihelp = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
llxHeader('', $langs->trans("AgendaSetup"), $wikihelp);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("AgendaSetup"), $linkback, 'title_setup');
|
||||
|
||||
|
||||
|
||||
$head=agenda_prepare_head();
|
||||
$head = agenda_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'other', $langs->trans("Agenda"), -1, 'action');
|
||||
|
||||
@@ -196,15 +196,15 @@ dol_fiche_head($head, 'other', $langs->trans("Agenda"), -1, 'action');
|
||||
$def = array();
|
||||
|
||||
$sql = "SELECT nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.= " WHERE type = 'action'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql .= " WHERE type = 'action'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i = 0;
|
||||
$num_rows=$db->num_rows($resql);
|
||||
$num_rows = $db->num_rows($resql);
|
||||
while ($i < $num_rows)
|
||||
{
|
||||
$array = $db->fetch_array($resql);
|
||||
@@ -239,22 +239,22 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$handle=opendir($dir);
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
||||
{
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||
$name = substr($file, 4, dol_strlen($file) - 16);
|
||||
$classname = substr($file, 0, dol_strlen($file) - 12);
|
||||
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db, new ActionComm($db));
|
||||
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print "<td>";
|
||||
print (empty($module->name)?$name:$module->name);
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td>\n";
|
||||
print "<td>\n";
|
||||
require_once $dir.$file;
|
||||
@@ -301,11 +301,11 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
print '<td class="center">';
|
||||
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
||||
print '</td>';
|
||||
@@ -353,15 +353,15 @@ print '</td></tr>'."\n";
|
||||
|
||||
// AGENDA_DEFAULT_VIEW
|
||||
print '<tr class="oddeven">'."\n";
|
||||
$htmltext=$langs->trans("ThisValueCanOverwrittenOnUserLevel", $langs->transnoentitiesnoconv("UserGUISetup"));
|
||||
$htmltext = $langs->trans("ThisValueCanOverwrittenOnUserLevel", $langs->transnoentitiesnoconv("UserGUISetup"));
|
||||
print '<td>'.$form->textwithpicto($langs->trans("AGENDA_DEFAULT_VIEW"), $htmltext).'</td>'."\n";
|
||||
print '<td class="center"> </td>'."\n";
|
||||
print '<td class="right">'."\n";
|
||||
$tmplist=array(''=>' ', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser"));
|
||||
$tmplist = array(''=>' ', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser"));
|
||||
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
print '<!-- AGENDA_USE_EVENT_TYPE_DEFAULT -->';
|
||||
print '<tr class="oddeven">'."\n";
|
||||
|
||||
@@ -45,15 +45,15 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
if ($action == 'setbarcodeproducton')
|
||||
{
|
||||
$barcodenumberingmodule = GETPOST('value', 'alpha');
|
||||
$res=dolibarr_set_const($db, "BARCODE_PRODUCT_ADDON_NUM", $barcodenumberingmodule, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "BARCODE_PRODUCT_ADDON_NUM", $barcodenumberingmodule, 'chaine', 0, '', $conf->entity);
|
||||
if ($barcodenumberingmodule == 'mod_barcode_product_standard' && empty($conf->global->BARCODE_STANDARD_PRODUCT_MASK))
|
||||
{
|
||||
$res=dolibarr_set_const($db, "BARCODE_STANDARD_PRODUCT_MASK", '020{000000000}', 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "BARCODE_STANDARD_PRODUCT_MASK", '020{000000000}', 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
}
|
||||
elseif ($action == 'setbarcodeproductoff')
|
||||
{
|
||||
$res=dolibarr_del_const($db, "BARCODE_PRODUCT_ADDON_NUM", $conf->entity);
|
||||
$res = dolibarr_del_const($db, "BARCODE_PRODUCT_ADDON_NUM", $conf->entity);
|
||||
}
|
||||
|
||||
if ($action == 'setcoder')
|
||||
@@ -61,12 +61,12 @@ if ($action == 'setcoder')
|
||||
$coder = GETPOST('coder', 'alpha');
|
||||
$code_id = GETPOST('code_id', 'alpha');
|
||||
$sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type";
|
||||
$sqlp.= " SET coder = '" . $coder."'";
|
||||
$sqlp.= " WHERE rowid = ". $code_id;
|
||||
$sqlp.= " AND entity = ".$conf->entity;
|
||||
$sqlp .= " SET coder = '".$coder."'";
|
||||
$sqlp .= " WHERE rowid = ".$code_id;
|
||||
$sqlp .= " AND entity = ".$conf->entity;
|
||||
|
||||
$resql=$db->query($sqlp);
|
||||
if (! $resql) dol_print_error($db);
|
||||
$resql = $db->query($sqlp);
|
||||
if (!$resql) dol_print_error($db);
|
||||
}
|
||||
elseif ($action == 'update')
|
||||
{
|
||||
@@ -130,33 +130,33 @@ elseif ($action == 'updateengine')
|
||||
$form = new Form($db);
|
||||
$formbarcode = new FormBarCode($db);
|
||||
|
||||
$help_url='EN:Module_Barcode|FR:Module_Codes_Barre|ES:Módulo Código de barra';
|
||||
$help_url = 'EN:Module_Barcode|FR:Module_Codes_Barre|ES:Módulo Código de barra';
|
||||
llxHeader('', $langs->trans("BarcodeSetup"), $help_url);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("BarcodeSetup"), $linkback, 'title_setup');
|
||||
|
||||
// Detect bar codes modules
|
||||
$barcodelist=array();
|
||||
$barcodelist = array();
|
||||
|
||||
clearstatcache();
|
||||
|
||||
|
||||
// Scan list of all barcode included provided by external modules
|
||||
$dirbarcode=array_merge(array("/core/modules/barcode/doc/"), $conf->modules_parts['barcode']);
|
||||
$dirbarcode = array_merge(array("/core/modules/barcode/doc/"), $conf->modules_parts['barcode']);
|
||||
|
||||
foreach($dirbarcode as $reldir)
|
||||
foreach ($dirbarcode as $reldir)
|
||||
{
|
||||
$dir=dol_buildpath($reldir);
|
||||
$newdir=dol_osencode($dir);
|
||||
$dir = dol_buildpath($reldir);
|
||||
$newdir = dol_osencode($dir);
|
||||
|
||||
// Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php)
|
||||
if (! is_dir($newdir)) continue;
|
||||
if (!is_dir($newdir)) continue;
|
||||
|
||||
$handle=@opendir($newdir);
|
||||
$handle = @opendir($newdir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
|
||||
{
|
||||
@@ -164,7 +164,7 @@ foreach($dirbarcode as $reldir)
|
||||
{
|
||||
if (preg_match('/(.*)\.modules\.php$/i', $file, $reg))
|
||||
{
|
||||
$filebis=$reg[1];
|
||||
$filebis = $reg[1];
|
||||
|
||||
// Loading encoding class
|
||||
require_once $newdir.$file;
|
||||
@@ -172,12 +172,12 @@ foreach($dirbarcode as $reldir)
|
||||
$module = new $classname($db);
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
$barcodelist[$filebis]=$module->info();
|
||||
$barcodelist[$filebis] = $module->info();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -237,17 +237,17 @@ if ($resql)
|
||||
print '<td class="center">';
|
||||
if ($obj->coder && $obj->coder != -1)
|
||||
{
|
||||
$result=0;
|
||||
$result = 0;
|
||||
|
||||
foreach($dirbarcode as $reldir)
|
||||
foreach ($dirbarcode as $reldir)
|
||||
{
|
||||
$dir=dol_buildpath($reldir, 0);
|
||||
$newdir=dol_osencode($dir);
|
||||
$dir = dol_buildpath($reldir, 0);
|
||||
$newdir = dol_osencode($dir);
|
||||
|
||||
// Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php)
|
||||
if (! is_dir($newdir)) continue;
|
||||
if (!is_dir($newdir)) continue;
|
||||
|
||||
$result=@include_once $newdir.$obj->coder.'.modules.php';
|
||||
$result = @include_once $newdir.$obj->coder.'.modules.php';
|
||||
if ($result) break;
|
||||
}
|
||||
if ($result)
|
||||
@@ -259,9 +259,9 @@ if ($resql)
|
||||
if ($module->encodingIsSupported($obj->encoding))
|
||||
{
|
||||
// Build barcode on disk (not used, this is done to make debug easier)
|
||||
$result=$module->writeBarCode($obj->example, $obj->encoding, 'Y');
|
||||
$result = $module->writeBarCode($obj->example, $obj->encoding, 'Y');
|
||||
// Generate on the fly and output barcode with generator
|
||||
$url=DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($obj->coder).'&code='.urlencode($obj->example).'&encoding='.urlencode($obj->encoding);
|
||||
$url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($obj->coder).'&code='.urlencode($obj->example).'&encoding='.urlencode($obj->encoding);
|
||||
//print $url;
|
||||
print '<img src="'.$url.'" title="'.$obj->example.'" border="0">';
|
||||
}
|
||||
@@ -317,13 +317,13 @@ print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Chemin du binaire genbarcode sous linux
|
||||
if (! isset($_SERVER['WINDIR']))
|
||||
if (!isset($_SERVER['WINDIR']))
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("GenbarcodeLocation").'</td>';
|
||||
print '<td width="60" class="center">';
|
||||
print '<input type="text" size="40" name="GENBARCODE_LOCATION" value="'.$conf->global->GENBARCODE_LOCATION.'">';
|
||||
if (! empty($conf->global->GENBARCODE_LOCATION) && ! @file_exists($conf->global->GENBARCODE_LOCATION))
|
||||
if (!empty($conf->global->GENBARCODE_LOCATION) && !@file_exists($conf->global->GENBARCODE_LOCATION))
|
||||
{
|
||||
$langs->load("errors");
|
||||
print '<br><font class="error">'.$langs->trans("ErrorFileNotFound", $conf->global->GENBARCODE_LOCATION).'</font>';
|
||||
@@ -332,7 +332,7 @@ if (! isset($_SERVER['WINDIR']))
|
||||
}
|
||||
|
||||
// Module products
|
||||
if (! empty($conf->product->enabled))
|
||||
if (!empty($conf->product->enabled))
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("SetDefaultBarcodeTypeProducts").'</td>';
|
||||
@@ -342,7 +342,7 @@ if (! empty($conf->product->enabled))
|
||||
}
|
||||
|
||||
// Module thirdparty
|
||||
if (! empty($conf->societe->enabled))
|
||||
if (!empty($conf->societe->enabled))
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("SetDefaultBarcodeTypeThirdParties").'</td>';
|
||||
@@ -375,7 +375,7 @@ if ($conf->product->enabled)
|
||||
print '<td class="center" width="60">'.$langs->trans("ShortInfo").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$dirbarcodenum=array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']);
|
||||
$dirbarcodenum = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']);
|
||||
|
||||
foreach ($dirbarcodenum as $dirroot)
|
||||
{
|
||||
@@ -384,16 +384,16 @@ if ($conf->product->enabled)
|
||||
$handle = @opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (preg_match('/^mod_barcode_product_.*php$/', $file))
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file)-4);
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
try {
|
||||
dol_include_once($dirroot.$file.'.php');
|
||||
}
|
||||
catch(Exception $e)
|
||||
catch (Exception $e)
|
||||
{
|
||||
dol_syslog($e->getMessage(), LOG_ERR);
|
||||
}
|
||||
@@ -401,7 +401,7 @@ if ($conf->product->enabled)
|
||||
$modBarCode = new $file();
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.(isset($modBarCode->name)?$modBarCode->name:$modBarCode->nom)."</td><td>\n";
|
||||
print '<td>'.(isset($modBarCode->name) ? $modBarCode->name : $modBarCode->nom)."</td><td>\n";
|
||||
print $modBarCode->info($langs);
|
||||
print '</td>';
|
||||
print '<td class="nowrap">'.$modBarCode->getExample($langs)."</td>\n";
|
||||
@@ -419,7 +419,7 @@ if ($conf->product->enabled)
|
||||
print '</a></td>';
|
||||
}
|
||||
print '<td class="center">';
|
||||
$s=$modBarCode->getToolTip($langs, null, -1);
|
||||
$s = $modBarCode->getToolTip($langs, null, -1);
|
||||
print $form->textwithpicto('', $s, 1);
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'errors', 'orders', 'other'));
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$value = GETPOST('value', 'alpha');
|
||||
@@ -56,14 +56,14 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
$maskconstorder=GETPOST('maskconstorder', 'alpha');
|
||||
$maskorder=GETPOST('maskorder', 'alpha');
|
||||
$maskconstorder = GETPOST('maskconstorder', 'alpha');
|
||||
$maskorder = GETPOST('maskorder', 'alpha');
|
||||
|
||||
if ($maskconstorder) $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@@ -75,20 +75,20 @@ if ($action == 'updateMask')
|
||||
|
||||
elseif ($action == 'specimen')
|
||||
{
|
||||
$modele=GETPOST('module', 'alpha');
|
||||
$modele = GETPOST('module', 'alpha');
|
||||
|
||||
$commande = new Commande($db);
|
||||
$commande->initAsSpecimen();
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
$file = ''; $classname = ''; $filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/commande/doc/pdf_".$modele.".modules.php", 0);
|
||||
$file = dol_buildpath($reldir."core/modules/commande/doc/pdf_".$modele.".modules.php", 0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$filefound = 1;
|
||||
$classname = "pdf_".$modele;
|
||||
break;
|
||||
}
|
||||
@@ -164,9 +164,9 @@ elseif ($action == 'set_COMMANDE_DRAFT_WATERMARK')
|
||||
$draft = GETPOST("COMMANDE_DRAFT_WATERMARK");
|
||||
$res = dolibarr_set_const($db, "COMMANDE_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@@ -178,13 +178,13 @@ elseif ($action == 'set_COMMANDE_DRAFT_WATERMARK')
|
||||
|
||||
elseif ($action == 'set_ORDER_FREE_TEXT')
|
||||
{
|
||||
$freetext = GETPOST("ORDER_FREE_TEXT", 'none'); // No alpha here, we want exact string
|
||||
$freetext = GETPOST("ORDER_FREE_TEXT", 'none'); // No alpha here, we want exact string
|
||||
|
||||
$res = dolibarr_set_const($db, "ORDER_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@@ -192,12 +192,12 @@ elseif ($action == 'set_ORDER_FREE_TEXT')
|
||||
{
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
} elseif ($action=="setshippableiconinlist") {
|
||||
} elseif ($action == "setshippableiconinlist") {
|
||||
// Activate Set Shippable Icon In List
|
||||
$setshippableiconinlist = GETPOST('value', 'int');
|
||||
$res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
if (! $error) {
|
||||
if (!$res > 0) $error++;
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
@@ -209,9 +209,9 @@ elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER')
|
||||
{
|
||||
$res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_ORDER", $value, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@@ -226,9 +226,9 @@ elseif ($action == 'set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')
|
||||
{
|
||||
$res = dolibarr_set_const($db, "WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER", $value, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@@ -243,13 +243,13 @@ elseif ($action == 'set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
llxHeader("", $langs->trans("OrdersSetup"));
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("OrdersSetup"), $linkback, 'title_setup');
|
||||
|
||||
$head = order_admin_prepare_head();
|
||||
@@ -282,18 +282,18 @@ foreach ($dirmodels as $reldir)
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (substr($file, 0, 13) == 'mod_commande_' && substr($file, dol_strlen($file)-3, 3) == 'php')
|
||||
if (substr($file, 0, 13) == 'mod_commande_' && substr($file, dol_strlen($file) - 3, 3) == 'php')
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file)-4);
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
require_once $dir.$file.'.php';
|
||||
|
||||
$module = new $file($db);
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
if ($module->isEnabled())
|
||||
@@ -304,9 +304,9 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
// Show example of numbering model
|
||||
print '<td class="nowrap">';
|
||||
$tmp=$module->getExample();
|
||||
$tmp = $module->getExample();
|
||||
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
|
||||
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
|
||||
else print $tmp;
|
||||
print '</td>'."\n";
|
||||
|
||||
@@ -323,22 +323,22 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$commande=new Commande($db);
|
||||
$commande = new Commande($db);
|
||||
$commande->initAsSpecimen();
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$commande->type=0;
|
||||
$nextval=$module->getNextValue($mysoc, $commande);
|
||||
$htmltooltip = '';
|
||||
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$commande->type = 0;
|
||||
$nextval = $module->getNextValue($mysoc, $commande);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||
$htmltooltip .= ''.$langs->trans("NextValue").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured')
|
||||
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
|
||||
$nextval = $langs->trans($nextval);
|
||||
$htmltooltip.=$nextval.'<br>';
|
||||
$htmltooltip .= $nextval.'<br>';
|
||||
} else {
|
||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||
$htmltooltip .= $langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,14 +366,14 @@ print load_fiche_titre($langs->trans("OrdersModelModule"), '', '');
|
||||
// Load array def with activated templates
|
||||
$def = array();
|
||||
$sql = "SELECT nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.= " WHERE type = '".$type."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$resql=$db->query($sql);
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql .= " WHERE type = '".$type."'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i = 0;
|
||||
$num_rows=$db->num_rows($resql);
|
||||
$num_rows = $db->num_rows($resql);
|
||||
while ($i < $num_rows)
|
||||
{
|
||||
$array = $db->fetch_array($resql);
|
||||
@@ -401,42 +401,42 @@ clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('','/doc') as $valdir)
|
||||
foreach (array('', '/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/commande".$valdir);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$handle=opendir($dir);
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
$filelist[]=$file;
|
||||
$filelist[] = $file;
|
||||
}
|
||||
closedir($handle);
|
||||
arsort($filelist);
|
||||
|
||||
foreach($filelist as $file)
|
||||
foreach ($filelist as $file)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
||||
{
|
||||
if (file_exists($dir.'/'.$file))
|
||||
{
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||
$name = substr($file, 4, dol_strlen($file) - 16);
|
||||
$classname = substr($file, 0, dol_strlen($file) - 12);
|
||||
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db);
|
||||
|
||||
$modulequalified=1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
|
||||
$modulequalified = 1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
|
||||
|
||||
if ($modulequalified)
|
||||
{
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print (empty($module->name)?$name:$module->name);
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td><td>\n";
|
||||
if (method_exists($module, 'info')) print $module->info($langs);
|
||||
else print $module->description;
|
||||
@@ -528,18 +528,18 @@ print '<td class="center" width="60">'.$langs->trans("Value").'</td>';
|
||||
print "<td> </td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
$htmltext.='</i>';
|
||||
foreach ($substitutionarray as $key => $val) $htmltext .= $key.'<br>';
|
||||
$htmltext .= '</i>';
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_ORDER_FREE_TEXT">';
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='ORDER_FREE_TEXT';
|
||||
$variablename = 'ORDER_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
|
||||
@@ -547,7 +547,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
else
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
||||
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
||||
print $doleditor->Create();
|
||||
}
|
||||
print '</td><td class="right">';
|
||||
|
||||
@@ -37,52 +37,52 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
|
||||
$action=GETPOST('action', 'aZ09');
|
||||
$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'admincompany'; // To manage different context of search
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'admincompany'; // To manage different context of search
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'companies'));
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('admincompany','globaladmin'));
|
||||
$hookmanager->initHooks(array('admincompany', 'globaladmin'));
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if ( ($action == 'update' && ! GETPOST("cancel", 'alpha'))
|
||||
|| ($action == 'updateedit') )
|
||||
if (($action == 'update' && !GETPOST("cancel", 'alpha'))
|
||||
|| ($action == 'updateedit'))
|
||||
{
|
||||
$tmparray=getCountry(GETPOST('country_id', 'int'), 'all', $db, $langs, 0);
|
||||
if (! empty($tmparray['id']))
|
||||
$tmparray = getCountry(GETPOST('country_id', 'int'), 'all', $db, $langs, 0);
|
||||
if (!empty($tmparray['id']))
|
||||
{
|
||||
$mysoc->country_id =$tmparray['id'];
|
||||
$mysoc->country_code =$tmparray['code'];
|
||||
$mysoc->country_label=$tmparray['label'];
|
||||
$mysoc->country_id = $tmparray['id'];
|
||||
$mysoc->country_code = $tmparray['code'];
|
||||
$mysoc->country_label = $tmparray['label'];
|
||||
|
||||
$s=$mysoc->country_id.':'.$mysoc->country_code.':'.$mysoc->country_label;
|
||||
$s = $mysoc->country_id.':'.$mysoc->country_code.':'.$mysoc->country_label;
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_COUNTRY", $s, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
activateModulesRequiredByCountry($mysoc->country_code);
|
||||
}
|
||||
|
||||
$tmparray=getState(GETPOST('state_id', 'int'), 'all', $db, $langs, 0);
|
||||
if (! empty($tmparray['id']))
|
||||
$tmparray = getState(GETPOST('state_id', 'int'), 'all', $db, $langs, 0);
|
||||
if (!empty($tmparray['id']))
|
||||
{
|
||||
$mysoc->state_id =$tmparray['id'];
|
||||
$mysoc->state_code =$tmparray['code'];
|
||||
$mysoc->state_label=$tmparray['label'];
|
||||
$mysoc->state_id = $tmparray['id'];
|
||||
$mysoc->state_code = $tmparray['code'];
|
||||
$mysoc->state_label = $tmparray['label'];
|
||||
|
||||
$s=$mysoc->state_id.':'.$mysoc->state_code.':'.$mysoc->state_label;
|
||||
$s = $mysoc->state_id.':'.$mysoc->state_code.':'.$mysoc->state_label;
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE", $s, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
else
|
||||
@@ -105,28 +105,28 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha'))
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE", GETPOST("note", 'none'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD", GETPOST("barcode", 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$dirforimage=$conf->mycompany->dir_output.'/logos/';
|
||||
$dirforimage = $conf->mycompany->dir_output.'/logos/';
|
||||
|
||||
$arrayofimages = array('logo', 'logo_squarred');
|
||||
|
||||
foreach($arrayofimages as $varforimage)
|
||||
foreach ($arrayofimages as $varforimage)
|
||||
{
|
||||
if ($_FILES[$varforimage]["tmp_name"])
|
||||
{
|
||||
$reg = array();
|
||||
if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg))
|
||||
{
|
||||
$original_file=$reg[1];
|
||||
$original_file = $reg[1];
|
||||
|
||||
$isimage=image_format_supported($original_file);
|
||||
$isimage = image_format_supported($original_file);
|
||||
if ($isimage >= 0)
|
||||
{
|
||||
dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file);
|
||||
if (! is_dir($dirforimage))
|
||||
if (!is_dir($dirforimage))
|
||||
{
|
||||
dol_mkdir($dirforimage);
|
||||
}
|
||||
$result=dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']);
|
||||
$result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']);
|
||||
if ($result > 0)
|
||||
{
|
||||
$constant = "MAIN_INFO_SOCIETE_LOGO";
|
||||
@@ -144,7 +144,7 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha'))
|
||||
$imgThumbSmall = vignette($dirforimage.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality);
|
||||
if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg))
|
||||
{
|
||||
$imgThumbSmall = $reg[1]; // Save only basename
|
||||
$imgThumbSmall = $reg[1]; // Save only basename
|
||||
dolibarr_set_const($db, $constant."_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
else dol_syslog($imgThumbSmall);
|
||||
@@ -153,7 +153,7 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha'))
|
||||
$imgThumbMini = vignette($dirforimage.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality);
|
||||
if (image_format_supported($imgThumbMini) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbMini, $reg))
|
||||
{
|
||||
$imgThumbMini = $reg[1]; // Save only basename
|
||||
$imgThumbMini = $reg[1]; // Save only basename
|
||||
dolibarr_set_const($db, $constant."_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
else dol_syslog($imgThumbMini);
|
||||
@@ -162,7 +162,7 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha'))
|
||||
} elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) {
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$tmparray=explode(':', $result);
|
||||
$tmparray = explode(':', $result);
|
||||
setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors');
|
||||
}
|
||||
else
|
||||
@@ -201,12 +201,12 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha'))
|
||||
$usevat = GETPOST("optiontva", 'aZ09');
|
||||
$uselocaltax1 = GETPOST("optionlocaltax1", 'aZ09');
|
||||
$uselocaltax2 = GETPOST("optionlocaltax2", 'aZ09');
|
||||
if ($uselocaltax1 == 'localtax1on' && ! $usevat)
|
||||
if ($uselocaltax1 == 'localtax1on' && !$usevat)
|
||||
{
|
||||
setEventMessages($langs->trans("IfYouUseASecondTaxYouMustSetYouUseTheMainTax"), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if ($uselocaltax2 == 'localtax2on' && ! $usevat)
|
||||
if ($uselocaltax2 == 'localtax2on' && !$usevat)
|
||||
{
|
||||
setEventMessages($langs->trans("IfYouUseAThirdTaxYouMustSetYouUseTheMainTax"), null, 'errors');
|
||||
$error++;
|
||||
@@ -216,9 +216,9 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha'))
|
||||
dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION", $uselocaltax1, 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION", $uselocaltax2, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if($_POST["optionlocaltax1"]=="localtax1on")
|
||||
if ($_POST["optionlocaltax1"] == "localtax1on")
|
||||
{
|
||||
if(!isset($_REQUEST['lt1']))
|
||||
if (!isset($_REQUEST['lt1']))
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", 0, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
@@ -228,9 +228,9 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha'))
|
||||
}
|
||||
dolibarr_set_const($db, "MAIN_INFO_LOCALTAX_CALC1", GETPOST("clt1", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if($_POST["optionlocaltax2"]=="localtax2on")
|
||||
if ($_POST["optionlocaltax2"] == "localtax2on")
|
||||
{
|
||||
if(!isset($_REQUEST['lt2']))
|
||||
if (!isset($_REQUEST['lt2']))
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", 0, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
@@ -241,7 +241,7 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha'))
|
||||
dolibarr_set_const($db, "MAIN_INFO_LOCALTAX_CALC2", GETPOST("clt2", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
@@ -250,7 +250,7 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha'))
|
||||
$db->rollback();
|
||||
}
|
||||
|
||||
if ($action != 'updateedit' && ! $error)
|
||||
if ($action != 'updateedit' && !$error)
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
@@ -261,7 +261,7 @@ if ($action == 'addthumb' || $action == 'addthumbsquarred') // Regenerate thumb
|
||||
{
|
||||
if (file_exists($conf->mycompany->dir_output.'/logos/'.$_GET["file"]))
|
||||
{
|
||||
$isimage=image_format_supported($_GET["file"]);
|
||||
$isimage = image_format_supported($_GET["file"]);
|
||||
|
||||
// Create thumbs of logo
|
||||
if ($isimage > 0)
|
||||
@@ -278,7 +278,7 @@ if ($action == 'addthumb' || $action == 'addthumbsquarred') // Regenerate thumb
|
||||
$imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthsmall, $maxheightsmall, '_small', $quality);
|
||||
if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg))
|
||||
{
|
||||
$imgThumbSmall = $reg[1]; // Save only basename
|
||||
$imgThumbSmall = $reg[1]; // Save only basename
|
||||
dolibarr_set_const($db, $constant."_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
else dol_syslog($imgThumbSmall);
|
||||
@@ -287,7 +287,7 @@ if ($action == 'addthumb' || $action == 'addthumbsquarred') // Regenerate thumb
|
||||
$imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthmini, $maxheightmini, '_mini', $quality);
|
||||
if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbMini, $reg))
|
||||
{
|
||||
$imgThumbMini = $reg[1]; // Save only basename
|
||||
$imgThumbMini = $reg[1]; // Save only basename
|
||||
dolibarr_set_const($db, $constant."_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
else dol_syslog($imgThumbMini);
|
||||
@@ -328,11 +328,11 @@ if ($action == 'removelogo' || $action == 'removelogosquarred')
|
||||
$logofilenamebis = $mysoc->logo;
|
||||
}
|
||||
|
||||
$logofile=$conf->mycompany->dir_output.'/logos/'.$logofilename;
|
||||
$logofile = $conf->mycompany->dir_output.'/logos/'.$logofilename;
|
||||
if ($logofilename != '' && $logofilename != $logofilenamebis) dol_delete_file($logofile);
|
||||
dolibarr_del_const($db, $constant, $conf->entity);
|
||||
if ($action == 'removelogosquarred') $mysoc->logo_squarred='';
|
||||
else $mysoc->logo='';
|
||||
if ($action == 'removelogosquarred') $mysoc->logo_squarred = '';
|
||||
else $mysoc->logo = '';
|
||||
|
||||
$logofilename = $mysoc->logo_small;
|
||||
$logofilenamebis = $mysoc->logo_squarred_small;
|
||||
@@ -342,11 +342,11 @@ if ($action == 'removelogo' || $action == 'removelogosquarred')
|
||||
$logofilenamebis = $mysoc->logo_small;
|
||||
}
|
||||
|
||||
$logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$logofilename;
|
||||
$logosmallfile = $conf->mycompany->dir_output.'/logos/thumbs/'.$logofilename;
|
||||
if ($logofilename != '' && $logofilename != $logofilenamebis) dol_delete_file($logosmallfile);
|
||||
dolibarr_del_const($db, $constant."_SMALL", $conf->entity);
|
||||
if ($action == 'removelogosquarred') $mysoc->logo_squarred_small='';
|
||||
else $mysoc->logo_small='';
|
||||
if ($action == 'removelogosquarred') $mysoc->logo_squarred_small = '';
|
||||
else $mysoc->logo_small = '';
|
||||
|
||||
$logofilename = $mysoc->logo_mini;
|
||||
$logofilenamebis = $mysoc->logo_squarred_mini;
|
||||
@@ -356,11 +356,11 @@ if ($action == 'removelogo' || $action == 'removelogosquarred')
|
||||
$logofilenamebis = $mysoc->logo_mini;
|
||||
}
|
||||
|
||||
$logominifile=$conf->mycompany->dir_output.'/logos/thumbs/'.$logofilename;
|
||||
$logominifile = $conf->mycompany->dir_output.'/logos/thumbs/'.$logofilename;
|
||||
if ($logofilename != '' && $logofilename != $logofilenamebis) dol_delete_file($logominifile);
|
||||
dolibarr_del_const($db, $constant."_MINI", $conf->entity);
|
||||
if ($action == 'removelogosquarred') $mysoc->logo_squarred_mini='';
|
||||
else $mysoc->logo_mini='';
|
||||
if ($action == 'removelogosquarred') $mysoc->logo_squarred_mini = '';
|
||||
else $mysoc->logo_mini = '';
|
||||
}
|
||||
|
||||
|
||||
@@ -368,14 +368,14 @@ if ($action == 'removelogo' || $action == 'removelogosquarred')
|
||||
* View
|
||||
*/
|
||||
|
||||
$wikihelp='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
|
||||
$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
|
||||
llxHeader('', $langs->trans("Setup"), $wikihelp);
|
||||
|
||||
$form=new Form($db);
|
||||
$formother=new FormOther($db);
|
||||
$formcompany=new FormCompany($db);
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
|
||||
$countrynotdefined='<font class="error">'.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')</font>';
|
||||
$countrynotdefined = '<font class="error">'.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')</font>';
|
||||
|
||||
print load_fiche_titre($langs->trans("CompanyFoundation"), '', 'title_setup');
|
||||
|
||||
@@ -434,11 +434,11 @@ print '</td></tr>'."\n";
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">';
|
||||
$state_id=0;
|
||||
if (! empty($conf->global->MAIN_INFO_SOCIETE_STATE))
|
||||
$state_id = 0;
|
||||
if (!empty($conf->global->MAIN_INFO_SOCIETE_STATE))
|
||||
{
|
||||
$tmp=explode(':', $conf->global->MAIN_INFO_SOCIETE_STATE);
|
||||
$state_id=$tmp[0];
|
||||
$tmp = explode(':', $conf->global->MAIN_INFO_SOCIETE_STATE);
|
||||
$state_id = $tmp[0];
|
||||
}
|
||||
$formcompany->select_departement($state_id, $mysoc->country_code, 'state_id');
|
||||
print '</td></tr>'."\n";
|
||||
@@ -450,28 +450,28 @@ print '</td></tr>'."\n";
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
|
||||
print '<input name="tel" id="phone" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TEL) . '"></td></tr>';
|
||||
print '<input name="tel" id="phone" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TEL).'"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
|
||||
print '<input name="fax" id="fax" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_FAX) . '"></td></tr>';
|
||||
print '<input name="fax" id="fax" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_FAX).'"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
|
||||
print '<input name="mail" id="email" class="minwidth200" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MAIL) . '"></td></tr>';
|
||||
print '<input name="mail" id="email" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MAIL).'"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Web
|
||||
print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>';
|
||||
print '<input name="web" id="web" class="minwidth300" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_WEB) . '"></td></tr>';
|
||||
print '<input name="web" id="web" class="minwidth300" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_WEB).'"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Barcode
|
||||
if (! empty($conf->barcode->enabled)) {
|
||||
if (!empty($conf->barcode->enabled)) {
|
||||
print '<tr class="oddeven"><td><label for="barcode">'.$langs->trans("Gencod").'</label></td><td>';
|
||||
print '<input name="barcode" id="barcode" class="minwidth150" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_GENCOD) . '"></td></tr>';
|
||||
print '<input name="barcode" id="barcode" class="minwidth150" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_GENCOD).'"></td></tr>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@@ -480,7 +480,7 @@ print '<tr class="oddeven"><td><label for="logo">'.$form->textwithpicto($langs->
|
||||
print '<table width="100%" class="nobordernopadding"><tr class="nocellnopadd"><td valign="middle" class="nocellnopadd">';
|
||||
print '<input type="file" class="flat minwidth200" name="logo" id="logo" accept="image/*">';
|
||||
print '</td><td class="nocellnopadd right" valign="middle">';
|
||||
if (! empty($mysoc->logo_mini)) {
|
||||
if (!empty($mysoc->logo_mini)) {
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete")).'</a>';
|
||||
if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) {
|
||||
print ' ';
|
||||
@@ -497,7 +497,7 @@ print '<tr class="oddeven"><td><label for="logo_squarred">'.$form->textwithpicto
|
||||
print '<table width="100%" class="nobordernopadding"><tr class="nocellnopadd"><td valign="middle" class="nocellnopadd">';
|
||||
print '<input type="file" class="flat minwidth200" name="logo_squarred" id="logo_squarred" accept="image/*">';
|
||||
print '</td><td class="nocellnopadd right" valign="middle">';
|
||||
if (! empty($mysoc->logo_squarred_mini)) {
|
||||
if (!empty($mysoc->logo_squarred_mini)) {
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred">'.img_delete($langs->trans("Delete")).'</a>';
|
||||
if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) {
|
||||
print ' ';
|
||||
@@ -527,19 +527,19 @@ $langs->load("companies");
|
||||
// Managing Director(s)
|
||||
|
||||
print '<tr class="oddeven"><td><label for="director">'.$langs->trans("ManagingDirectors").'</label></td><td>';
|
||||
print '<input name="MAIN_INFO_SOCIETE_MANAGERS" id="director" class="minwidth200" value="' . dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MANAGERS) . '"></td></tr>';
|
||||
print '<input name="MAIN_INFO_SOCIETE_MANAGERS" id="director" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MANAGERS).'"></td></tr>';
|
||||
|
||||
// GDPR contact
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc"));
|
||||
print '</td><td>';
|
||||
print '<input name="MAIN_INFO_GDPR" id="director" class="minwidth500" value="' . dol_escape_htmltag($conf->global->MAIN_INFO_GDPR) . '"></td></tr>';
|
||||
print '<input name="MAIN_INFO_GDPR" id="director" class="minwidth500" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_GDPR).'"></td></tr>';
|
||||
|
||||
// Capital
|
||||
|
||||
print '<tr class="oddeven"><td><label for="capital">'.$langs->trans("Capital").'</label></td><td>';
|
||||
print '<input name="capital" id="capital" class="minwidth100" value="' . dol_escape_htmltag($conf->global->MAIN_INFO_CAPITAL) . '"></td></tr>';
|
||||
print '<input name="capital" id="capital" class="minwidth100" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_CAPITAL).'"></td></tr>';
|
||||
|
||||
// Juridical Status
|
||||
|
||||
@@ -555,9 +555,9 @@ print '</td></tr>';
|
||||
if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-')
|
||||
{
|
||||
print '<tr class="oddeven"><td><label for="profid1">'.$langs->transcountry("ProfId1", $mysoc->country_code).'</label></td><td>';
|
||||
if (! empty($mysoc->country_code))
|
||||
if (!empty($mysoc->country_code))
|
||||
{
|
||||
print '<input name="siren" id="profid1" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_SIREN) ? $conf->global->MAIN_INFO_SIREN : '') . '">';
|
||||
print '<input name="siren" id="profid1" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_SIREN) ? $conf->global->MAIN_INFO_SIREN : '').'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -570,9 +570,9 @@ if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-')
|
||||
if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-')
|
||||
{
|
||||
print '<tr class="oddeven"><td><label for="profid2">'.$langs->transcountry("ProfId2", $mysoc->country_code).'</label></td><td>';
|
||||
if (! empty($mysoc->country_code))
|
||||
if (!empty($mysoc->country_code))
|
||||
{
|
||||
print '<input name="siret" id="profid2" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_SIRET) ? $conf->global->MAIN_INFO_SIRET : '') . '">';
|
||||
print '<input name="siret" id="profid2" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_SIRET) ? $conf->global->MAIN_INFO_SIRET : '').'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -585,9 +585,9 @@ if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-')
|
||||
if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-')
|
||||
{
|
||||
print '<tr class="oddeven"><td><label for="profid3">'.$langs->transcountry("ProfId3", $mysoc->country_code).'</label></td><td>';
|
||||
if (! empty($mysoc->country_code))
|
||||
if (!empty($mysoc->country_code))
|
||||
{
|
||||
print '<input name="ape" id="profid3" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_APE) ? $conf->global->MAIN_INFO_APE : '') . '">';
|
||||
print '<input name="ape" id="profid3" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_APE) ? $conf->global->MAIN_INFO_APE : '').'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -600,9 +600,9 @@ if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-')
|
||||
if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-')
|
||||
{
|
||||
print '<tr class="oddeven"><td><label for="profid4">'.$langs->transcountry("ProfId4", $mysoc->country_code).'</label></td><td>';
|
||||
if (! empty($mysoc->country_code))
|
||||
if (!empty($mysoc->country_code))
|
||||
{
|
||||
print '<input name="rcs" id="profid4" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_RCS) ? $conf->global->MAIN_INFO_RCS : '') . '">';
|
||||
print '<input name="rcs" id="profid4" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_RCS) ? $conf->global->MAIN_INFO_RCS : '').'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -615,9 +615,9 @@ if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-')
|
||||
if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-')
|
||||
{
|
||||
print '<tr class="oddeven"><td><label for="profid5">'.$langs->transcountry("ProfId5", $mysoc->country_code).'</label></td><td>';
|
||||
if (! empty($mysoc->country_code))
|
||||
if (!empty($mysoc->country_code))
|
||||
{
|
||||
print '<input name="MAIN_INFO_PROFID5" id="profid5" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_PROFID5) ? $conf->global->MAIN_INFO_PROFID5 : '') . '">';
|
||||
print '<input name="MAIN_INFO_PROFID5" id="profid5" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_PROFID5) ? $conf->global->MAIN_INFO_PROFID5 : '').'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -630,9 +630,9 @@ if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-')
|
||||
if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-')
|
||||
{
|
||||
print '<tr class="oddeven"><td><label for="profid6">'.$langs->transcountry("ProfId6", $mysoc->country_code).'</label></td><td>';
|
||||
if (! empty($mysoc->country_code))
|
||||
if (!empty($mysoc->country_code))
|
||||
{
|
||||
print '<input name="MAIN_INFO_PROFID6" id="profid6" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_PROFID6) ? $conf->global->MAIN_INFO_PROFID6 : '') . '">';
|
||||
print '<input name="MAIN_INFO_PROFID6" id="profid6" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_PROFID6) ? $conf->global->MAIN_INFO_PROFID6 : '').'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -644,13 +644,13 @@ if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-')
|
||||
// TVA Intra
|
||||
|
||||
print '<tr class="oddeven"><td><label for="intra_vat">'.$langs->trans("VATIntra").'</label></td><td>';
|
||||
print '<input name="tva" id="intra_vat" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_TVAINTRA) ? $conf->global->MAIN_INFO_TVAINTRA : '') . '">';
|
||||
print '<input name="tva" id="intra_vat" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_TVAINTRA) ? $conf->global->MAIN_INFO_TVAINTRA : '').'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Object of the company
|
||||
|
||||
print '<tr class="oddeven"><td><label for="object">'.$langs->trans("CompanyObject").'</label></td><td>';
|
||||
print '<textarea class="flat quatrevingtpercent" name="object" id="object" rows="'.ROWS_5.'">'.(! empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? $conf->global->MAIN_INFO_SOCIETE_OBJECT : '').'</textarea></td></tr>';
|
||||
print '<textarea class="flat quatrevingtpercent" name="object" id="object" rows="'.ROWS_5.'">'.(!empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? $conf->global->MAIN_INFO_SOCIETE_OBJECT : '').'</textarea></td></tr>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@@ -664,7 +664,7 @@ print '<td class="titlefield">'.$langs->trans("FiscalYearInformation").'</td><td
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven"><td><label for="SOCIETE_FISCAL_MONTH_START">'.$langs->trans("FiscalMonthStart").'</label></td><td>';
|
||||
print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START, 'SOCIETE_FISCAL_MONTH_START', 0, 1, 'maxwidth100') . '</td></tr>';
|
||||
print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START, 'SOCIETE_FISCAL_MONTH_START', 0, 1, 'maxwidth100').'</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
@@ -678,7 +678,7 @@ print '<td class="right"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
print "<tr class=\"oddeven\"><td width=\"140\"><label><input type=\"radio\" name=\"optiontva\" id=\"use_vat\" value=\"1\"".(empty($conf->global->FACTURE_TVAOPTION)?"":" checked")."> ".$langs->trans("VATIsUsed")."</label></td>";
|
||||
print "<tr class=\"oddeven\"><td width=\"140\"><label><input type=\"radio\" name=\"optiontva\" id=\"use_vat\" value=\"1\"".(empty($conf->global->FACTURE_TVAOPTION) ? "" : " checked")."> ".$langs->trans("VATIsUsed")."</label></td>";
|
||||
print '<td colspan="2">';
|
||||
print "<table>";
|
||||
print "<tr><td><label for=\"use_vat\">".$langs->trans("VATIsUsedDesc")."</label></td></tr>";
|
||||
@@ -687,7 +687,7 @@ print "</table>";
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
||||
print "<tr class=\"oddeven\"><td width=\"140\"><label><input type=\"radio\" name=\"optiontva\" id=\"no_vat\" value=\"0\"".(empty($conf->global->FACTURE_TVAOPTION)?" checked":"")."> ".$langs->trans("VATIsNotUsed")."</label></td>";
|
||||
print "<tr class=\"oddeven\"><td width=\"140\"><label><input type=\"radio\" name=\"optiontva\" id=\"no_vat\" value=\"0\"".(empty($conf->global->FACTURE_TVAOPTION) ? " checked" : "")."> ".$langs->trans("VATIsNotUsed")."</label></td>";
|
||||
print '<td colspan="2">';
|
||||
print "<table>";
|
||||
print "<tr><td><label for=\"no_vat\">".$langs->trans("VATIsNotUsedDesc")."</label></td></tr>";
|
||||
@@ -711,20 +711,20 @@ if ($mysoc->useLocalTax(1))
|
||||
print "</tr>\n";
|
||||
|
||||
// Note: When option is not set, it must not appears as set on on, because there is no default value for this option
|
||||
print "<tr class=\"oddeven\"><td width=\"140\"><input type=\"radio\" name=\"optionlocaltax1\" id=\"lt1\" value=\"localtax1on\"".(($conf->global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on")?" checked":"")."> ".$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code)."</td>";
|
||||
print "<tr class=\"oddeven\"><td width=\"140\"><input type=\"radio\" name=\"optionlocaltax1\" id=\"lt1\" value=\"localtax1on\"".(($conf->global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on") ? " checked" : "")."> ".$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code)."</td>";
|
||||
print '<td colspan="2">';
|
||||
print '<table class="nobordernopadding">';
|
||||
print "<tr><td><label for=\"lt1\">".$langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code)."</label></td></tr>";
|
||||
$example=$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code);
|
||||
print ($example!="LocalTax1IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code)."</i></td></tr>\n":"");
|
||||
if(! isOnlyOneLocalTax(1))
|
||||
$example = $langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code);
|
||||
print ($example != "LocalTax1IsUsedExample" ? "<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code)."</i></td></tr>\n" : "");
|
||||
if (!isOnlyOneLocalTax(1))
|
||||
{
|
||||
print '<tr><td class="left"><label for="lt1">'.$langs->trans("LTRate").'</label>: ';
|
||||
$formcompany->select_localtax(1, $conf->global->MAIN_INFO_VALUE_LOCALTAX1, "lt1");
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
$opcions=array($langs->trans("CalcLocaltax1").' '.$langs->trans("CalcLocaltax1Desc"),$langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"),$langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc"));
|
||||
$opcions = array($langs->trans("CalcLocaltax1").' '.$langs->trans("CalcLocaltax1Desc"), $langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"), $langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc"));
|
||||
|
||||
print '<tr><td class="left"></label for="clt1">'.$langs->trans("CalcLocaltax").'</label>: ';
|
||||
print $form->selectarray("clt1", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC1);
|
||||
@@ -733,12 +733,12 @@ if ($mysoc->useLocalTax(1))
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
||||
print "<tr class=\"oddeven\"><td width=\"140\"><input type=\"radio\" name=\"optionlocaltax1\" id=\"nolt1\" value=\"localtax1off\"".((empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off")?" checked":"")."> ".$langs->transcountry("LocalTax1IsNotUsed", $mysoc->country_code)."</td>";
|
||||
print "<tr class=\"oddeven\"><td width=\"140\"><input type=\"radio\" name=\"optionlocaltax1\" id=\"nolt1\" value=\"localtax1off\"".((empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off") ? " checked" : "")."> ".$langs->transcountry("LocalTax1IsNotUsed", $mysoc->country_code)."</td>";
|
||||
print '<td colspan="2">';
|
||||
print "<table>";
|
||||
print "<tr><td><label for=\"nolt1\">".$langs->transcountry("LocalTax1IsNotUsedDesc", $mysoc->country_code)."</label></td></tr>";
|
||||
$example=$langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code);
|
||||
print ($example!="LocalTax1IsNotUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code)."</i></td></tr>\n":"");
|
||||
$example = $langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code);
|
||||
print ($example != "LocalTax1IsNotUsedExample" ? "<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsNotUsedExample", $mysoc->country_code)."</i></td></tr>\n" : "");
|
||||
print "</table>";
|
||||
print "</td></tr>\n";
|
||||
print "</table>";
|
||||
@@ -755,13 +755,13 @@ if ($mysoc->useLocalTax(2))
|
||||
|
||||
|
||||
// Note: When option is not set, it must not appears as set on on, because there is no default value for this option
|
||||
print "<tr class=\"oddeven\"><td width=\"140\"><input type=\"radio\" name=\"optionlocaltax2\" id=\"lt2\" value=\"localtax2on\"".(($conf->global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on")?" checked":"")."> ".$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code)."</td>";
|
||||
print "<tr class=\"oddeven\"><td width=\"140\"><input type=\"radio\" name=\"optionlocaltax2\" id=\"lt2\" value=\"localtax2on\"".(($conf->global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on") ? " checked" : "")."> ".$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code)."</td>";
|
||||
print '<td colspan="2">';
|
||||
print '<table class="nobordernopadding">';
|
||||
print "<tr><td><label for=\"lt2\">".$langs->transcountry("LocalTax2IsUsedDesc", $mysoc->country_code)."</label></td></tr>";
|
||||
$example=$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code);
|
||||
print ($example!="LocalTax2IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code)."</i></td></tr>\n":"");
|
||||
if(! isOnlyOneLocalTax(2))
|
||||
$example = $langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code);
|
||||
print ($example != "LocalTax2IsUsedExample" ? "<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code)."</i></td></tr>\n" : "");
|
||||
if (!isOnlyOneLocalTax(2))
|
||||
{
|
||||
print '<tr><td class="left"><label for="lt2">'.$langs->trans("LTRate").'</label>: ';
|
||||
$formcompany->select_localtax(2, $conf->global->MAIN_INFO_VALUE_LOCALTAX2, "lt2");
|
||||
@@ -774,12 +774,12 @@ if ($mysoc->useLocalTax(2))
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
||||
print "<tr class=\"oddeven\"><td width=\"140\"><input type=\"radio\" name=\"optionlocaltax2\" id=\"nolt2\" value=\"localtax2off\"".((empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2off")?" checked":"")."> ".$langs->transcountry("LocalTax2IsNotUsed", $mysoc->country_code)."</td>";
|
||||
print "<tr class=\"oddeven\"><td width=\"140\"><input type=\"radio\" name=\"optionlocaltax2\" id=\"nolt2\" value=\"localtax2off\"".((empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2off") ? " checked" : "")."> ".$langs->transcountry("LocalTax2IsNotUsed", $mysoc->country_code)."</td>";
|
||||
print '<td colspan="2">';
|
||||
print "<table>";
|
||||
print "<tr><td><label for=\"nolt2\">".$langs->transcountry("LocalTax2IsNotUsedDesc", $mysoc->country_code)."</label></td></tr>";
|
||||
$example=$langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code);
|
||||
print ($example!="LocalTax2IsNotUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code)."</i></td></tr>\n":"");
|
||||
$example = $langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code);
|
||||
print ($example != "LocalTax2IsNotUsedExample" ? "<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample", $mysoc->country_code)."</i></td></tr>\n" : "");
|
||||
print "</table>";
|
||||
print "</td></tr>\n";
|
||||
print "</table>";
|
||||
|
||||
@@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("admin","errors","contracts"));
|
||||
$langs->loadLangs(array("admin", "errors", "contracts"));
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
@@ -37,11 +37,11 @@ $action = GETPOST('action', 'alpha');
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
$type='contract';
|
||||
$type = 'contract';
|
||||
|
||||
if (empty($conf->global->CONTRACT_ADDON))
|
||||
{
|
||||
$conf->global->CONTRACT_ADDON='mod_contract_serpis';
|
||||
$conf->global->CONTRACT_ADDON = 'mod_contract_serpis';
|
||||
}
|
||||
|
||||
|
||||
@@ -54,12 +54,12 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
$maskconst = GETPOST('maskconstcontract', 'alpha');
|
||||
$maskvalue = GETPOST('maskcontract', 'alpha');
|
||||
$maskvalue = GETPOST('maskcontract', 'alpha');
|
||||
if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@@ -71,20 +71,20 @@ if ($action == 'updateMask')
|
||||
|
||||
elseif ($action == 'specimen') // For contract
|
||||
{
|
||||
$modele= GETPOST('module', 'alpha');
|
||||
$modele = GETPOST('module', 'alpha');
|
||||
|
||||
$contract = new Contrat($db);
|
||||
$contract->initAsSpecimen();
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
$file = ''; $classname = ''; $filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/contract/doc/pdf_".$modele.".modules.php", 0);
|
||||
$file = dol_buildpath($reldir."core/modules/contract/doc/pdf_".$modele.".modules.php", 0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$filefound = 1;
|
||||
$classname = "pdf_".$modele;
|
||||
break;
|
||||
}
|
||||
@@ -157,15 +157,15 @@ elseif ($action == 'setmod')
|
||||
|
||||
elseif ($action == 'set_other')
|
||||
{
|
||||
$freetext= GETPOST('CONTRACT_FREE_TEXT', 'none'); // No alpha here, we want exact string
|
||||
$freetext = GETPOST('CONTRACT_FREE_TEXT', 'none'); // No alpha here, we want exact string
|
||||
$res1 = dolibarr_set_const($db, "CONTRACT_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$draft= GETPOST('CONTRACT_DRAFT_WATERMARK', 'alpha');
|
||||
$draft = GETPOST('CONTRACT_DRAFT_WATERMARK', 'alpha');
|
||||
$res2 = dolibarr_set_const($db, "CONTRACT_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res1 > 0 || ! $res2 > 0) $error++;
|
||||
if (!$res1 > 0 || !$res2 > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@@ -180,16 +180,16 @@ elseif ($action == 'set_other')
|
||||
* View
|
||||
*/
|
||||
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
llxHeader();
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("ContractsSetup"), $linkback, 'title_setup');
|
||||
|
||||
$head=contract_admin_prepare_head();
|
||||
$head = contract_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'contract', $langs->trans("Contracts"), -1, 'contract');
|
||||
|
||||
@@ -219,18 +219,18 @@ foreach ($dirmodels as $reldir)
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (substr($file, 0, 13) == 'mod_contract_' && substr($file, dol_strlen($file)-3, 3) == 'php')
|
||||
if (substr($file, 0, 13) == 'mod_contract_' && substr($file, dol_strlen($file) - 3, 3) == 'php')
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file)-4);
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
require_once $dir.$file.'.php';
|
||||
|
||||
$module = new $file($db);
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
if ($module->isEnabled())
|
||||
@@ -241,9 +241,9 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
// Show example of numbering model
|
||||
print '<td class="nowrap">';
|
||||
$tmp=$module->getExample();
|
||||
$tmp = $module->getExample();
|
||||
if (preg_match('/^Error/', $tmp)) { $langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>'; }
|
||||
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
|
||||
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
|
||||
else print $tmp;
|
||||
print '</td>'."\n";
|
||||
|
||||
@@ -260,21 +260,21 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$contract=new Contrat($db);
|
||||
$contract = new Contrat($db);
|
||||
$contract->initAsSpecimen();
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$nextval=$module->getNextValue($mysoc, $contract);
|
||||
$htmltooltip = '';
|
||||
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$nextval = $module->getNextValue($mysoc, $contract);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||
$htmltooltip .= ''.$langs->trans("NextValue").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured')
|
||||
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
|
||||
$nextval = $langs->trans($nextval);
|
||||
$htmltooltip.=$nextval.'<br>';
|
||||
$htmltooltip .= $nextval.'<br>';
|
||||
} else {
|
||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||
$htmltooltip .= $langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,14 +302,14 @@ print load_fiche_titre($langs->trans("TemplatePDFContracts"), '', '');
|
||||
// Defini tableau def des modeles
|
||||
$def = array();
|
||||
$sql = "SELECT nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.= " WHERE type = '".$type."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$resql=$db->query($sql);
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql .= " WHERE type = '".$type."'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i = 0;
|
||||
$num_rows=$db->num_rows($resql);
|
||||
$num_rows = $db->num_rows($resql);
|
||||
while ($i < $num_rows)
|
||||
{
|
||||
$array = $db->fetch_array($resql);
|
||||
@@ -337,42 +337,42 @@ clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('','/doc') as $valdir)
|
||||
foreach (array('', '/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/contract".$valdir);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$handle=opendir($dir);
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
$filelist[]=$file;
|
||||
$filelist[] = $file;
|
||||
}
|
||||
closedir($handle);
|
||||
arsort($filelist);
|
||||
|
||||
foreach($filelist as $file)
|
||||
foreach ($filelist as $file)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
||||
{
|
||||
if (file_exists($dir.'/'.$file))
|
||||
{
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||
$name = substr($file, 4, dol_strlen($file) - 16);
|
||||
$classname = substr($file, 0, dol_strlen($file) - 12);
|
||||
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db);
|
||||
|
||||
$modulequalified=1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
|
||||
$modulequalified = 1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
|
||||
|
||||
if ($modulequalified)
|
||||
{
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print (empty($module->name)?$name:$module->name);
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td><td>\n";
|
||||
if (method_exists($module, 'info')) print $module->info($langs);
|
||||
else print $module->description;
|
||||
@@ -466,16 +466,16 @@ print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td class="center" width="60">'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$substitutionarray = pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
$htmltext.='</i>';
|
||||
foreach ($substitutionarray as $key => $val) $htmltext .= $key.'<br>';
|
||||
$htmltext .= '</i>';
|
||||
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnContracts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
|
||||
print '<br>';
|
||||
$variablename='CONTRACT_FREE_TEXT';
|
||||
$variablename = 'CONTRACT_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
|
||||
@@ -483,7 +483,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
else
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
||||
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
||||
print $doleditor->Create();
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
@@ -37,13 +37,13 @@ require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'errors', 'interventions', 'other'));
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
$type='ficheinter';
|
||||
$type = 'ficheinter';
|
||||
|
||||
|
||||
/*
|
||||
@@ -54,13 +54,13 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
$maskconst=GETPOST('maskconst', 'alpha');
|
||||
$maskvalue=GETPOST('maskvalue', 'alpha');
|
||||
$maskconst = GETPOST('maskconst', 'alpha');
|
||||
$maskvalue = GETPOST('maskvalue', 'alpha');
|
||||
if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@@ -72,20 +72,20 @@ if ($action == 'updateMask')
|
||||
|
||||
elseif ($action == 'specimen') // For fiche inter
|
||||
{
|
||||
$modele= GETPOST('module', 'alpha');
|
||||
$modele = GETPOST('module', 'alpha');
|
||||
|
||||
$inter = new Fichinter($db);
|
||||
$inter->initAsSpecimen();
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
$file = ''; $classname = ''; $filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/fichinter/doc/pdf_".$modele.".modules.php", 0);
|
||||
$file = dol_buildpath($reldir."core/modules/fichinter/doc/pdf_".$modele.".modules.php", 0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$filefound = 1;
|
||||
$classname = "pdf_".$modele;
|
||||
break;
|
||||
}
|
||||
@@ -158,12 +158,12 @@ elseif ($action == 'setmod')
|
||||
|
||||
elseif ($action == 'set_FICHINTER_FREE_TEXT')
|
||||
{
|
||||
$freetext= GETPOST('FICHINTER_FREE_TEXT', 'none'); // No alpha here, we want exact string
|
||||
$freetext = GETPOST('FICHINTER_FREE_TEXT', 'none'); // No alpha here, we want exact string
|
||||
$res = dolibarr_set_const($db, "FICHINTER_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@@ -175,12 +175,12 @@ elseif ($action == 'set_FICHINTER_FREE_TEXT')
|
||||
|
||||
elseif ($action == 'set_FICHINTER_DRAFT_WATERMARK')
|
||||
{
|
||||
$draft= GETPOST('FICHINTER_DRAFT_WATERMARK', 'alpha');
|
||||
$draft = GETPOST('FICHINTER_DRAFT_WATERMARK', 'alpha');
|
||||
$res = dolibarr_set_const($db, "FICHINTER_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@@ -195,9 +195,9 @@ elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS')
|
||||
$val = GETPOST('FICHINTER_PRINT_PRODUCTS', 'alpha');
|
||||
$res = dolibarr_set_const($db, "FICHINTER_PRINT_PRODUCTS", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@@ -252,17 +252,17 @@ elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS')
|
||||
* View
|
||||
*/
|
||||
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
llxHeader();
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("InterventionsSetup"), $linkback, 'title_setup');
|
||||
|
||||
|
||||
$head=fichinter_admin_prepare_head();
|
||||
$head = fichinter_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'ficheinter', $langs->trans("Interventions"), -1, 'intervention');
|
||||
|
||||
@@ -290,7 +290,7 @@ foreach ($dirmodels as $reldir)
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (preg_match('/^(mod_.*)\.php$/i', $file, $reg))
|
||||
{
|
||||
@@ -304,7 +304,7 @@ foreach ($dirmodels as $reldir)
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
|
||||
@@ -314,9 +314,9 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
// Show example of numbering model
|
||||
print '<td class="nowrap">';
|
||||
$tmp=$module->getExample();
|
||||
$tmp = $module->getExample();
|
||||
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
|
||||
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
|
||||
else print $tmp;
|
||||
print '</td>'."\n";
|
||||
|
||||
@@ -331,21 +331,21 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$ficheinter=new Fichinter($db);
|
||||
$ficheinter = new Fichinter($db);
|
||||
$ficheinter->initAsSpecimen();
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$nextval=$module->getNextValue($mysoc, $ficheinter);
|
||||
$htmltooltip = '';
|
||||
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$nextval = $module->getNextValue($mysoc, $ficheinter);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||
$htmltooltip .= ''.$langs->trans("NextValue").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured')
|
||||
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
|
||||
$nextval = $langs->trans($nextval);
|
||||
$htmltooltip.=$nextval.'<br>';
|
||||
$htmltooltip .= $nextval.'<br>';
|
||||
} else {
|
||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||
$htmltooltip .= $langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
print '<td align="center">';
|
||||
@@ -371,17 +371,17 @@ print '</table><br>';
|
||||
print load_fiche_titre($langs->trans("TemplatePDFInterventions"), '', '');
|
||||
|
||||
// Defini tableau def des modeles
|
||||
$type='ficheinter';
|
||||
$type = 'ficheinter';
|
||||
$def = array();
|
||||
$sql = "SELECT nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.= " WHERE type = '".$type."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$resql=$db->query($sql);
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql .= " WHERE type = '".$type."'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i = 0;
|
||||
$num_rows=$db->num_rows($resql);
|
||||
$num_rows = $db->num_rows($resql);
|
||||
while ($i < $num_rows)
|
||||
{
|
||||
$array = $db->fetch_array($resql);
|
||||
@@ -413,36 +413,36 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$handle=opendir($dir);
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
$filelist[]=$file;
|
||||
$filelist[] = $file;
|
||||
}
|
||||
closedir($handle);
|
||||
arsort($filelist);
|
||||
|
||||
foreach($filelist as $file)
|
||||
foreach ($filelist as $file)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
||||
{
|
||||
if (file_exists($dir.'/'.$file))
|
||||
{
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||
$name = substr($file, 4, dol_strlen($file) - 16);
|
||||
$classname = substr($file, 0, dol_strlen($file) - 12);
|
||||
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db);
|
||||
|
||||
$modulequalified=1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
|
||||
$modulequalified = 1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
|
||||
|
||||
if ($modulequalified)
|
||||
{
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print (empty($module->name)?$name:$module->name);
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td><td>\n";
|
||||
if (method_exists($module, 'info')) print $module->info($langs);
|
||||
else print $module->description;
|
||||
@@ -477,15 +477,15 @@ foreach ($dirmodels as $reldir)
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('', $htmltooltip, -1, 0);
|
||||
print '</td>';
|
||||
@@ -526,18 +526,18 @@ print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
|
||||
print "<td> </td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
$htmltext.='</i>';
|
||||
foreach ($substitutionarray as $key => $val) $htmltext .= $key.'<br>';
|
||||
$htmltext .= '</i>';
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_FICHINTER_FREE_TEXT">';
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnInterventions"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='FICHINTER_FREE_TEXT';
|
||||
$variablename = 'FICHINTER_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
|
||||
@@ -545,7 +545,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
else
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
||||
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
||||
print $doleditor->Create();
|
||||
}
|
||||
print '</td><td class="right">';
|
||||
@@ -580,50 +580,50 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'
|
||||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
// Use services duration
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_FICHINTER_USE_SERVICE_DURATION">';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
print $langs->trans("UseServicesDurationOnFichinter");
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<input type="checkbox" name="FICHINTER_USE_SERVICE_DURATION"' . ($conf->global->FICHINTER_USE_SERVICE_DURATION?' checked':'') . '>';
|
||||
print '<input type="checkbox" name="FICHINTER_USE_SERVICE_DURATION"'.($conf->global->FICHINTER_USE_SERVICE_DURATION ? ' checked' : '').'>';
|
||||
print '</td>';
|
||||
print '<td class="right">';
|
||||
print '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
// Use duration
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_FICHINTER_WITHOUT_DURATION">';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
print $langs->trans("UseDurationOnFichinter");
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<input type="checkbox" name="FICHINTER_WITHOUT_DURATION"' . ($conf->global->FICHINTER_WITHOUT_DURATION?' checked':'') . '>';
|
||||
print '<input type="checkbox" name="FICHINTER_WITHOUT_DURATION"'.($conf->global->FICHINTER_WITHOUT_DURATION ? ' checked' : '').'>';
|
||||
print '</td>';
|
||||
print '<td class="right">';
|
||||
print '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
// use date without hour
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_FICHINTER_DATE_WITHOUT_HOUR">';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
print $langs->trans("UseDateWithoutHourOnFichinter");
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<input type="checkbox" name="FICHINTER_DATE_WITHOUT_HOUR"' . ($conf->global->FICHINTER_DATE_WITHOUT_HOUR?' checked':'') . '>';
|
||||
print '<input type="checkbox" name="FICHINTER_DATE_WITHOUT_HOUR"'.($conf->global->FICHINTER_DATE_WITHOUT_HOUR ? ' checked' : '').'>';
|
||||
print '</td>';
|
||||
print '<td class="right">';
|
||||
print '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
|
||||
@@ -43,7 +43,7 @@ $action = GETPOST('action', 'alpha');
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
$type='delivery';
|
||||
$type = 'delivery';
|
||||
|
||||
|
||||
/*
|
||||
@@ -54,13 +54,13 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
$maskconstdelivery=GETPOST('maskconstdelivery', 'alpha');
|
||||
$maskdelivery=GETPOST('maskdelivery', 'alpha');
|
||||
$maskconstdelivery = GETPOST('maskconstdelivery', 'alpha');
|
||||
$maskdelivery = GETPOST('maskdelivery', 'alpha');
|
||||
if ($maskconstdelivery) $res = dolibarr_set_const($db, $maskconstdelivery, $maskdelivery, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@@ -72,12 +72,12 @@ if ($action == 'updateMask')
|
||||
|
||||
if ($action == 'set_DELIVERY_FREE_TEXT')
|
||||
{
|
||||
$free=GETPOST('DELIVERY_FREE_TEXT', 'none'); // No alpha here, we want exact string
|
||||
$res=dolibarr_set_const($db, "DELIVERY_FREE_TEXT", $free, 'chaine', 0, '', $conf->entity);
|
||||
$free = GETPOST('DELIVERY_FREE_TEXT', 'none'); // No alpha here, we want exact string
|
||||
$res = dolibarr_set_const($db, "DELIVERY_FREE_TEXT", $free, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@@ -89,20 +89,20 @@ if ($action == 'set_DELIVERY_FREE_TEXT')
|
||||
|
||||
if ($action == 'specimen')
|
||||
{
|
||||
$modele=GETPOST('module', 'alpha');
|
||||
$modele = GETPOST('module', 'alpha');
|
||||
|
||||
$sending = new Livraison($db);
|
||||
$sending->initAsSpecimen();
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
$file = ''; $classname = ''; $filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/livraison/doc/pdf_".$modele.".modules.php", 0);
|
||||
$file = dol_buildpath($reldir."core/modules/livraison/doc/pdf_".$modele.".modules.php", 0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$filefound = 1;
|
||||
$classname = "pdf_".$modele;
|
||||
break;
|
||||
}
|
||||
@@ -176,13 +176,13 @@ if ($action == 'setmod')
|
||||
* View
|
||||
*/
|
||||
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
llxHeader("", "");
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("SendingsSetup"), $linkback, 'title_setup');
|
||||
print '<br>';
|
||||
$head = expedition_admin_prepare_head();
|
||||
@@ -214,11 +214,11 @@ foreach ($dirmodels as $reldir)
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (substr($file, 0, 14) == 'mod_livraison_' && substr($file, dol_strlen($file)-3, 3) == 'php')
|
||||
if (substr($file, 0, 14) == 'mod_livraison_' && substr($file, dol_strlen($file) - 3, 3) == 'php')
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file)-4);
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
require_once $dir.$file.'.php';
|
||||
|
||||
@@ -227,7 +227,7 @@ foreach ($dirmodels as $reldir)
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
|
||||
@@ -237,11 +237,11 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
// Show example of numbering module
|
||||
print '<td class="nowrap">';
|
||||
$tmp=$module->getExample();
|
||||
$tmp = $module->getExample();
|
||||
if (preg_match('/^Error/', $tmp)) {
|
||||
$langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||
}
|
||||
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
|
||||
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
|
||||
else print $tmp;
|
||||
print '</td>'."\n";
|
||||
|
||||
@@ -256,21 +256,21 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$livraison=new Livraison($db);
|
||||
$livraison = new Livraison($db);
|
||||
$livraison->initAsSpecimen();
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$nextval=$module->getNextValue($mysoc, $livraison);
|
||||
$htmltooltip = '';
|
||||
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$nextval = $module->getNextValue($mysoc, $livraison);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||
$htmltooltip .= ''.$langs->trans("NextValue").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured')
|
||||
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
|
||||
$nextval = $langs->trans($nextval);
|
||||
$htmltooltip.=$nextval.'<br>';
|
||||
$htmltooltip .= $nextval.'<br>';
|
||||
} else {
|
||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||
$htmltooltip .= $langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,19 +297,19 @@ print '<br>';
|
||||
print load_fiche_titre($langs->trans("DeliveryOrderModel"), '', '');
|
||||
|
||||
// Defini tableau def de modele
|
||||
$type="delivery";
|
||||
$type = "delivery";
|
||||
$def = array();
|
||||
|
||||
$sql = "SELECT nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.= " WHERE type = '".$type."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql .= " WHERE type = '".$type."'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i = 0;
|
||||
$num_rows=$db->num_rows($resql);
|
||||
$num_rows = $db->num_rows($resql);
|
||||
while ($i < $num_rows)
|
||||
{
|
||||
$array = $db->fetch_array($resql);
|
||||
@@ -343,33 +343,33 @@ foreach ($dirmodels as $reldir)
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
$filelist[]=$file;
|
||||
$filelist[] = $file;
|
||||
}
|
||||
closedir($handle);
|
||||
arsort($filelist);
|
||||
|
||||
foreach($filelist as $file)
|
||||
foreach ($filelist as $file)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
||||
{
|
||||
if (file_exists($dir.'/'.$file))
|
||||
{
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||
$name = substr($file, 4, dol_strlen($file) - 16);
|
||||
$classname = substr($file, 0, dol_strlen($file) - 12);
|
||||
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db);
|
||||
|
||||
$modulequalified=1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
|
||||
$modulequalified = 1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
|
||||
|
||||
if ($modulequalified)
|
||||
{
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print (empty($module->name)?$name:$module->name);
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td><td>\n";
|
||||
if (method_exists($module, 'info')) print $module->info($langs);
|
||||
else print $module->description;
|
||||
@@ -404,10 +404,10 @@ foreach ($dirmodels as $reldir)
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").'</u>:';
|
||||
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip = ''.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").'</u>:';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
||||
print '</td>';
|
||||
@@ -447,18 +447,18 @@ print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
|
||||
print '<td width="80"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
$htmltext.='</i>';
|
||||
foreach ($substitutionarray as $key => $val) $htmltext .= $key.'<br>';
|
||||
$htmltext .= '</i>';
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_DELIVERY_FREE_TEXT">';
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnDeliveryReceipts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='DELIVERY_FREE_TEXT';
|
||||
$variablename = 'DELIVERY_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
|
||||
@@ -466,7 +466,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
else
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
||||
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
||||
print $doleditor->Create();
|
||||
}
|
||||
print '</td><td class="right">';
|
||||
|
||||
@@ -111,6 +111,8 @@ if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') $
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$linuxlike=1;
|
||||
if (preg_match('/^win/i', PHP_OS)) $linuxlike=0;
|
||||
if (preg_match('/^mac/i', PHP_OS)) $linuxlike=0;
|
||||
@@ -139,8 +141,6 @@ $listofmethods['swiftmailer']='Swift Mailer socket library';
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
$form=new Form($db);
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
@@ -251,7 +251,7 @@ if ($action == 'edit')
|
||||
|
||||
dol_fiche_head($head, 'common', '', -1);
|
||||
|
||||
print $langs->trans("EMailsDesc")."<br>\n";
|
||||
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
|
||||
@@ -94,6 +94,8 @@ if ($action == 'presend' && GETPOST('trackid') == 'testhtml') $action='testhtm
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$linuxlike=1;
|
||||
if (preg_match('/^win/i', PHP_OS)) $linuxlike=0;
|
||||
if (preg_match('/^mac/i', PHP_OS)) $linuxlike=0;
|
||||
@@ -123,8 +125,6 @@ $listofmethods['swiftmailer']='Swift Mailer socket library';
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
$form=new Form($db);
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
@@ -219,7 +219,7 @@ if ($action == 'edit')
|
||||
|
||||
dol_fiche_head($head, 'common_emailing', '', -1);
|
||||
|
||||
print $langs->trans("EMailsDesc")."<br>\n";
|
||||
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/emailsenderprofile.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("errors", "admin", "mails", "languages"));
|
||||
|
||||
$action = GETPOST('action', 'alpha') ?GETPOST('action', 'alpha') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
|
||||
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
|
||||
$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
|
||||
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
|
||||
@@ -49,7 +49,7 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
@@ -104,13 +104,22 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
|
||||
{
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||
{
|
||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
||||
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) {
|
||||
$arrayfields["ef.".$key] = array(
|
||||
'label'=>$extrafields->attributes[$object->table_element]['label'][$key],
|
||||
'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1),
|
||||
'position'=>$extrafields->attributes[$object->table_element]['pos'][$key],
|
||||
'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
$permissiontoread = $user->admin;
|
||||
$permissiontoadd = $user->admin;
|
||||
$permissiontodelete = $user->admin;
|
||||
|
||||
|
||||
/*
|
||||
@@ -152,6 +161,18 @@ if (empty($reshook))
|
||||
$permissiontodelete = $user->admin;
|
||||
$uploaddir = $conf->admin->dir_output.'/senderprofiles';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."c_email_senderprofile WHERE rowid = ".GETPOST('id', 'int');
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
|
||||
}
|
||||
else {
|
||||
setEventMessages($langs->trans("Error").' '.$db->lasterror(), null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -160,27 +181,31 @@ if (empty($reshook))
|
||||
* View
|
||||
*/
|
||||
|
||||
$limit = (GETPOSTISSET('limit') ? $limit : 0);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
//$help_url="EN:Module_EmailSenderProfile|FR:Module_EmailSenderProfile_FR|ES:Módulo_EmailSenderProfile";
|
||||
$help_url = '';
|
||||
$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("EmailSenderProfiles"));
|
||||
$title = $langs->trans("EMailsSetup");
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
$titre = $langs->trans("EMailsSetup");
|
||||
$linkback = '';
|
||||
$titlepicto = 'title_setup';
|
||||
|
||||
print load_fiche_titre($titre, $linkback, $titlepicto);
|
||||
print load_fiche_titre($title, $linkback, $titlepicto);
|
||||
|
||||
$head = email_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'senderprofiles', '', -1);
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("EMailsSenderProfileDesc")."</span><br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
// Build and execute select
|
||||
// --------------------------------------------------------------------
|
||||
$sql = 'SELECT ';
|
||||
@@ -189,23 +214,26 @@ foreach ($object->fields as $key => $val)
|
||||
$sql .= 't.'.$key.', ';
|
||||
}
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label']))
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
|
||||
}
|
||||
// Add fields from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
|
||||
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||
if ($object->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity('emailsenderprofile').")";
|
||||
if ($object->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
|
||||
else $sql .= " WHERE 1 = 1";
|
||||
foreach ($search as $key => $val)
|
||||
{
|
||||
if ($key == 'status' && $search[$key] == -1) continue;
|
||||
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
|
||||
if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
|
||||
}
|
||||
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
// Add where from hooks
|
||||
@@ -226,6 +254,7 @@ if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql=preg_replace('/,\s*$/','', $sql);
|
||||
*/
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
@@ -234,28 +263,35 @@ $sql .= $db->order($sortfield, $sortorder);
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0
|
||||
{
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql)
|
||||
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
|
||||
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit)))
|
||||
{
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
$num = $nbtotalofrecords;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($limit) $sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
// Direct jump if only one record found
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->rowid;
|
||||
@@ -263,6 +299,8 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
|
||||
exit;
|
||||
}
|
||||
|
||||
// Output page
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
// Example : Adding jquery code
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
@@ -286,7 +324,8 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&co
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
foreach ($search as $key => $val)
|
||||
{
|
||||
$param .= '&search_'.$key.'='.urlencode($search[$key]);
|
||||
if (is_array($search[$key]) && count($search[$key])) foreach ($search[$key] as $skey) $param .= '&search_'.$key.'[]='.urlencode($skey);
|
||||
else $param .= '&search_'.$key.'='.urlencode($search[$key]);
|
||||
}
|
||||
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
||||
// Add $param from extra fields
|
||||
@@ -297,8 +336,8 @@ $arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->monmodule->delete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
||||
//if ($permissiontodelete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
//if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
@@ -311,6 +350,37 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
$newcardbutton = '';
|
||||
if ($action != 'create') {
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $_SERVER['PHP_SELF'].'?action=create', '', $permissiontoadd);
|
||||
} else {
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="label" value="'.GETPOST('label', 'alphanohtml').'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Email").'</td><td><input type="text" name="email" value="'.GETPOST('email', 'alphanohtml').'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Signature").'</td><td><textarea name="signature">'.GETPOST('signature', 'none').'</textarea></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Position").'</td><td><input type="text" name="label" class="maxwidth50" value="'.GETPOST('position', 'int').'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
||||
print '<input type="text" name="status" value="'.GETPOST('status', 'int').'">';
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
print '<div class="center">';
|
||||
print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit);
|
||||
//print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
||||
|
||||
$topicmail = "Information";
|
||||
@@ -319,6 +389,12 @@ $objecttmp = new EmailSenderProfile($db);
|
||||
//$trackid='sub'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($search_all)
|
||||
{
|
||||
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
|
||||
}
|
||||
|
||||
$moreforfilter = '';
|
||||
/*$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
|
||||
@@ -349,11 +425,18 @@ print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" :
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
$align = '';
|
||||
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $align .= ($align ? ' ' : '').'center';
|
||||
if (in_array($val['type'], array('timestamp'))) $align .= ($align ? ' ' : '').'nowrap';
|
||||
if ($key == 'status') $align .= ($align ? ' ' : '').'center';
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align ? ' '.$align : '').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
if (!empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
|
||||
else print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||
@@ -374,11 +457,15 @@ print '</tr>'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
$align = '';
|
||||
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $align .= ($align ? ' ' : '').'center';
|
||||
if (in_array($val['type'], array('timestamp'))) $align .= ($align ? ' ' : '').'nowrap';
|
||||
if ($key == 'status') $align .= ($align ? ' ' : '').'center';
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align ? 'class="'.$align.'"' : ''), $sortfield, $sortorder, $align.' ')."\n";
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
if (!empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
@@ -387,15 +474,19 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n";
|
||||
// Action column
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
// Detect if we need a fetch on each output line
|
||||
$needToFetchEachLine = 0;
|
||||
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
|
||||
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0)
|
||||
{
|
||||
if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object
|
||||
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
|
||||
{
|
||||
if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -403,7 +494,7 @@ foreach ($extrafields->attributes[$object->table_element]['computed'] as $key =>
|
||||
// --------------------------------------------------------------------
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
while ($i < min($num, $limit))
|
||||
while ($i < ($limit ? min($num, $limit) : $num))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) break; // Should not happen
|
||||
@@ -419,16 +510,21 @@ while ($i < min($num, $limit))
|
||||
print '<tr class="oddeven">';
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
$align = '';
|
||||
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $align .= ($align ? ' ' : '').'center';
|
||||
if (in_array($val['type'], array('timestamp'))) $align .= ($align ? ' ' : '').'nowrap';
|
||||
if ($key == 'status') $align .= ($align ? ' ' : '').'center';
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
elseif ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
|
||||
if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
|
||||
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
|
||||
if (!empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
print '<td';
|
||||
if ($align) print ' class="'.$align.'"';
|
||||
print '>';
|
||||
print $object->showOutputField($val, $key, $obj->$key, '');
|
||||
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
|
||||
if ($key == 'status') print $object->getLibStatut(5);
|
||||
elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) print $object->showOutputField($val, $key, $db->jdate($obj->$key), '');
|
||||
else print $object->showOutputField($val, $key, $obj->$key, '');
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!empty($val['isameasure']))
|
||||
@@ -441,21 +537,29 @@ while ($i < min($num, $limit))
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print '<td class="nowrap" align="center">';
|
||||
print '<td class="nowrap center">';
|
||||
$url = $_SERVER["PHP_SELF"].'?action=list&id='.$obj->rowid;
|
||||
if ($limit) $url.='&limit='.urlencode($limit);
|
||||
if ($page) $url.='&page='.urlencode($page);
|
||||
if ($sortfield) $url.='&sortfield='.urlencode($sortfield);
|
||||
if ($sortorder) $url.='&page='.urlencode($sortorder);
|
||||
//print '<a class="reposition" href="'.$url.'&action=edit">'.img_edit().'</a>';
|
||||
//print ' ';
|
||||
print '<a href="'.$url.'&action=delete">'.img_delete().'</a> ';
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
$selected = 0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
print '</tr>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
@@ -486,21 +590,21 @@ print '</form>'."\n";
|
||||
|
||||
if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
$hidegeneratedfilelistifempty = 1;
|
||||
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
// Show list of available documents
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|
||||
$urlsource .= str_replace('&', '&', $param);
|
||||
|
||||
$filedir = $diroutputmassaction;
|
||||
$genallowed = $user->rights->monmodule->read;
|
||||
$delallowed = $user->rights->monmodule->create;
|
||||
$genallowed = $permissiontoread;
|
||||
$delallowed = $permissiontoadd;
|
||||
|
||||
print $formfile->showdocuments('massfilesarea_monmodule', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
|
||||
print $formfile->showdocuments('massfilesarea_emailsenderprofile', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
@@ -40,14 +40,14 @@ $langs->loadLangs(array("admin", "other", "orders"));
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$type=GETPOST('type', 'alpha');
|
||||
$value=GETPOST('value', 'alpha');
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$type = GETPOST('type', 'alpha');
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
|
||||
$specimenthirdparty=new Societe($db);
|
||||
$specimenthirdparty = new Societe($db);
|
||||
$specimenthirdparty->initAsSpecimen();
|
||||
|
||||
|
||||
@@ -57,17 +57,17 @@ $specimenthirdparty->initAsSpecimen();
|
||||
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
$maskconstinvoice=GETPOST('maskconstinvoice', 'alpha');
|
||||
$maskconstcredit=GETPOST('maskconstcredit', 'alpha');
|
||||
$maskinvoice=GETPOST('maskinvoice', 'alpha');
|
||||
$maskcredit=GETPOST('maskcredit', 'alpha');
|
||||
$maskconstinvoice = GETPOST('maskconstinvoice', 'alpha');
|
||||
$maskconstcredit = GETPOST('maskconstcredit', 'alpha');
|
||||
$maskinvoice = GETPOST('maskinvoice', 'alpha');
|
||||
$maskcredit = GETPOST('maskcredit', 'alpha');
|
||||
|
||||
if ($maskconstinvoice) $res = dolibarr_set_const($db, $maskconstinvoice, $maskinvoice, 'chaine', 0, '', $conf->entity);
|
||||
if ($maskconstcredit) $res = dolibarr_set_const($db, $maskconstcredit, $maskcredit, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@@ -79,21 +79,21 @@ if ($action == 'updateMask')
|
||||
|
||||
if ($action == 'specimen') // For invoices
|
||||
{
|
||||
$modele=GETPOST('module', 'alpha');
|
||||
$modele = GETPOST('module', 'alpha');
|
||||
|
||||
$facture = new FactureFournisseur($db);
|
||||
$facture->initAsSpecimen();
|
||||
$facture->thirdparty=$specimenthirdparty; // Define who should has build the invoice (so the supplier)
|
||||
$facture->thirdparty = $specimenthirdparty; // Define who should has build the invoice (so the supplier)
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
$file = ''; $classname = ''; $filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/supplier_invoice/pdf/pdf_".$modele.".modules.php", 0);
|
||||
$file = dol_buildpath($reldir."core/modules/supplier_invoice/pdf/pdf_".$modele.".modules.php", 0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$filefound = 1;
|
||||
$classname = "pdf_".$modele;
|
||||
break;
|
||||
}
|
||||
@@ -176,13 +176,13 @@ if ($action == 'addcat')
|
||||
|
||||
if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT')
|
||||
{
|
||||
$freetext = GETPOST('SUPPLIER_INVOICE_FREE_TEXT', 'none'); // No alpha here, we want exact string
|
||||
$freetext = GETPOST('SUPPLIER_INVOICE_FREE_TEXT', 'none'); // No alpha here, we want exact string
|
||||
|
||||
$res = dolibarr_set_const($db, "SUPPLIER_INVOICE_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@@ -197,13 +197,13 @@ if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT')
|
||||
* View
|
||||
*/
|
||||
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
llxHeader("", "");
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("SuppliersSetup"), $linkback, 'title_setup');
|
||||
|
||||
print "<br>";
|
||||
@@ -237,11 +237,11 @@ foreach ($dirmodels as $reldir)
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (substr($file, 0, 24) == 'mod_facture_fournisseur_' && substr($file, dol_strlen($file)-3, 3) == 'php')
|
||||
if (substr($file, 0, 24) == 'mod_facture_fournisseur_' && substr($file, dol_strlen($file) - 3, 3) == 'php')
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file)-4);
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
require_once $dir.$file.'.php';
|
||||
|
||||
@@ -250,7 +250,7 @@ foreach ($dirmodels as $reldir)
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
|
||||
@@ -260,11 +260,11 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
// Show example of numbering model
|
||||
print '<td class="nowrap">';
|
||||
$tmp=$module->getExample();
|
||||
$tmp = $module->getExample();
|
||||
if (preg_match('/^Error/', $tmp)) {
|
||||
$langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||
}
|
||||
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
|
||||
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
|
||||
else print $tmp;
|
||||
print '</td>'."\n";
|
||||
|
||||
@@ -279,21 +279,21 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$invoice=new FactureFournisseur($db);
|
||||
$invoice = new FactureFournisseur($db);
|
||||
$invoice->initAsSpecimen();
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$nextval=$module->getNextValue($mysoc, $invoice);
|
||||
$htmltooltip = '';
|
||||
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$nextval = $module->getNextValue($mysoc, $invoice);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||
$htmltooltip .= ''.$langs->trans("NextValue").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured')
|
||||
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
|
||||
$nextval = $langs->trans($nextval);
|
||||
$htmltooltip.=$nextval.'<br>';
|
||||
$htmltooltip .= $nextval.'<br>';
|
||||
} else {
|
||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||
$htmltooltip .= $langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,15 +325,15 @@ print load_fiche_titre($langs->trans("BillsPDFModules"), '', '');
|
||||
$def = array();
|
||||
|
||||
$sql = "SELECT nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.= " WHERE type = 'invoice_supplier'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql .= " WHERE type = 'invoice_supplier'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i = 0;
|
||||
$num_rows=$db->num_rows($resql);
|
||||
$num_rows = $db->num_rows($resql);
|
||||
while ($i < $num_rows)
|
||||
{
|
||||
$array = $db->fetch_array($resql);
|
||||
@@ -364,17 +364,17 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$handle=opendir($dir);
|
||||
$handle = opendir($dir);
|
||||
|
||||
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
||||
{
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||
$name = substr($file, 4, dol_strlen($file) - 16);
|
||||
$classname = substr($file, 0, dol_strlen($file) - 12);
|
||||
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db, new FactureFournisseur($db));
|
||||
@@ -382,7 +382,7 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
print "<tr class=\"oddeven\">\n";
|
||||
print "<td>";
|
||||
print (empty($module->name)?$name:$module->name);
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td>\n";
|
||||
print "<td>\n";
|
||||
require_once $dir.$file;
|
||||
@@ -431,13 +431,13 @@ foreach ($dirmodels as $reldir)
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
||||
print '</td>';
|
||||
@@ -472,15 +472,15 @@ print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
|
||||
print '<td width="80"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
$htmltext.='</i>';
|
||||
foreach ($substitutionarray as $key => $val) $htmltext .= $key.'<br>';
|
||||
$htmltext .= '</i>';
|
||||
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='SUPPLIER_INVOICE_FREE_TEXT';
|
||||
$variablename = 'SUPPLIER_INVOICE_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
|
||||
@@ -488,7 +488,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
else
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
||||
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
||||
print $doleditor->Create();
|
||||
}
|
||||
print '</td><td class="right">';
|
||||
|
||||
@@ -40,13 +40,13 @@ $langs->loadLangs(array("admin", "other", "orders", "stocks"));
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$type=GETPOST('type', 'alpha');
|
||||
$value=GETPOST('value', 'alpha');
|
||||
$type = GETPOST('type', 'alpha');
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
|
||||
$specimenthirdparty=new Societe($db);
|
||||
$specimenthirdparty = new Societe($db);
|
||||
$specimenthirdparty->initAsSpecimen();
|
||||
|
||||
|
||||
@@ -56,14 +56,14 @@ $specimenthirdparty->initAsSpecimen();
|
||||
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
$maskconstorder=GETPOST('maskconstorder', 'alpha');
|
||||
$maskvalue=GETPOST('maskorder', 'alpha');
|
||||
$maskconstorder = GETPOST('maskconstorder', 'alpha');
|
||||
$maskvalue = GETPOST('maskorder', 'alpha');
|
||||
|
||||
if ($maskconstorder) $res = dolibarr_set_const($db, $maskconstorder, $maskvalue, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@@ -75,21 +75,21 @@ if ($action == 'updateMask')
|
||||
|
||||
elseif ($action == 'specimen') // For orders
|
||||
{
|
||||
$modele=GETPOST('module', 'alpha');
|
||||
$modele = GETPOST('module', 'alpha');
|
||||
|
||||
$commande = new CommandeFournisseur($db);
|
||||
$commande->initAsSpecimen();
|
||||
$commande->thirdparty=$specimenthirdparty;
|
||||
$commande->thirdparty = $specimenthirdparty;
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
$file = ''; $classname = ''; $filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/supplier_order/pdf/pdf_".$modele.".modules.php", 0);
|
||||
$file = dol_buildpath($reldir."core/modules/supplier_order/pdf/pdf_".$modele.".modules.php", 0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$filefound = 1;
|
||||
$classname = "pdf_".$modele;
|
||||
break;
|
||||
}
|
||||
@@ -168,7 +168,7 @@ elseif ($action == 'addcat')
|
||||
|
||||
elseif ($action == 'set_SUPPLIER_ORDER_OTHER')
|
||||
{
|
||||
$freetext = GETPOST('SUPPLIER_ORDER_FREE_TEXT', 'none'); // No alpha here, we want exact string
|
||||
$freetext = GETPOST('SUPPLIER_ORDER_FREE_TEXT', 'none'); // No alpha here, we want exact string
|
||||
$doubleapproval = GETPOST('SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED', 'alpha');
|
||||
$doubleapproval = price2num($doubleapproval);
|
||||
|
||||
@@ -177,14 +177,14 @@ elseif ($action == 'set_SUPPLIER_ORDER_OTHER')
|
||||
|
||||
// TODO We add/delete permission here until permission can have a condition on a global var
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/modules/modFournisseur.class.php';
|
||||
$newmodule=new modFournisseur($db);
|
||||
$newmodule = new modFournisseur($db);
|
||||
|
||||
if ($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED)
|
||||
{
|
||||
// clear default rights array
|
||||
$newmodule->rights=array();
|
||||
$newmodule->rights = array();
|
||||
// add new right
|
||||
$r=0;
|
||||
$r = 0;
|
||||
$newmodule->rights[$r][0] = 1190;
|
||||
$newmodule->rights[$r][1] = $langs->trans("Permission1190");
|
||||
$newmodule->rights[$r][2] = 'w';
|
||||
@@ -210,9 +210,9 @@ elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER')
|
||||
{
|
||||
$res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER", $value, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@@ -227,13 +227,13 @@ elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER')
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
llxHeader("", "");
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("SuppliersSetup"), $linkback, 'title_setup');
|
||||
|
||||
print "<br>";
|
||||
@@ -267,11 +267,11 @@ foreach ($dirmodels as $reldir)
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (substr($file, 0, 25) == 'mod_commande_fournisseur_' && substr($file, dol_strlen($file)-3, 3) == 'php')
|
||||
if (substr($file, 0, 25) == 'mod_commande_fournisseur_' && substr($file, dol_strlen($file) - 3, 3) == 'php')
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file)-4);
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
require_once $dir.$file.'.php';
|
||||
|
||||
@@ -280,7 +280,7 @@ foreach ($dirmodels as $reldir)
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
|
||||
@@ -290,11 +290,11 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
// Show example of numbering module
|
||||
print '<td class="nowrap">';
|
||||
$tmp=$module->getExample();
|
||||
$tmp = $module->getExample();
|
||||
if (preg_match('/^Error/', $tmp)) {
|
||||
$langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||
}
|
||||
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
|
||||
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
|
||||
else print $tmp;
|
||||
print '</td>'."\n";
|
||||
|
||||
@@ -309,21 +309,21 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$commande=new CommandeFournisseur($db);
|
||||
$commande = new CommandeFournisseur($db);
|
||||
$commande->initAsSpecimen();
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$nextval=$module->getNextValue($mysoc, $commande);
|
||||
$htmltooltip = '';
|
||||
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$nextval = $module->getNextValue($mysoc, $commande);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||
$htmltooltip .= ''.$langs->trans("NextValue").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured')
|
||||
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
|
||||
$nextval = $langs->trans($nextval);
|
||||
$htmltooltip.=$nextval.'<br>';
|
||||
$htmltooltip .= $nextval.'<br>';
|
||||
} else {
|
||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||
$htmltooltip .= $langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,15 +353,15 @@ print load_fiche_titre($langs->trans("OrdersModelModule"), '', '');
|
||||
$def = array();
|
||||
|
||||
$sql = "SELECT nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.= " WHERE type = 'order_supplier'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql .= " WHERE type = 'order_supplier'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i = 0;
|
||||
$num_rows=$db->num_rows($resql);
|
||||
$num_rows = $db->num_rows($resql);
|
||||
while ($i < $num_rows)
|
||||
{
|
||||
$array = $db->fetch_array($resql);
|
||||
@@ -392,15 +392,15 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$handle=opendir($dir);
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
||||
{
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||
$name = substr($file, 4, dol_strlen($file) - 16);
|
||||
$classname = substr($file, 0, dol_strlen($file) - 12);
|
||||
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db, new CommandeFournisseur($db));
|
||||
@@ -408,7 +408,7 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
print "<tr class=\"oddeven\">\n";
|
||||
print "<td>";
|
||||
print (empty($module->name)?$name:$module->name);
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td>\n";
|
||||
print "<td>\n";
|
||||
require_once $dir.$file;
|
||||
@@ -453,13 +453,13 @@ foreach ($dirmodels as $reldir)
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
||||
print '</td>';
|
||||
@@ -536,15 +536,15 @@ else
|
||||
}
|
||||
*/
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
$htmltext.='</i>';
|
||||
foreach ($substitutionarray as $key => $val) $htmltext .= $key.'<br>';
|
||||
$htmltext .= '</i>';
|
||||
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='SUPPLIER_ORDER_FREE_TEXT';
|
||||
$variablename = 'SUPPLIER_ORDER_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
|
||||
@@ -552,7 +552,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
else
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
||||
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
||||
print $doleditor->Create();
|
||||
}
|
||||
print '</td><td class="right">';
|
||||
|
||||
@@ -30,13 +30,13 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("admin", "errors", "other", "bills", "orders"));
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
$type='supplier_payment';
|
||||
$type = 'supplier_payment';
|
||||
|
||||
|
||||
/*
|
||||
@@ -47,13 +47,13 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
$maskconstsupplierpayment=GETPOST('maskconstsupplierpayment', 'alpha');
|
||||
$masksupplierpayment=GETPOST('masksupplierpayment', 'alpha');
|
||||
$maskconstsupplierpayment = GETPOST('maskconstsupplierpayment', 'alpha');
|
||||
$masksupplierpayment = GETPOST('masksupplierpayment', 'alpha');
|
||||
if ($maskconstsupplierpayment) $res = dolibarr_set_const($db, $maskconstsupplierpayment, $masksupplierpayment, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@@ -101,20 +101,20 @@ elseif ($action == 'setdoc')
|
||||
|
||||
elseif ($action == 'specimen')
|
||||
{
|
||||
$modele=GETPOST('module', 'alpha');
|
||||
$modele = GETPOST('module', 'alpha');
|
||||
|
||||
$paiementFourn = new PaiementFourn($db);
|
||||
$paiementFourn->initAsSpecimen();
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
$file = ''; $classname = ''; $filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/supplier_payment/doc/pdf_".$modele.".modules.php", 0);
|
||||
$file = dol_buildpath($reldir."core/modules/supplier_payment/doc/pdf_".$modele.".modules.php", 0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$filefound = 1;
|
||||
$classname = "pdf_".$modele;
|
||||
break;
|
||||
}
|
||||
@@ -148,14 +148,14 @@ elseif ($action == 'specimen')
|
||||
* View
|
||||
*/
|
||||
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
llxHeader("", $langs->trans("SupplierPaymentSetup"), 'EN:Supplier_Payment_Configuration|FR:Configuration_module_paiement_fournisseur');
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("SupplierPaymentSetup"), $linkback, 'title_setup');
|
||||
|
||||
print "<br>";
|
||||
@@ -174,14 +174,14 @@ print load_fiche_titre($langs->trans("PaymentsNumberingModule"), '', '');
|
||||
// Load array def with activated templates
|
||||
$def = array();
|
||||
$sql = "SELECT nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.= " WHERE type = '".$type."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$resql=$db->query($sql);
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql .= " WHERE type = '".$type."'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i = 0;
|
||||
$num_rows=$db->num_rows($resql);
|
||||
$num_rows = $db->num_rows($resql);
|
||||
while ($i < $num_rows)
|
||||
{
|
||||
$array = $db->fetch_array($resql);
|
||||
@@ -213,24 +213,24 @@ foreach ($dirmodels as $reldir)
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (! is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS'))
|
||||
if (!is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS'))
|
||||
{
|
||||
$filebis = $file;
|
||||
$classname = preg_replace('/\.php$/', '', $file);
|
||||
// For compatibility
|
||||
if (! is_file($dir.$filebis))
|
||||
if (!is_file($dir.$filebis))
|
||||
{
|
||||
$filebis = $file."/".$file.".modules.php";
|
||||
$classname = "mod_supplier_payment_".$file;
|
||||
}
|
||||
// Check if there is a filter on country
|
||||
preg_match('/\-(.*)_(.*)$/', $classname, $reg);
|
||||
if (! empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue;
|
||||
if (!empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue;
|
||||
|
||||
$classname = preg_replace('/\-.*$/', '', $classname);
|
||||
if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/', $filebis) || preg_match('/mod_/', $classname)) && substr($filebis, dol_strlen($filebis)-3, 3) == 'php')
|
||||
if (!class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/', $filebis) || preg_match('/mod_/', $classname)) && substr($filebis, dol_strlen($filebis) - 3, 3) == 'php')
|
||||
{
|
||||
// Charging the numbering class
|
||||
require_once $dir.$filebis;
|
||||
@@ -238,7 +238,7 @@ foreach ($dirmodels as $reldir)
|
||||
$module = new $classname($db);
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
if ($module->isEnabled())
|
||||
@@ -253,9 +253,9 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
// Show example of numbering module
|
||||
print '<td class="nowrap">';
|
||||
$tmp=$module->getExample();
|
||||
$tmp = $module->getExample();
|
||||
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
|
||||
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
|
||||
else print $tmp;
|
||||
print '</td>'."\n";
|
||||
|
||||
@@ -271,21 +271,21 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$payment=new PaiementFourn($db);
|
||||
$payment = new PaiementFourn($db);
|
||||
$payment->initAsSpecimen();
|
||||
|
||||
// Example
|
||||
$htmltooltip='';
|
||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$nextval=$module->getNextValue($mysoc, $payment);
|
||||
$htmltooltip = '';
|
||||
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$nextval = $module->getNextValue($mysoc, $payment);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip.=$langs->trans("NextValue").': ';
|
||||
$htmltooltip .= $langs->trans("NextValue").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured')
|
||||
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
|
||||
$nextval = $langs->trans($nextval);
|
||||
$htmltooltip.=$nextval.'<br>';
|
||||
$htmltooltip .= $nextval.'<br>';
|
||||
} else {
|
||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||
$htmltooltip .= $langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
if ($conf->global->PAYMENT_ADDON.'.php' == $file) // If module is the one used, we show existing errors
|
||||
{
|
||||
if (! empty($module->error)) dol_htmloutput_mesg($module->error, '', 'error', 1);
|
||||
if (!empty($module->error)) dol_htmloutput_mesg($module->error, '', 'error', 1);
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
@@ -336,24 +336,24 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$handle=opendir($dir);
|
||||
$handle = opendir($dir);
|
||||
|
||||
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
||||
{
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||
$name = substr($file, 4, dol_strlen($file) - 16);
|
||||
$classname = substr($file, 0, dol_strlen($file) - 12);
|
||||
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db, new PaiementFourn($db));
|
||||
|
||||
print "<tr class=\"oddeven\">\n";
|
||||
print "<td>";
|
||||
print (empty($module->name)?$name:$module->name);
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td>\n";
|
||||
print "<td>\n";
|
||||
require_once $dir.$file;
|
||||
@@ -402,11 +402,11 @@ foreach ($dirmodels as $reldir)
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
||||
print '</td>';
|
||||
|
||||
@@ -32,15 +32,15 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/supplier_proposal.lib.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("admin", "errors", "other", "supplier_proposal"));
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
$type='supplier_proposal';
|
||||
$type = 'supplier_proposal';
|
||||
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
|
||||
/*
|
||||
@@ -51,13 +51,13 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
$maskconstsupplier_proposal=GETPOST('maskconstsupplier_proposal', 'alpha');
|
||||
$masksupplier_proposal=GETPOST('masksupplier_proposal', 'alpha');
|
||||
$maskconstsupplier_proposal = GETPOST('maskconstsupplier_proposal', 'alpha');
|
||||
$masksupplier_proposal = GETPOST('masksupplier_proposal', 'alpha');
|
||||
if ($maskconstsupplier_proposal) $res = dolibarr_set_const($db, $maskconstsupplier_proposal, $masksupplier_proposal, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@@ -69,20 +69,20 @@ if ($action == 'updateMask')
|
||||
|
||||
if ($action == 'specimen')
|
||||
{
|
||||
$modele=GETPOST('module', 'alpha');
|
||||
$modele = GETPOST('module', 'alpha');
|
||||
|
||||
$supplier_proposal = new SupplierProposal($db);
|
||||
$supplier_proposal->initAsSpecimen();
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
$file = ''; $classname = ''; $filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/supplier_proposal/doc/pdf_".$modele.".modules.php");
|
||||
$file = dol_buildpath($reldir."core/modules/supplier_proposal/doc/pdf_".$modele.".modules.php");
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$filefound = 1;
|
||||
$classname = "pdf_".$modele;
|
||||
break;
|
||||
}
|
||||
@@ -117,9 +117,9 @@ if ($action == 'set_SUPPLIER_PROPOSAL_DRAFT_WATERMARK')
|
||||
$draft = GETPOST('SUPPLIER_PROPOSAL_DRAFT_WATERMARK', 'alpha');
|
||||
|
||||
$res = dolibarr_set_const($db, "SUPPLIER_PROPOSAL_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@@ -131,13 +131,13 @@ if ($action == 'set_SUPPLIER_PROPOSAL_DRAFT_WATERMARK')
|
||||
|
||||
if ($action == 'set_SUPPLIER_PROPOSAL_FREE_TEXT')
|
||||
{
|
||||
$freetext = GETPOST('SUPPLIER_PROPOSAL_FREE_TEXT', 'none'); // No alpha here, we want exact string
|
||||
$freetext = GETPOST('SUPPLIER_PROPOSAL_FREE_TEXT', 'none'); // No alpha here, we want exact string
|
||||
|
||||
$res = dolibarr_set_const($db, "SUPPLIER_PROPOSAL_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@@ -151,9 +151,9 @@ if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL')
|
||||
{
|
||||
$res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL", $value, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@@ -206,16 +206,16 @@ elseif ($action == 'setmod')
|
||||
* Affiche page
|
||||
*/
|
||||
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
|
||||
llxHeader('', $langs->trans("SupplierProposalSetup"));
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
//if ($mesg) print $mesg;
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("SupplierProposalSetup"), $linkback, 'title_setup');
|
||||
|
||||
$head = supplier_proposal_admin_prepare_head();
|
||||
@@ -246,18 +246,18 @@ foreach ($dirmodels as $reldir)
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (substr($file, 0, 22) == 'mod_supplier_proposal_' && substr($file, dol_strlen($file)-3, 3) == 'php')
|
||||
if (substr($file, 0, 22) == 'mod_supplier_proposal_' && substr($file, dol_strlen($file) - 3, 3) == 'php')
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file)-4);
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
require_once $dir.$file.'.php';
|
||||
|
||||
$module = new $file;
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
if ($module->isEnabled())
|
||||
@@ -268,9 +268,9 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
// Show example of numbering module
|
||||
print '<td class="nowrap">';
|
||||
$tmp=$module->getExample();
|
||||
$tmp = $module->getExample();
|
||||
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
|
||||
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
|
||||
else print $tmp;
|
||||
print '</td>'."\n";
|
||||
|
||||
@@ -287,21 +287,21 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$supplier_proposal=new SupplierProposal($db);
|
||||
$supplier_proposal = new SupplierProposal($db);
|
||||
$supplier_proposal->initAsSpecimen();
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$nextval=$module->getNextValue($mysoc, $supplier_proposal);
|
||||
$htmltooltip = '';
|
||||
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$nextval = $module->getNextValue($mysoc, $supplier_proposal);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||
$htmltooltip .= ''.$langs->trans("NextValue").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured')
|
||||
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
|
||||
$nextval = $langs->trans($nextval);
|
||||
$htmltooltip.=$nextval.'<br>';
|
||||
$htmltooltip .= $nextval.'<br>';
|
||||
} else {
|
||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||
$htmltooltip .= $langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,14 +329,14 @@ print load_fiche_titre($langs->trans("SupplierProposalPDFModules"), '', '');
|
||||
// Load array def with activated templates
|
||||
$def = array();
|
||||
$sql = "SELECT nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.= " WHERE type = '".$type."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$resql=$db->query($sql);
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql .= " WHERE type = '".$type."'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i = 0;
|
||||
$num_rows=$db->num_rows($resql);
|
||||
$num_rows = $db->num_rows($resql);
|
||||
while ($i < $num_rows)
|
||||
{
|
||||
$array = $db->fetch_array($resql);
|
||||
@@ -364,42 +364,42 @@ clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('','/doc') as $valdir)
|
||||
foreach (array('', '/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_proposal".$valdir);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$handle=opendir($dir);
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
$filelist[]=$file;
|
||||
$filelist[] = $file;
|
||||
}
|
||||
closedir($handle);
|
||||
arsort($filelist);
|
||||
|
||||
foreach($filelist as $file)
|
||||
foreach ($filelist as $file)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
||||
{
|
||||
if (file_exists($dir.'/'.$file))
|
||||
{
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||
$name = substr($file, 4, dol_strlen($file) - 16);
|
||||
$classname = substr($file, 0, dol_strlen($file) - 12);
|
||||
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db);
|
||||
|
||||
$modulequalified=1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
|
||||
$modulequalified = 1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
|
||||
|
||||
if ($modulequalified)
|
||||
{
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print (empty($module->name)?$name:$module->name);
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td><td>\n";
|
||||
if (method_exists($module, 'info')) print $module->info($langs);
|
||||
else print $module->description;
|
||||
@@ -493,18 +493,18 @@ print '<td width="60" align="center">'.$langs->trans("Value")."</td>\n";
|
||||
print "<td> </td>\n";
|
||||
print "</tr>";
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
$htmltext.='</i>';
|
||||
foreach ($substitutionarray as $key => $val) $htmltext .= $key.'<br>';
|
||||
$htmltext .= '</i>';
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_SUPPLIER_PROPOSAL_FREE_TEXT">';
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnSupplierProposal"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='SUPPLIER_PROPOSAL_FREE_TEXT';
|
||||
$variablename = 'SUPPLIER_PROPOSAL_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
|
||||
@@ -512,7 +512,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
else
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
||||
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
||||
print $doleditor->Create();
|
||||
}
|
||||
print '</td><td class="right">';
|
||||
@@ -537,7 +537,7 @@ if ($conf->banque->enabled)
|
||||
{
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").'</td><td> </td><td class="right">';
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
if (!empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL');
|
||||
}
|
||||
|
||||
@@ -28,20 +28,20 @@ require '../../main.inc.php';
|
||||
|
||||
$langs->load("admin");
|
||||
|
||||
if (! $user->admin)
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
|
||||
|
||||
if ($action == 'convert')
|
||||
{
|
||||
$sql="ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." ENGINE=INNODB";
|
||||
$sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." ENGINE=INNODB";
|
||||
$db->query($sql);
|
||||
}
|
||||
if ($action == 'convertutf8')
|
||||
{
|
||||
$sql="ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." CHARACTER SET utf8 COLLATE utf8_unicode_ci";
|
||||
$sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." CHARACTER SET utf8 COLLATE utf8_unicode_ci";
|
||||
$db->query($sql);
|
||||
}
|
||||
|
||||
@@ -56,16 +56,16 @@ print load_fiche_titre($langs->trans("Tables")." ".ucfirst($conf->db->type), '',
|
||||
|
||||
|
||||
// Define request to get table description
|
||||
$base=0;
|
||||
$base = 0;
|
||||
if (preg_match('/mysql/i', $conf->db->type))
|
||||
{
|
||||
$sql = "SHOW TABLE STATUS";
|
||||
$base=1;
|
||||
$base = 1;
|
||||
}
|
||||
elseif ($conf->db->type == 'pgsql')
|
||||
{
|
||||
$sql = "SELECT conname, contype FROM pg_constraint;";
|
||||
$base=2;
|
||||
$base = 2;
|
||||
}
|
||||
elseif ($conf->db->type == 'mssql')
|
||||
{
|
||||
@@ -79,7 +79,7 @@ elseif ($conf->db->type == 'sqlite' || $conf->db->type == 'sqlite3')
|
||||
}
|
||||
|
||||
|
||||
if (! $base)
|
||||
if (!$base)
|
||||
{
|
||||
print $langs->trans("FeatureNotAvailableWithThisDatabaseDriver");
|
||||
}
|
||||
@@ -109,7 +109,7 @@ else
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i=0;
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
@@ -161,13 +161,13 @@ else
|
||||
print "</tr>\n";
|
||||
|
||||
$sql = "SELECT relname, seq_tup_read, idx_tup_fetch, n_tup_ins, n_tup_upd, n_tup_del";
|
||||
$sql.= " FROM pg_stat_user_tables";
|
||||
$sql .= " FROM pg_stat_user_tables";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i=0;
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
@@ -202,7 +202,7 @@ else
|
||||
if ($resql)
|
||||
{
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
$rescount = $db->query("SELECT COUNT(*) FROM " . $row[0]);
|
||||
$rescount = $db->query("SELECT COUNT(*) FROM ".$row[0]);
|
||||
if ($rescount) {
|
||||
$row_count = $db->fetch_row($rescount);
|
||||
$count = $row_count[0];
|
||||
|
||||
@@ -33,21 +33,21 @@ $langs->loadLangs(array('admin', 'members', 'errors'));
|
||||
|
||||
// Choice of print year or current year.
|
||||
$now = dol_now();
|
||||
$year=dol_print_date($now, '%Y');
|
||||
$month=dol_print_date($now, '%m');
|
||||
$day=dol_print_date($now, '%d');
|
||||
$forbarcode=GETPOST('forbarcode');
|
||||
$fk_barcode_type=GETPOST('fk_barcode_type');
|
||||
$mode=GETPOST('mode');
|
||||
$modellabel=GETPOST("modellabel"); // Doc template to use
|
||||
$numberofsticker=GETPOST('numberofsticker', 'int');
|
||||
$year = dol_print_date($now, '%Y');
|
||||
$month = dol_print_date($now, '%m');
|
||||
$day = dol_print_date($now, '%d');
|
||||
$forbarcode = GETPOST('forbarcode');
|
||||
$fk_barcode_type = GETPOST('fk_barcode_type');
|
||||
$mode = GETPOST('mode');
|
||||
$modellabel = GETPOST("modellabel"); // Doc template to use
|
||||
$numberofsticker = GETPOST('numberofsticker', 'int');
|
||||
|
||||
$mesg='';
|
||||
$mesg = '';
|
||||
|
||||
$action=GETPOST('action', 'aZ09');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$producttmp=new Product($db);
|
||||
$thirdpartytmp=new Societe($db);
|
||||
$producttmp = new Product($db);
|
||||
$thirdpartytmp = new Societe($db);
|
||||
|
||||
|
||||
/*
|
||||
@@ -56,14 +56,14 @@ $thirdpartytmp=new Societe($db);
|
||||
|
||||
if (GETPOST('submitproduct') && GETPOST('submitproduct'))
|
||||
{
|
||||
$action=''; // We reset because we don't want to build doc
|
||||
$action = ''; // We reset because we don't want to build doc
|
||||
if (GETPOST('productid') > 0)
|
||||
{
|
||||
$producttmp->fetch(GETPOST('productid'));
|
||||
$forbarcode=$producttmp->barcode;
|
||||
$fk_barcode_type=$producttmp->barcode_type;
|
||||
$forbarcode = $producttmp->barcode;
|
||||
$fk_barcode_type = $producttmp->barcode_type;
|
||||
|
||||
if (empty($fk_barcode_type) && ! empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) $fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE;
|
||||
if (empty($fk_barcode_type) && !empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) $fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE;
|
||||
|
||||
if (empty($forbarcode) || empty($fk_barcode_type))
|
||||
{
|
||||
@@ -73,14 +73,14 @@ if (GETPOST('submitproduct') && GETPOST('submitproduct'))
|
||||
}
|
||||
if (GETPOST('submitthirdparty') && GETPOST('submitthirdparty'))
|
||||
{
|
||||
$action=''; // We reset because we don't want to build doc
|
||||
$action = ''; // We reset because we don't want to build doc
|
||||
if (GETPOST('socid') > 0)
|
||||
{
|
||||
$thirdpartytmp->fetch(GETPOST('socid'));
|
||||
$forbarcode=$thirdpartytmp->barcode;
|
||||
$fk_barcode_type=$thirdpartytmp->barcode_type_code;
|
||||
$forbarcode = $thirdpartytmp->barcode;
|
||||
$fk_barcode_type = $thirdpartytmp->barcode_type_code;
|
||||
|
||||
if (empty($fk_barcode_type) && ! empty($conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY)) $fk_barcode_type = $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY;
|
||||
if (empty($fk_barcode_type) && !empty($conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY)) $fk_barcode_type = $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY;
|
||||
|
||||
if (empty($forbarcode) || empty($fk_barcode_type))
|
||||
{
|
||||
@@ -91,7 +91,7 @@ if (GETPOST('submitthirdparty') && GETPOST('submitthirdparty'))
|
||||
|
||||
if ($action == 'builddoc')
|
||||
{
|
||||
$result=0; $error=0;
|
||||
$result = 0; $error = 0;
|
||||
|
||||
if (empty($forbarcode)) // barcode value
|
||||
{
|
||||
@@ -104,12 +104,12 @@ if ($action == 'builddoc')
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
// Get encoder (barcode_type_coder) from barcode type id (barcode_type)
|
||||
$stdobject=new GenericObject($db);
|
||||
$stdobject->barcode_type=$fk_barcode_type;
|
||||
$result=$stdobject->fetch_barcode();
|
||||
$stdobject = new GenericObject($db);
|
||||
$stdobject->barcode_type = $fk_barcode_type;
|
||||
$result = $stdobject->fetch_barcode();
|
||||
if ($result <= 0)
|
||||
{
|
||||
$error++;
|
||||
@@ -117,27 +117,27 @@ if ($action == 'builddoc')
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$code=$forbarcode;
|
||||
$generator=$stdobject->barcode_type_coder; // coder (loaded by fetch_barcode). Engine.
|
||||
$encoding=strtoupper($stdobject->barcode_type_code); // code (loaded by fetch_barcode). Example 'ean', 'isbn', ...
|
||||
$code = $forbarcode;
|
||||
$generator = $stdobject->barcode_type_coder; // coder (loaded by fetch_barcode). Engine.
|
||||
$encoding = strtoupper($stdobject->barcode_type_code); // code (loaded by fetch_barcode). Example 'ean', 'isbn', ...
|
||||
|
||||
$diroutput=$conf->barcode->dir_temp;
|
||||
$diroutput = $conf->barcode->dir_temp;
|
||||
dol_mkdir($diroutput);
|
||||
|
||||
// Generate barcode
|
||||
$dirbarcode=array_merge(array("/core/modules/barcode/doc/"), $conf->modules_parts['barcode']);
|
||||
$dirbarcode = array_merge(array("/core/modules/barcode/doc/"), $conf->modules_parts['barcode']);
|
||||
|
||||
foreach($dirbarcode as $reldir)
|
||||
foreach ($dirbarcode as $reldir)
|
||||
{
|
||||
$dir=dol_buildpath($reldir, 0);
|
||||
$newdir=dol_osencode($dir);
|
||||
$dir = dol_buildpath($reldir, 0);
|
||||
$newdir = dol_osencode($dir);
|
||||
|
||||
// Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php)
|
||||
if (! is_dir($newdir)) continue;
|
||||
if (!is_dir($newdir)) continue;
|
||||
|
||||
$result=@include_once $newdir.$generator.'.modules.php';
|
||||
$result = @include_once $newdir.$generator.'.modules.php';
|
||||
if ($result) break;
|
||||
}
|
||||
|
||||
@@ -151,11 +151,11 @@ if ($action == 'builddoc')
|
||||
$is2d = false;
|
||||
if ($module->encodingIsSupported($encoding))
|
||||
{
|
||||
$barcodeimage=$conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png';
|
||||
$barcodeimage = $conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png';
|
||||
dol_delete_file($barcodeimage);
|
||||
// File is created with full name $barcodeimage = $conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png';
|
||||
$result=$module->writeBarCode($code, $encoding, 'Y', 4, 1);
|
||||
if ($result <= 0 || ! dol_is_file($barcodeimage))
|
||||
$result = $module->writeBarCode($code, $encoding, 'Y', 4, 1);
|
||||
if ($result <= 0 || !dol_is_file($barcodeimage))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages('Failed to generate image file of barcode for code='.$code.' encoding='.$encoding.' file='.basename($barcodeimage), null, 'errors');
|
||||
@@ -174,10 +174,10 @@ if ($action == 'builddoc')
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
// List of values to scan for a replacement
|
||||
$substitutionarray = array (
|
||||
$substitutionarray = array(
|
||||
'%LOGIN%' => $user->login,
|
||||
'%COMPANY%' => $mysoc->name,
|
||||
'%ADDRESS%' => $mysoc->address,
|
||||
@@ -197,17 +197,17 @@ if ($action == 'builddoc')
|
||||
// For labels
|
||||
if ($mode == 'label')
|
||||
{
|
||||
$txtforsticker="%PHOTO%"; // Photo will be barcode image, %BARCODE% posible when using TCPDF generator
|
||||
$textleft=make_substitutions((empty($conf->global->BARCODE_LABEL_LEFT_TEXT)?$txtforsticker:$conf->global->BARCODE_LABEL_LEFT_TEXT), $substitutionarray);
|
||||
$textheader=make_substitutions((empty($conf->global->BARCODE_LABEL_HEADER_TEXT)?'':$conf->global->BARCODE_LABEL_HEADER_TEXT), $substitutionarray);
|
||||
$textfooter=make_substitutions((empty($conf->global->BARCODE_LABEL_FOOTER_TEXT)?'':$conf->global->BARCODE_LABEL_FOOTER_TEXT), $substitutionarray);
|
||||
$textright=make_substitutions((empty($conf->global->BARCODE_LABEL_RIGHT_TEXT)?'':$conf->global->BARCODE_LABEL_RIGHT_TEXT), $substitutionarray);
|
||||
$forceimgscalewidth=(empty($conf->global->BARCODE_FORCEIMGSCALEWIDTH)?1:$conf->global->BARCODE_FORCEIMGSCALEWIDTH);
|
||||
$forceimgscaleheight=(empty($conf->global->BARCODE_FORCEIMGSCALEHEIGHT)?1:$conf->global->BARCODE_FORCEIMGSCALEHEIGHT);
|
||||
$txtforsticker = "%PHOTO%"; // Photo will be barcode image, %BARCODE% posible when using TCPDF generator
|
||||
$textleft = make_substitutions((empty($conf->global->BARCODE_LABEL_LEFT_TEXT) ? $txtforsticker : $conf->global->BARCODE_LABEL_LEFT_TEXT), $substitutionarray);
|
||||
$textheader = make_substitutions((empty($conf->global->BARCODE_LABEL_HEADER_TEXT) ? '' : $conf->global->BARCODE_LABEL_HEADER_TEXT), $substitutionarray);
|
||||
$textfooter = make_substitutions((empty($conf->global->BARCODE_LABEL_FOOTER_TEXT) ? '' : $conf->global->BARCODE_LABEL_FOOTER_TEXT), $substitutionarray);
|
||||
$textright = make_substitutions((empty($conf->global->BARCODE_LABEL_RIGHT_TEXT) ? '' : $conf->global->BARCODE_LABEL_RIGHT_TEXT), $substitutionarray);
|
||||
$forceimgscalewidth = (empty($conf->global->BARCODE_FORCEIMGSCALEWIDTH) ? 1 : $conf->global->BARCODE_FORCEIMGSCALEWIDTH);
|
||||
$forceimgscaleheight = (empty($conf->global->BARCODE_FORCEIMGSCALEHEIGHT) ? 1 : $conf->global->BARCODE_FORCEIMGSCALEHEIGHT);
|
||||
|
||||
for ($i=0; $i < $numberofsticker; $i++)
|
||||
for ($i = 0; $i < $numberofsticker; $i++)
|
||||
{
|
||||
$arrayofrecords[]=array(
|
||||
$arrayofrecords[] = array(
|
||||
'textleft'=>$textleft,
|
||||
'textheader'=>$textheader,
|
||||
'textfooter'=>$textfooter,
|
||||
@@ -221,23 +221,23 @@ if ($action == 'builddoc')
|
||||
}
|
||||
|
||||
$i++;
|
||||
$mesg='';
|
||||
$mesg = '';
|
||||
|
||||
// Build and output PDF
|
||||
if ($mode == 'label')
|
||||
{
|
||||
if (! count($arrayofrecords))
|
||||
if (!count($arrayofrecords))
|
||||
{
|
||||
$mesg=$langs->trans("ErrorRecordNotFound");
|
||||
$mesg = $langs->trans("ErrorRecordNotFound");
|
||||
}
|
||||
if (empty($modellabel) || $modellabel == '-1')
|
||||
{
|
||||
$mesg=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_ETIQUETTE_TYPE"));
|
||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_ETIQUETTE_TYPE"));
|
||||
}
|
||||
|
||||
$outfile = $langs->trans("BarCode").'_sheets_'.dol_print_date(dol_now(), 'dayhourlog').'.pdf';
|
||||
|
||||
if (! $mesg) $result=doc_label_pdf_create($db, $arrayofrecords, $modellabel, $outputlangs, $diroutput, $template, dol_sanitizeFileName($outfile));
|
||||
if (!$mesg) $result = doc_label_pdf_create($db, $arrayofrecords, $modellabel, $outputlangs, $diroutput, $template, dol_sanitizeFileName($outfile));
|
||||
}
|
||||
|
||||
if ($result <= 0)
|
||||
@@ -245,7 +245,7 @@ if ($action == 'builddoc')
|
||||
dol_print_error('', $result);
|
||||
}
|
||||
|
||||
if (! $mesg)
|
||||
if (!$mesg)
|
||||
{
|
||||
$db->close();
|
||||
exit;
|
||||
@@ -260,7 +260,7 @@ if ($action == 'builddoc')
|
||||
|
||||
if (empty($conf->barcode->enabled)) accessforbidden();
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('', $langs->trans("BarCodePrintsheet"));
|
||||
|
||||
@@ -287,15 +287,15 @@ print ' <div class="tagtd" style="overflow: hidden; white-space: nowrap; max-wid
|
||||
print $langs->trans("DescADHERENT_ETIQUETTE_TYPE").' ';
|
||||
print '</div><div class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;">';
|
||||
// List of possible labels (defined into $_Avery_Labels variable set into core/lib/format_cards.lib.php)
|
||||
$arrayoflabels=array();
|
||||
foreach(array_keys($_Avery_Labels) as $codecards)
|
||||
$arrayoflabels = array();
|
||||
foreach (array_keys($_Avery_Labels) as $codecards)
|
||||
{
|
||||
$labeltoshow=$_Avery_Labels[$codecards]['name'];
|
||||
$labeltoshow = $_Avery_Labels[$codecards]['name'];
|
||||
//$labeltoshow.=' ('.$_Avery_Labels[$row['code']]['paper-size'].')';
|
||||
$arrayoflabels[$codecards]=$labeltoshow;
|
||||
$arrayoflabels[$codecards] = $labeltoshow;
|
||||
}
|
||||
asort($arrayoflabels);
|
||||
print $form->selectarray('modellabel', $arrayoflabels, (GETPOST('modellabel')?GETPOST('modellabel'):$conf->global->ADHERENT_ETIQUETTE_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
print $form->selectarray('modellabel', $arrayoflabels, (GETPOST('modellabel') ?GETPOST('modellabel') : $conf->global->ADHERENT_ETIQUETTE_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
print '</div></div>';
|
||||
|
||||
// Number of stickers to print
|
||||
@@ -303,7 +303,7 @@ print ' <div class="tagtr">';
|
||||
print ' <div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
|
||||
print $langs->trans("NumberOfStickers").' ';
|
||||
print '</div><div class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;">';
|
||||
print '<input size="4" type="text" name="numberofsticker" value="'.(GETPOST('numberofsticker')?GETPOST('numberofsticker', 'int'):10).'">';
|
||||
print '<input size="4" type="text" name="numberofsticker" value="'.(GETPOST('numberofsticker') ?GETPOST('numberofsticker', 'int') : 10).'">';
|
||||
print '</div></div>';
|
||||
|
||||
print '</div>';
|
||||
@@ -372,12 +372,12 @@ jQuery(document).ready(function() {
|
||||
</script>';
|
||||
|
||||
// Checkbox to select from free text
|
||||
print '<input id="fillmanually" type="radio" '.((! GETPOST("selectorforbarcode") || GETPOST("selectorforbarcode")=='fillmanually')?'checked ':'').'name="selectorforbarcode" value="fillmanually" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueManually").' ';
|
||||
print '<input id="fillmanually" type="radio" '.((!GETPOST("selectorforbarcode") || GETPOST("selectorforbarcode") == 'fillmanually') ? 'checked ' : '').'name="selectorforbarcode" value="fillmanually" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueManually").' ';
|
||||
print '<br>';
|
||||
|
||||
if (! empty($user->rights->produit->lire) || ! empty($user->rights->service->lire))
|
||||
if (!empty($user->rights->produit->lire) || !empty($user->rights->service->lire))
|
||||
{
|
||||
print '<input id="fillfromproduct" type="radio" '.((GETPOST("selectorforbarcode")=='fillfromproduct')?'checked ':'').'name="selectorforbarcode" value="fillfromproduct" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromProduct").' ';
|
||||
print '<input id="fillfromproduct" type="radio" '.((GETPOST("selectorforbarcode") == 'fillfromproduct') ? 'checked ' : '').'name="selectorforbarcode" value="fillfromproduct" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromProduct").' ';
|
||||
print '<br>';
|
||||
print '<div class="showforproductselector">';
|
||||
$form->select_produits(GETPOST('productid'), 'productid', '', '', 0, -1, 2, '', 0, array(), 0, '1', 0, 'minwidth400imp', 1);
|
||||
@@ -385,9 +385,9 @@ if (! empty($user->rights->produit->lire) || ! empty($user->rights->service->lir
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
if (! empty($user->rights->societe->lire))
|
||||
if (!empty($user->rights->societe->lire))
|
||||
{
|
||||
print '<input id="fillfromthirdparty" type="radio" '.((GETPOST("selectorforbarcode")=='fillfromthirdparty')?'checked ':'').'name="selectorforbarcode" value="fillfromthirdparty" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").' ';
|
||||
print '<input id="fillfromthirdparty" type="radio" '.((GETPOST("selectorforbarcode") == 'fillfromthirdparty') ? 'checked ' : '').'name="selectorforbarcode" value="fillfromthirdparty" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").' ';
|
||||
print '<br>';
|
||||
print '<div class="showforthirdpartyselector">';
|
||||
print $form->select_company(GETPOST('socid'), 'socid', '', 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300');
|
||||
@@ -435,7 +435,7 @@ print '<br>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<br><input class="button" type="submit" id="submitformbarcodegen" '.((GETPOST("selectorforbarcode") && GETPOST("selectorforbarcode"))?'':'disabled ').'value="'.$langs->trans("BuildPageToPrint").'">';
|
||||
print '<br><input class="button" type="submit" id="submitformbarcodegen" '.((GETPOST("selectorforbarcode") && GETPOST("selectorforbarcode")) ? '' : 'disabled ').'value="'.$langs->trans("BuildPageToPrint").'">';
|
||||
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
|
||||
@@ -67,12 +67,12 @@ class BlockedLogAuthority
|
||||
|
||||
$this->signature = $block_static->getSignature();
|
||||
|
||||
$blocks = $block_static->getLog('all', 0, 0, 'rowid', 'ASC') ;
|
||||
$blocks = $block_static->getLog('all', 0, 0, 'rowid', 'ASC');
|
||||
|
||||
$this->blockchain = '';
|
||||
|
||||
foreach($blocks as &$b) {
|
||||
$this->blockchain.=$b->signature;
|
||||
foreach ($blocks as &$b) {
|
||||
$this->blockchain .= $b->signature;
|
||||
}
|
||||
|
||||
return $this->blockchain;
|
||||
@@ -98,7 +98,7 @@ class BlockedLogAuthority
|
||||
public function checkBlockchain($hash)
|
||||
{
|
||||
|
||||
return ($hash === $this->getBlockchainHash() );
|
||||
return ($hash === $this->getBlockchainHash());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -110,7 +110,7 @@ class BlockedLogAuthority
|
||||
public function addBlock($block)
|
||||
{
|
||||
|
||||
$this->blockchain.=$block;
|
||||
$this->blockchain .= $block;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,14 +122,14 @@ class BlockedLogAuthority
|
||||
public function checkBlock($block)
|
||||
{
|
||||
|
||||
if(strlen($block)!=64) return false;
|
||||
if (strlen($block) != 64) return false;
|
||||
|
||||
$blocks = str_split($this->blockchain, 64);
|
||||
|
||||
if(!in_array($block, $blocks)) {
|
||||
if (!in_array($block, $blocks)) {
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -151,44 +151,44 @@ class BlockedLogAuthority
|
||||
|
||||
if (empty($id) && empty($signature))
|
||||
{
|
||||
$this->error='BadParameter';
|
||||
$this->error = 'BadParameter';
|
||||
return -1;
|
||||
}
|
||||
|
||||
$langs->load("blockedlog");
|
||||
|
||||
$sql = "SELECT b.rowid, b.signature, b.blockchain, b.tms";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."blockedlog_authority as b";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."blockedlog_authority as b";
|
||||
|
||||
if ($id) $sql.= " WHERE b.rowid = ". $id;
|
||||
elseif($signature)$sql.= " WHERE b.signature = '". $this->db->escape($signature) ."'" ;
|
||||
if ($id) $sql .= " WHERE b.rowid = ".$id;
|
||||
elseif ($signature)$sql .= " WHERE b.signature = '".$this->db->escape($signature)."'";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->rowid;
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->rowid;
|
||||
|
||||
$this->signature = $obj->signature;
|
||||
$this->blockchain = $obj->blockchain;
|
||||
$this->signature = $obj->signature;
|
||||
$this->blockchain = $obj->blockchain;
|
||||
|
||||
$this->tms = $this->db->jdate($obj->tms);
|
||||
$this->tms = $this->db->jdate($obj->tms);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$langs->trans("RecordNotFound");
|
||||
$this->error = $langs->trans("RecordNotFound");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error = $this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -202,23 +202,23 @@ class BlockedLogAuthority
|
||||
public function create($user)
|
||||
{
|
||||
|
||||
global $conf,$langs,$hookmanager;
|
||||
global $conf, $langs, $hookmanager;
|
||||
|
||||
$langs->load('blockedlog');
|
||||
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
dol_syslog(get_class($this).'::create', LOG_DEBUG);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."blockedlog_authority (";
|
||||
$sql.= " signature,";
|
||||
$sql.= " blockchain";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= "'".$this->db->escape($this->signature)."',";
|
||||
$sql.= "'".$this->db->escape($this->blockchain)."'";
|
||||
$sql.= ")";
|
||||
$sql .= " signature,";
|
||||
$sql .= " blockchain";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= "'".$this->db->escape($this->signature)."',";
|
||||
$sql .= "'".$this->db->escape($this->blockchain)."'";
|
||||
$sql .= ")";
|
||||
|
||||
$res = $this->db->query($sql);
|
||||
if ($res)
|
||||
@@ -241,7 +241,7 @@ class BlockedLogAuthority
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error = $this->db->error();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@@ -256,19 +256,19 @@ class BlockedLogAuthority
|
||||
public function update($user)
|
||||
{
|
||||
|
||||
global $conf,$langs,$hookmanager;
|
||||
global $conf, $langs, $hookmanager;
|
||||
|
||||
$langs->load('blockedlog');
|
||||
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
dol_syslog(get_class($this).'::create', LOG_DEBUG);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."blockedlog_authority SET ";
|
||||
$sql.= " blockchain='".$this->db->escape($this->blockchain)."'";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
$sql .= " blockchain='".$this->db->escape($this->blockchain)."'";
|
||||
$sql .= " WHERE rowid=".$this->id;
|
||||
|
||||
$res = $this->db->query($sql);
|
||||
if ($res)
|
||||
@@ -279,7 +279,7 @@ class BlockedLogAuthority
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error = $this->db->error();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@@ -296,7 +296,7 @@ class BlockedLogAuthority
|
||||
|
||||
//TODO create cron task on activation
|
||||
|
||||
if(empty($conf->global->BLOCKEDLOG_AUTHORITY_URL) || empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) {
|
||||
if (empty($conf->global->BLOCKEDLOG_AUTHORITY_URL) || empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) {
|
||||
$this->error = $langs->trans('NoAuthorityURLDefined');
|
||||
return -2;
|
||||
}
|
||||
@@ -307,14 +307,14 @@ class BlockedLogAuthority
|
||||
|
||||
$blocks = $block_static->getLog('not_certified', 0, 0, 'rowid', 'ASC');
|
||||
|
||||
$signature=$block_static->getSignature();
|
||||
$signature = $block_static->getSignature();
|
||||
|
||||
foreach($blocks as &$block) {
|
||||
foreach ($blocks as &$block) {
|
||||
$url = $conf->global->BLOCKEDLOG_AUTHORITY_URL.'/blockedlog/ajax/authority.php?s='.$signature.'&b='.$block->signature;
|
||||
|
||||
$res = file_get_contents($url);
|
||||
echo $block->signature.' '.$url. ' '.$res.'<br>';
|
||||
if($res === 'blockalreadyadded' || $res === 'blockadded') {
|
||||
echo $block->signature.' '.$url.' '.$res.'<br>';
|
||||
if ($res === 'blockalreadyadded' || $res === 'blockadded') {
|
||||
$block->setCertified();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -115,7 +115,7 @@ class BlockedLog
|
||||
public $ref_object = '';
|
||||
|
||||
public $object_data = null;
|
||||
public $user_fullname='';
|
||||
public $user_fullname = '';
|
||||
|
||||
/**
|
||||
* Array of tracked event codes
|
||||
@@ -138,14 +138,14 @@ class BlockedLog
|
||||
|
||||
$this->trackedevents = array();
|
||||
|
||||
if ($conf->facture->enabled) $this->trackedevents['BILL_VALIDATE']='logBILL_VALIDATE';
|
||||
if ($conf->facture->enabled) $this->trackedevents['BILL_DELETE']='logBILL_DELETE';
|
||||
if ($conf->facture->enabled) $this->trackedevents['BILL_SENTBYMAIL']='logBILL_SENTBYMAIL';
|
||||
if ($conf->facture->enabled) $this->trackedevents['DOC_DOWNLOAD']='BlockedLogBillDownload';
|
||||
if ($conf->facture->enabled) $this->trackedevents['DOC_PREVIEW']='BlockedLogBillPreview';
|
||||
if ($conf->facture->enabled) $this->trackedevents['BILL_VALIDATE'] = 'logBILL_VALIDATE';
|
||||
if ($conf->facture->enabled) $this->trackedevents['BILL_DELETE'] = 'logBILL_DELETE';
|
||||
if ($conf->facture->enabled) $this->trackedevents['BILL_SENTBYMAIL'] = 'logBILL_SENTBYMAIL';
|
||||
if ($conf->facture->enabled) $this->trackedevents['DOC_DOWNLOAD'] = 'BlockedLogBillDownload';
|
||||
if ($conf->facture->enabled) $this->trackedevents['DOC_PREVIEW'] = 'BlockedLogBillPreview';
|
||||
|
||||
if ($conf->facture->enabled) $this->trackedevents['PAYMENT_CUSTOMER_CREATE']='logPAYMENT_CUSTOMER_CREATE';
|
||||
if ($conf->facture->enabled) $this->trackedevents['PAYMENT_CUSTOMER_DELETE']='logPAYMENT_CUSTOMER_DELETE';
|
||||
if ($conf->facture->enabled) $this->trackedevents['PAYMENT_CUSTOMER_CREATE'] = 'logPAYMENT_CUSTOMER_CREATE';
|
||||
if ($conf->facture->enabled) $this->trackedevents['PAYMENT_CUSTOMER_DELETE'] = 'logPAYMENT_CUSTOMER_DELETE';
|
||||
|
||||
/* Supplier
|
||||
if ($conf->fournisseur->enabled) $this->trackedevents['BILL_SUPPLIER_VALIDATE']='BlockedLogSupplierBillValidate';
|
||||
@@ -158,12 +158,12 @@ class BlockedLog
|
||||
if ($conf->fournisseur->enabled) $this->trackedevents['PAYMENT_SUPPLIER_DELETE']='BlockedLogsupplierBillPaymentCreate';
|
||||
*/
|
||||
|
||||
if ($conf->don->enabled) $this->trackedevents['DON_VALIDATE']='logDON_VALIDATE';
|
||||
if ($conf->don->enabled) $this->trackedevents['DON_DELETE']='logDON_DELETE';
|
||||
if ($conf->don->enabled) $this->trackedevents['DON_VALIDATE'] = 'logDON_VALIDATE';
|
||||
if ($conf->don->enabled) $this->trackedevents['DON_DELETE'] = 'logDON_DELETE';
|
||||
//if ($conf->don->enabled) $this->trackedevents['DON_SENTBYMAIL']='logDON_SENTBYMAIL';
|
||||
|
||||
if ($conf->don->enabled) $this->trackedevents['DONATION_PAYMENT_CREATE']='logDONATION_PAYMENT_CREATE';
|
||||
if ($conf->don->enabled) $this->trackedevents['DONATION_PAYMENT_DELETE']='logDONATION_PAYMENT_DELETE';
|
||||
if ($conf->don->enabled) $this->trackedevents['DONATION_PAYMENT_CREATE'] = 'logDONATION_PAYMENT_CREATE';
|
||||
if ($conf->don->enabled) $this->trackedevents['DONATION_PAYMENT_DELETE'] = 'logDONATION_PAYMENT_DELETE';
|
||||
|
||||
/*
|
||||
if ($conf->salary->enabled) $this->trackedevents['PAYMENT_SALARY_CREATE']='BlockedLogSalaryPaymentCreate';
|
||||
@@ -171,18 +171,18 @@ class BlockedLog
|
||||
if ($conf->salary->enabled) $this->trackedevents['PAYMENT_SALARY_DELETE']='BlockedLogSalaryPaymentCreate';
|
||||
*/
|
||||
|
||||
if ($conf->adherent->enabled) $this->trackedevents['MEMBER_SUBSCRIPTION_CREATE']='logMEMBER_SUBSCRIPTION_CREATE';
|
||||
if ($conf->adherent->enabled) $this->trackedevents['MEMBER_SUBSCRIPTION_MODIFY']='logMEMBER_SUBSCRIPTION_MODIFY';
|
||||
if ($conf->adherent->enabled) $this->trackedevents['MEMBER_SUBSCRIPTION_DELETE']='logMEMBER_SUBSCRIPTION_DELETE';
|
||||
if ($conf->adherent->enabled) $this->trackedevents['MEMBER_SUBSCRIPTION_CREATE'] = 'logMEMBER_SUBSCRIPTION_CREATE';
|
||||
if ($conf->adherent->enabled) $this->trackedevents['MEMBER_SUBSCRIPTION_MODIFY'] = 'logMEMBER_SUBSCRIPTION_MODIFY';
|
||||
if ($conf->adherent->enabled) $this->trackedevents['MEMBER_SUBSCRIPTION_DELETE'] = 'logMEMBER_SUBSCRIPTION_DELETE';
|
||||
|
||||
|
||||
if ($conf->banque->enabled) $this->trackedevents['PAYMENT_VARIOUS_CREATE']='logPAYMENT_VARIOUS_CREATE';
|
||||
if ($conf->banque->enabled) $this->trackedevents['PAYMENT_VARIOUS_MODIFY']='logPAYMENT_VARIOUS_MODIFY';
|
||||
if ($conf->banque->enabled) $this->trackedevents['PAYMENT_VARIOUS_DELETE']='logPAYMENT_VARIOUS_DELETE';
|
||||
if ($conf->banque->enabled) $this->trackedevents['PAYMENT_VARIOUS_CREATE'] = 'logPAYMENT_VARIOUS_CREATE';
|
||||
if ($conf->banque->enabled) $this->trackedevents['PAYMENT_VARIOUS_MODIFY'] = 'logPAYMENT_VARIOUS_MODIFY';
|
||||
if ($conf->banque->enabled) $this->trackedevents['PAYMENT_VARIOUS_DELETE'] = 'logPAYMENT_VARIOUS_DELETE';
|
||||
|
||||
// $conf->global->BANK_ENABLE_POS_CASHCONTROL must be set to 1 by all POS modules
|
||||
$moduleposenabled = ($conf->cashdesk->enabled || $conf->takepos->enabled || ! empty($conf->global->BANK_ENABLE_POS_CASHCONTROL));
|
||||
if ($moduleposenabled) $this->trackedevents['CASHCONTROL_VALIDATE']='logCASHCONTROL_VALIDATE';
|
||||
$moduleposenabled = ($conf->cashdesk->enabled || $conf->takepos->enabled || !empty($conf->global->BANK_ENABLE_POS_CASHCONTROL));
|
||||
if ($moduleposenabled) $this->trackedevents['CASHCONTROL_VALIDATE'] = 'logCASHCONTROL_VALIDATE';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -193,102 +193,102 @@ class BlockedLog
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if($this->element === 'facture') {
|
||||
if ($this->element === 'facture') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
|
||||
$object = new Facture($this->db);
|
||||
if ($object->fetch($this->fk_object)>0) {
|
||||
if ($object->fetch($this->fk_object) > 0) {
|
||||
return $object->getNomUrl(1);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
$this->error++;
|
||||
}
|
||||
}
|
||||
if($this->element === 'invoice_supplier') {
|
||||
if ($this->element === 'invoice_supplier') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
|
||||
$object = new FactureFournisseur($this->db);
|
||||
if ($object->fetch($this->fk_object)>0) {
|
||||
if ($object->fetch($this->fk_object) > 0) {
|
||||
return $object->getNomUrl(1);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
$this->error++;
|
||||
}
|
||||
}
|
||||
elseif($this->element === 'payment') {
|
||||
elseif ($this->element === 'payment') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
|
||||
$object = new Paiement($this->db);
|
||||
if ($object->fetch($this->fk_object)>0) {
|
||||
if ($object->fetch($this->fk_object) > 0) {
|
||||
return $object->getNomUrl(1);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
$this->error++;
|
||||
}
|
||||
}
|
||||
elseif($this->element === 'payment_supplier') {
|
||||
elseif ($this->element === 'payment_supplier') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||
|
||||
$object = new PaiementFourn($this->db);
|
||||
if ($object->fetch($this->fk_object)>0) {
|
||||
if ($object->fetch($this->fk_object) > 0) {
|
||||
return $object->getNomUrl(1);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
$this->error++;
|
||||
}
|
||||
}
|
||||
elseif($this->element === 'payment_donation') {
|
||||
elseif ($this->element === 'payment_donation') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/don/class/paymentdonation.class.php';
|
||||
|
||||
$object = new PaymentDonation($this->db);
|
||||
if ($object->fetch($this->fk_object)>0) {
|
||||
if ($object->fetch($this->fk_object) > 0) {
|
||||
return $object->getNomUrl(1);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
$this->error++;
|
||||
}
|
||||
}
|
||||
elseif($this->element === 'payment_various') {
|
||||
elseif ($this->element === 'payment_various') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
|
||||
|
||||
$object = new PaymentVarious($this->db);
|
||||
if ($object->fetch($this->fk_object)>0) {
|
||||
if ($object->fetch($this->fk_object) > 0) {
|
||||
return $object->getNomUrl(1);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
$this->error++;
|
||||
}
|
||||
}
|
||||
elseif($this->element === 'don' || $this->element === 'donation') {
|
||||
elseif ($this->element === 'don' || $this->element === 'donation') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
|
||||
|
||||
$object = new Don($this->db);
|
||||
if ($object->fetch($this->fk_object)>0) {
|
||||
if ($object->fetch($this->fk_object) > 0) {
|
||||
return $object->getNomUrl(1);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
$this->error++;
|
||||
}
|
||||
}
|
||||
elseif($this->element === 'subscription') {
|
||||
elseif ($this->element === 'subscription') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
||||
|
||||
$object = new Subscription($this->db);
|
||||
if ($object->fetch($this->fk_object)>0) {
|
||||
if ($object->fetch($this->fk_object) > 0) {
|
||||
return $object->getNomUrl(1);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
$this->error++;
|
||||
}
|
||||
}
|
||||
elseif($this->element === 'cashcontrol') {
|
||||
elseif ($this->element === 'cashcontrol') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php';
|
||||
|
||||
$object = new CashControl($this->db);
|
||||
if ($object->fetch($this->fk_object)>0) {
|
||||
if ($object->fetch($this->fk_object) > 0) {
|
||||
return $object->getNomUrl(1);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
$this->error++;
|
||||
}
|
||||
}
|
||||
@@ -318,16 +318,16 @@ class BlockedLog
|
||||
{
|
||||
global $langs, $cachedUser;
|
||||
|
||||
if(empty($cachedUser))$cachedUser=array();
|
||||
if (empty($cachedUser))$cachedUser = array();
|
||||
|
||||
if(empty($cachedUser[$this->fk_user])) {
|
||||
$u=new User($this->db);
|
||||
if($u->fetch($this->fk_user)>0) {
|
||||
if (empty($cachedUser[$this->fk_user])) {
|
||||
$u = new User($this->db);
|
||||
if ($u->fetch($this->fk_user) > 0) {
|
||||
$cachedUser[$this->fk_user] = $u;
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($cachedUser[$this->fk_user])) {
|
||||
if (!empty($cachedUser[$this->fk_user])) {
|
||||
return $cachedUser[$this->fk_user]->getNomUrl(1);
|
||||
}
|
||||
|
||||
@@ -354,25 +354,25 @@ class BlockedLog
|
||||
// action
|
||||
$this->action = $action;
|
||||
// amount
|
||||
$this->amounts= $amounts;
|
||||
$this->amounts = $amounts;
|
||||
// date
|
||||
if ($object->element == 'payment' || $object->element == 'payment_supplier')
|
||||
{
|
||||
$this->date_object = $object->datepaye;
|
||||
}
|
||||
elseif ($object->element=='payment_salary')
|
||||
elseif ($object->element == 'payment_salary')
|
||||
{
|
||||
$this->date_object = $object->datev;
|
||||
}
|
||||
elseif ($object->element == 'payment_donation' || $object->element == 'payment_various')
|
||||
{
|
||||
$this->date_object = $object->datepaid?$object->datepaid:$object->datep;
|
||||
$this->date_object = $object->datepaid ? $object->datepaid : $object->datep;
|
||||
}
|
||||
elseif ($object->element=='subscription')
|
||||
elseif ($object->element == 'subscription')
|
||||
{
|
||||
$this->date_object = $object->dateh;
|
||||
}
|
||||
elseif ($object->element=='cashcontrol')
|
||||
elseif ($object->element == 'cashcontrol')
|
||||
{
|
||||
$this->date_object = $object->date_creation;
|
||||
}
|
||||
@@ -380,7 +380,7 @@ class BlockedLog
|
||||
$this->date_object = $object->date;
|
||||
}
|
||||
// ref
|
||||
$this->ref_object = ((! empty($object->newref)) ? $object->newref : $object->ref); // newref is set when validating a draft, ref is set in other cases
|
||||
$this->ref_object = ((!empty($object->newref)) ? $object->newref : $object->ref); // newref is set when validating a draft, ref is set in other cases
|
||||
// type of object
|
||||
$this->element = $object->element;
|
||||
// id of object
|
||||
@@ -388,11 +388,11 @@ class BlockedLog
|
||||
|
||||
|
||||
// Set object_data
|
||||
$this->object_data=new stdClass();
|
||||
$this->object_data = new stdClass();
|
||||
// Add fields to exclude
|
||||
$arrayoffieldstoexclude = array(
|
||||
'table_element','fields','ref_previous','ref_next','origin','origin_id','oldcopy','picto','error','errors','modelpdf','last_main_doc','civility_id','contact','contact_id',
|
||||
'table_element_line','ismultientitymanaged','isextrafieldmanaged',
|
||||
'table_element', 'fields', 'ref_previous', 'ref_next', 'origin', 'origin_id', 'oldcopy', 'picto', 'error', 'errors', 'modelpdf', 'last_main_doc', 'civility_id', 'contact', 'contact_id',
|
||||
'table_element_line', 'ismultientitymanaged', 'isextrafieldmanaged',
|
||||
'linkedObjectsIds',
|
||||
'linkedObjects',
|
||||
'fk_delivery_address',
|
||||
@@ -402,48 +402,48 @@ class BlockedLog
|
||||
// Add more fields to exclude depending on object type
|
||||
if ($this->element == 'cashcontrol') {
|
||||
$arrayoffieldstoexclude = array_merge($arrayoffieldstoexclude, array(
|
||||
'name','lastname','firstname','region','region_id','region_code','state','state_id','state_code','country','country_id','country_code',
|
||||
'total_ht','total_tva','total_ttc','total_localtax1','total_localtax2',
|
||||
'barcode_type','barcode_type_code','barcode_type_label','barcode_type_coder','mode_reglement_id','cond_reglement_id','mode_reglement','cond_reglement','shipping_method_id',
|
||||
'fk_incoterms','label_incoterms','location_incoterms','lines')
|
||||
'name', 'lastname', 'firstname', 'region', 'region_id', 'region_code', 'state', 'state_id', 'state_code', 'country', 'country_id', 'country_code',
|
||||
'total_ht', 'total_tva', 'total_ttc', 'total_localtax1', 'total_localtax2',
|
||||
'barcode_type', 'barcode_type_code', 'barcode_type_label', 'barcode_type_coder', 'mode_reglement_id', 'cond_reglement_id', 'mode_reglement', 'cond_reglement', 'shipping_method_id',
|
||||
'fk_incoterms', 'label_incoterms', 'location_incoterms', 'lines')
|
||||
);
|
||||
}
|
||||
|
||||
// Add thirdparty info
|
||||
if (empty($object->thirdparty) && method_exists($object, 'fetch_thirdparty')) $object->fetch_thirdparty();
|
||||
if (! empty($object->thirdparty))
|
||||
if (!empty($object->thirdparty))
|
||||
{
|
||||
$this->object_data->thirdparty = new stdClass();
|
||||
|
||||
foreach($object->thirdparty as $key=>$value)
|
||||
foreach ($object->thirdparty as $key=>$value)
|
||||
{
|
||||
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
|
||||
if (! in_array($key, array(
|
||||
'name','name_alias','ref_ext','address','zip','town','state_code','country_code','idprof1','idprof2','idprof3','idprof4','idprof5','idprof6','phone','fax','email','barcode',
|
||||
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
|
||||
if (!in_array($key, array(
|
||||
'name', 'name_alias', 'ref_ext', 'address', 'zip', 'town', 'state_code', 'country_code', 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', 'phone', 'fax', 'email', 'barcode',
|
||||
'tva_intra', 'localtax1_assuj', 'localtax1_value', 'localtax2_assuj', 'localtax2_value', 'managers', 'capital', 'typent_code', 'forme_juridique_code', 'code_client', 'code_fournisseur'
|
||||
))) continue; // Discard if not into a dedicated list
|
||||
))) continue; // Discard if not into a dedicated list
|
||||
if (!is_object($value)) $this->object_data->thirdparty->{$key} = $value;
|
||||
}
|
||||
}
|
||||
|
||||
// Add company info
|
||||
if (! empty($mysoc))
|
||||
if (!empty($mysoc))
|
||||
{
|
||||
$this->object_data->mycompany = new stdClass();
|
||||
|
||||
foreach($mysoc as $key=>$value)
|
||||
foreach ($mysoc as $key=>$value)
|
||||
{
|
||||
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
|
||||
if (! in_array($key, array(
|
||||
'name','name_alias','ref_ext','address','zip','town','state_code','country_code','idprof1','idprof2','idprof3','idprof4','idprof5','idprof6','phone','fax','email','barcode',
|
||||
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
|
||||
if (!in_array($key, array(
|
||||
'name', 'name_alias', 'ref_ext', 'address', 'zip', 'town', 'state_code', 'country_code', 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', 'phone', 'fax', 'email', 'barcode',
|
||||
'tva_intra', 'localtax1_assuj', 'localtax1_value', 'localtax2_assuj', 'localtax2_value', 'managers', 'capital', 'typent_code', 'forme_juridique_code', 'code_client', 'code_fournisseur'
|
||||
))) continue; // Discard if not into a dedicated list
|
||||
))) continue; // Discard if not into a dedicated list
|
||||
if (!is_object($value)) $this->object_data->mycompany->{$key} = $value;
|
||||
}
|
||||
}
|
||||
|
||||
// Add user info
|
||||
if (! empty($user))
|
||||
if (!empty($user))
|
||||
{
|
||||
$this->fk_user = $user->id;
|
||||
$this->user_fullname = $user->getFullName($langs);
|
||||
@@ -452,25 +452,25 @@ class BlockedLog
|
||||
// Field specific to object
|
||||
if ($this->element == 'facture')
|
||||
{
|
||||
foreach($object as $key=>$value)
|
||||
foreach ($object as $key=>$value)
|
||||
{
|
||||
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
|
||||
if (! in_array($key, array(
|
||||
'ref','ref_client','ref_supplier','date','datef','datev','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public','lines'
|
||||
))) continue; // Discard if not into a dedicated list
|
||||
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
|
||||
if (!in_array($key, array(
|
||||
'ref', 'ref_client', 'ref_supplier', 'date', 'datef', 'datev', 'type', 'total_ht', 'total_tva', 'total_ttc', 'localtax1', 'localtax2', 'revenuestamp', 'datepointoftax', 'note_public', 'lines'
|
||||
))) continue; // Discard if not into a dedicated list
|
||||
if ($key == 'lines')
|
||||
{
|
||||
$lineid=0;
|
||||
foreach($value as $tmpline) // $tmpline is object FactureLine
|
||||
$lineid = 0;
|
||||
foreach ($value as $tmpline) // $tmpline is object FactureLine
|
||||
{
|
||||
$lineid++;
|
||||
foreach($tmpline as $keyline => $valueline)
|
||||
foreach ($tmpline as $keyline => $valueline)
|
||||
{
|
||||
if (! in_array($keyline, array(
|
||||
'ref','multicurrency_code','multicurrency_total_ht','multicurrency_total_tva','multicurrency_total_ttc','qty','product_type','vat_src_code','tva_tx','info_bits','localtax1_tx','localtax2_tx','total_ht','total_tva','total_ttc','total_localtax1','total_localtax2'
|
||||
))) continue; // Discard if not into a dedicated list
|
||||
if (!in_array($keyline, array(
|
||||
'ref', 'multicurrency_code', 'multicurrency_total_ht', 'multicurrency_total_tva', 'multicurrency_total_ttc', 'qty', 'product_type', 'vat_src_code', 'tva_tx', 'info_bits', 'localtax1_tx', 'localtax2_tx', 'total_ht', 'total_tva', 'total_ttc', 'total_localtax1', 'total_localtax2'
|
||||
))) continue; // Discard if not into a dedicated list
|
||||
|
||||
if (! is_object($this->object_data->invoiceline[$lineid])) $this->object_data->invoiceline[$lineid] = new stdClass();
|
||||
if (!is_object($this->object_data->invoiceline[$lineid])) $this->object_data->invoiceline[$lineid] = new stdClass();
|
||||
|
||||
$this->object_data->invoiceline[$lineid]->{$keyline} = $valueline;
|
||||
}
|
||||
@@ -479,43 +479,43 @@ class BlockedLog
|
||||
elseif (!is_object($value)) $this->object_data->{$key} = $value;
|
||||
}
|
||||
|
||||
if (! empty($object->newref)) $this->object_data->ref = $object->newref;
|
||||
if (!empty($object->newref)) $this->object_data->ref = $object->newref;
|
||||
}
|
||||
elseif ($this->element == 'invoice_supplier')
|
||||
{
|
||||
foreach($object as $key=>$value)
|
||||
foreach ($object as $key=>$value)
|
||||
{
|
||||
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
|
||||
if (! in_array($key, array(
|
||||
'ref','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public'
|
||||
))) continue; // Discard if not into a dedicated list
|
||||
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
|
||||
if (!in_array($key, array(
|
||||
'ref', 'ref_client', 'ref_supplier', 'date', 'datef', 'type', 'total_ht', 'total_tva', 'total_ttc', 'localtax1', 'localtax2', 'revenuestamp', 'datepointoftax', 'note_public'
|
||||
))) continue; // Discard if not into a dedicated list
|
||||
if (!is_object($value)) $this->object_data->{$key} = $value;
|
||||
}
|
||||
|
||||
if (! empty($object->newref)) $this->object_data->ref = $object->newref;
|
||||
if (!empty($object->newref)) $this->object_data->ref = $object->newref;
|
||||
}
|
||||
elseif ($this->element == 'payment' || $this->element == 'payment_supplier' || $this->element == 'payment_donation' || $this->element == 'payment_various')
|
||||
{
|
||||
$datepayment = $object->datepaye?$object->datepaye:($object->datepaid?$object->datepaid:$object->datep);
|
||||
$paymenttypeid = $object->paiementid?$object->paiementid:($object->paymenttype?$object->paymenttype:$object->type_payment);
|
||||
$datepayment = $object->datepaye ? $object->datepaye : ($object->datepaid ? $object->datepaid : $object->datep);
|
||||
$paymenttypeid = $object->paiementid ? $object->paiementid : ($object->paymenttype ? $object->paymenttype : $object->type_payment);
|
||||
|
||||
$this->object_data->ref = $object->ref;
|
||||
$this->object_data->date = $datepayment;
|
||||
$this->object_data->type_code = dol_getIdFromCode($this->db, $paymenttypeid, 'c_paiement', 'id', 'code');
|
||||
$this->object_data->payment_num = ($object->num_paiement?$object->num_paiement:$object->num_payment);
|
||||
$this->object_data->payment_num = ($object->num_paiement ? $object->num_paiement : $object->num_payment);
|
||||
//$this->object_data->fk_account = $object->fk_account;
|
||||
$this->object_data->note = $object->note;
|
||||
//var_dump($this->object_data);exit;
|
||||
|
||||
$totalamount=0;
|
||||
$totalamount = 0;
|
||||
|
||||
if (! is_array($object->amounts) && $object->amount)
|
||||
if (!is_array($object->amounts) && $object->amount)
|
||||
{
|
||||
$object->amounts=array($object->id => $object->amount);
|
||||
$object->amounts = array($object->id => $object->amount);
|
||||
}
|
||||
|
||||
$paymentpartnumber=0;
|
||||
foreach($object->amounts as $objid => $amount)
|
||||
$paymentpartnumber = 0;
|
||||
foreach ($object->amounts as $objid => $amount)
|
||||
{
|
||||
if (empty($amount)) continue;
|
||||
|
||||
@@ -543,7 +543,7 @@ class BlockedLog
|
||||
$tmpobject = new PaymentVarious($this->db);
|
||||
}
|
||||
|
||||
if (! is_object($tmpobject))
|
||||
if (!is_object($tmpobject))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -561,12 +561,12 @@ class BlockedLog
|
||||
$paymentpart = new stdClass();
|
||||
$paymentpart->amount = $amount;
|
||||
|
||||
if (! in_array($this->element, array('payment_donation', 'payment_various')))
|
||||
if (!in_array($this->element, array('payment_donation', 'payment_various')))
|
||||
{
|
||||
$result = $tmpobject->fetch_thirdparty();
|
||||
if ($result == 0)
|
||||
{
|
||||
$this->error='Failed to fetch thirdparty for object with id '.$tmpobject->id;
|
||||
$this->error = 'Failed to fetch thirdparty for object with id '.$tmpobject->id;
|
||||
$this->errors[] = $this->error;
|
||||
dol_syslog("Failed to fetch thirdparty for object with id ".$tmpobject->id, LOG_ERR);
|
||||
return -1;
|
||||
@@ -610,43 +610,43 @@ class BlockedLog
|
||||
}
|
||||
}
|
||||
|
||||
$paymentpartnumber++; // first payment will be 1
|
||||
$paymentpartnumber++; // first payment will be 1
|
||||
$this->object_data->payment_part[$paymentpartnumber] = $paymentpart;
|
||||
}
|
||||
}
|
||||
|
||||
$this->object_data->amount = $totalamount;
|
||||
|
||||
if (! empty($object->newref)) $this->object_data->ref = $object->newref;
|
||||
if (!empty($object->newref)) $this->object_data->ref = $object->newref;
|
||||
}
|
||||
elseif($this->element == 'payment_salary')
|
||||
elseif ($this->element == 'payment_salary')
|
||||
{
|
||||
$this->object_data->amounts = array($object->amount);
|
||||
|
||||
if (! empty($object->newref)) $this->object_data->ref = $object->newref;
|
||||
if (!empty($object->newref)) $this->object_data->ref = $object->newref;
|
||||
}
|
||||
elseif($this->element == 'subscription')
|
||||
elseif ($this->element == 'subscription')
|
||||
{
|
||||
foreach($object as $key=>$value)
|
||||
foreach ($object as $key=>$value)
|
||||
{
|
||||
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
|
||||
if (! in_array($key, array(
|
||||
'id','datec','dateh','datef','fk_adherent','amount','import_key','statut','note'
|
||||
))) continue; // Discard if not into a dedicated list
|
||||
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
|
||||
if (!in_array($key, array(
|
||||
'id', 'datec', 'dateh', 'datef', 'fk_adherent', 'amount', 'import_key', 'statut', 'note'
|
||||
))) continue; // Discard if not into a dedicated list
|
||||
if (!is_object($value)) $this->object_data->{$key} = $value;
|
||||
}
|
||||
|
||||
if (! empty($object->newref)) $this->object_data->ref = $object->newref;
|
||||
if (!empty($object->newref)) $this->object_data->ref = $object->newref;
|
||||
}
|
||||
else // Generic case
|
||||
{
|
||||
foreach($object as $key=>$value)
|
||||
foreach ($object as $key=>$value)
|
||||
{
|
||||
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
|
||||
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
|
||||
if (!is_object($value)) $this->object_data->{$key} = $value;
|
||||
}
|
||||
|
||||
if (! empty($object->newref)) $this->object_data->ref = $object->newref;
|
||||
if (!empty($object->newref)) $this->object_data->ref = $object->newref;
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -667,59 +667,59 @@ class BlockedLog
|
||||
|
||||
if (empty($id))
|
||||
{
|
||||
$this->error='BadParameter';
|
||||
$this->error = 'BadParameter';
|
||||
return -1;
|
||||
}
|
||||
|
||||
$langs->load("blockedlog");
|
||||
|
||||
$sql = "SELECT b.rowid, b.date_creation, b.signature, b.signature_line, b.amounts, b.action, b.element, b.fk_object, b.entity,";
|
||||
$sql.= " b.certified, b.tms, b.fk_user, b.user_fullname, b.date_object, b.ref_object, b.object_data";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."blockedlog as b";
|
||||
if ($id) $sql.= " WHERE b.rowid = ". $id;
|
||||
$sql .= " b.certified, b.tms, b.fk_user, b.user_fullname, b.date_object, b.ref_object, b.object_data";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."blockedlog as b";
|
||||
if ($id) $sql .= " WHERE b.rowid = ".$id;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->entity = $obj->entity;
|
||||
$this->id = $obj->rowid;
|
||||
$this->entity = $obj->entity;
|
||||
$this->ref = $obj->rowid;
|
||||
|
||||
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$this->tms = $this->db->jdate($obj->tms);
|
||||
|
||||
$this->amounts = (double) $obj->amounts;
|
||||
$this->action = $obj->action;
|
||||
$this->action = $obj->action;
|
||||
$this->element = $obj->element;
|
||||
|
||||
$this->fk_object = $obj->fk_object;
|
||||
$this->date_object = $this->db->jdate($obj->date_object);
|
||||
$this->ref_object = $obj->ref_object;
|
||||
$this->fk_object = $obj->fk_object;
|
||||
$this->date_object = $this->db->jdate($obj->date_object);
|
||||
$this->ref_object = $obj->ref_object;
|
||||
|
||||
$this->fk_user = $obj->fk_user;
|
||||
$this->user_fullname = $obj->user_fullname;
|
||||
$this->fk_user = $obj->fk_user;
|
||||
$this->user_fullname = $obj->user_fullname;
|
||||
|
||||
$this->object_data = $this->dolDecodeBlockedData($obj->object_data);
|
||||
$this->object_data = $this->dolDecodeBlockedData($obj->object_data);
|
||||
|
||||
$this->signature = $obj->signature;
|
||||
$this->signature_line = $obj->signature_line;
|
||||
$this->signature_line = $obj->signature_line;
|
||||
$this->certified = ($obj->certified == 1);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$langs->trans("RecordNotFound");
|
||||
$this->error = $langs->trans("RecordNotFound");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error = $this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -739,7 +739,7 @@ class BlockedLog
|
||||
//include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$aaa = unserialize($data);
|
||||
//$aaa = unserialize($data);
|
||||
} catch(Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
//print $e->getErrs);
|
||||
}
|
||||
return $aaa;
|
||||
@@ -755,7 +755,7 @@ class BlockedLog
|
||||
{
|
||||
|
||||
$res = $this->db->query("UPDATE ".MAIN_DB_PREFIX."blockedlog SET certified=1 WHERE rowid=".$this->id);
|
||||
if($res===false) return false;
|
||||
if ($res === false) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -770,82 +770,82 @@ class BlockedLog
|
||||
public function create($user, $forcesignature = '')
|
||||
{
|
||||
|
||||
global $conf,$langs,$hookmanager;
|
||||
global $conf, $langs, $hookmanager;
|
||||
|
||||
$langs->load('blockedlog');
|
||||
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
// Clean data
|
||||
$this->amounts=(double) $this->amounts;
|
||||
$this->amounts = (double) $this->amounts;
|
||||
|
||||
dol_syslog(get_class($this).'::create action='.$this->action.' fk_user='.$this->fk_user.' user_fullname='.$this->user_fullname, LOG_DEBUG);
|
||||
|
||||
// Check parameters/properties
|
||||
if (! isset($this->amounts)) // amount can be 0 for some events (like when module is disabled)
|
||||
if (!isset($this->amounts)) // amount can be 0 for some events (like when module is disabled)
|
||||
{
|
||||
$this->error=$langs->trans("BlockLogNeedAmountsValue");
|
||||
$this->error = $langs->trans("BlockLogNeedAmountsValue");
|
||||
dol_syslog($this->error, LOG_WARNING);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (empty($this->element)) {
|
||||
$this->error=$langs->trans("BlockLogNeedElement");
|
||||
$this->error = $langs->trans("BlockLogNeedElement");
|
||||
dol_syslog($this->error, LOG_WARNING);
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (empty($this->action)) {
|
||||
$this->error=$langs->trans("BadParameterWhenCallingCreateOfBlockedLog");
|
||||
$this->error = $langs->trans("BadParameterWhenCallingCreateOfBlockedLog");
|
||||
dol_syslog($this->error, LOG_WARNING);
|
||||
return -3;
|
||||
}
|
||||
if (empty($this->fk_user)) $this->user_fullname='(Anonymous)';
|
||||
if (empty($this->fk_user)) $this->user_fullname = '(Anonymous)';
|
||||
|
||||
$this->date_creation = dol_now();
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$previoushash = $this->getPreviousHash(1, 0); // This get last record and lock database until insert is done
|
||||
$previoushash = $this->getPreviousHash(1, 0); // This get last record and lock database until insert is done
|
||||
|
||||
$keyforsignature = $this->buildKeyForSignature();
|
||||
|
||||
$this->signature_line = dol_hash($keyforsignature, '5'); // Not really usefull
|
||||
$this->signature = dol_hash($previoushash . $keyforsignature, '5');
|
||||
$this->signature_line = dol_hash($keyforsignature, '5'); // Not really usefull
|
||||
$this->signature = dol_hash($previoushash.$keyforsignature, '5');
|
||||
if ($forcesignature) $this->signature = $forcesignature;
|
||||
//var_dump($keyforsignature);var_dump($previoushash);var_dump($this->signature_line);var_dump($this->signature);
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."blockedlog (";
|
||||
$sql.= " date_creation,";
|
||||
$sql.= " action,";
|
||||
$sql.= " amounts,";
|
||||
$sql.= " signature,";
|
||||
$sql.= " signature_line,";
|
||||
$sql.= " element,";
|
||||
$sql.= " fk_object,";
|
||||
$sql.= " date_object,";
|
||||
$sql.= " ref_object,";
|
||||
$sql.= " object_data,";
|
||||
$sql.= " certified,";
|
||||
$sql.= " fk_user,";
|
||||
$sql.= " user_fullname,";
|
||||
$sql.= " entity";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= "'".$this->db->idate($this->date_creation)."',";
|
||||
$sql.= "'".$this->db->escape($this->action)."',";
|
||||
$sql.= $this->amounts.",";
|
||||
$sql.= "'".$this->db->escape($this->signature)."',";
|
||||
$sql.= "'".$this->db->escape($this->signature_line)."',";
|
||||
$sql.= "'".$this->db->escape($this->element)."',";
|
||||
$sql.= $this->fk_object.",";
|
||||
$sql.= "'".$this->db->idate($this->date_object)."',";
|
||||
$sql.= "'".$this->db->escape($this->ref_object)."',";
|
||||
$sql.= "'".$this->db->escape(serialize($this->object_data))."',";
|
||||
$sql.= "0,";
|
||||
$sql.= $this->fk_user.",";
|
||||
$sql.= "'".$this->db->escape($this->user_fullname)."',";
|
||||
$sql.= ($this->entity ? $this->entity : $conf->entity);
|
||||
$sql.= ")";
|
||||
$sql .= " date_creation,";
|
||||
$sql .= " action,";
|
||||
$sql .= " amounts,";
|
||||
$sql .= " signature,";
|
||||
$sql .= " signature_line,";
|
||||
$sql .= " element,";
|
||||
$sql .= " fk_object,";
|
||||
$sql .= " date_object,";
|
||||
$sql .= " ref_object,";
|
||||
$sql .= " object_data,";
|
||||
$sql .= " certified,";
|
||||
$sql .= " fk_user,";
|
||||
$sql .= " user_fullname,";
|
||||
$sql .= " entity";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= "'".$this->db->idate($this->date_creation)."',";
|
||||
$sql .= "'".$this->db->escape($this->action)."',";
|
||||
$sql .= $this->amounts.",";
|
||||
$sql .= "'".$this->db->escape($this->signature)."',";
|
||||
$sql .= "'".$this->db->escape($this->signature_line)."',";
|
||||
$sql .= "'".$this->db->escape($this->element)."',";
|
||||
$sql .= $this->fk_object.",";
|
||||
$sql .= "'".$this->db->idate($this->date_object)."',";
|
||||
$sql .= "'".$this->db->escape($this->ref_object)."',";
|
||||
$sql .= "'".$this->db->escape(serialize($this->object_data))."',";
|
||||
$sql .= "0,";
|
||||
$sql .= $this->fk_user.",";
|
||||
$sql .= "'".$this->db->escape($this->user_fullname)."',";
|
||||
$sql .= ($this->entity ? $this->entity : $conf->entity);
|
||||
$sql .= ")";
|
||||
|
||||
$res = $this->db->query($sql);
|
||||
if ($res)
|
||||
@@ -868,7 +868,7 @@ class BlockedLog
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error = $this->db->error();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@@ -891,8 +891,8 @@ class BlockedLog
|
||||
// Recalculate hash
|
||||
$keyforsignature = $this->buildKeyForSignature();
|
||||
|
||||
$signature_line = dol_hash($keyforsignature, '5'); // Not really usefull
|
||||
$signature = dol_hash($previoushash . $keyforsignature, '5');
|
||||
$signature_line = dol_hash($keyforsignature, '5'); // Not really usefull
|
||||
$signature = dol_hash($previoushash.$keyforsignature, '5');
|
||||
//var_dump($previoushash); var_dump($keyforsignature); var_dump($signature_line); var_dump($signature);
|
||||
|
||||
$res = ($signature === $this->signature);
|
||||
@@ -929,13 +929,13 @@ class BlockedLog
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$previoussignature='';
|
||||
$previoussignature = '';
|
||||
|
||||
$sql = "SELECT rowid, signature FROM ".MAIN_DB_PREFIX."blockedlog";
|
||||
$sql.= " WHERE entity=".$conf->entity;
|
||||
if ($beforeid) $sql.= " AND rowid < ".(int) $beforeid;
|
||||
$sql.=" ORDER BY rowid DESC LIMIT 1";
|
||||
$sql.=($withlock ? " FOR UPDATE ": "");
|
||||
$sql .= " WHERE entity=".$conf->entity;
|
||||
if ($beforeid) $sql .= " AND rowid < ".(int) $beforeid;
|
||||
$sql .= " ORDER BY rowid DESC LIMIT 1";
|
||||
$sql .= ($withlock ? " FOR UPDATE " : "");
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@@ -981,38 +981,38 @@ class BlockedLog
|
||||
global $conf, $cachedlogs;
|
||||
|
||||
/* $cachedlogs allow fastest search */
|
||||
if (empty($cachedlogs)) $cachedlogs=array();
|
||||
if (empty($cachedlogs)) $cachedlogs = array();
|
||||
|
||||
if ($element=='all') {
|
||||
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
|
||||
if ($element == 'all') {
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
|
||||
WHERE entity=".$conf->entity;
|
||||
}
|
||||
elseif ($element=='not_certified') {
|
||||
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
|
||||
elseif ($element == 'not_certified') {
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
|
||||
WHERE entity=".$conf->entity." AND certified = 0";
|
||||
}
|
||||
elseif ($element=='just_certified') {
|
||||
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
|
||||
elseif ($element == 'just_certified') {
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
|
||||
WHERE entity=".$conf->entity." AND certified = 1";
|
||||
}
|
||||
else{
|
||||
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
|
||||
else {
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
|
||||
WHERE entity=".$conf->entity." AND element='".$element."' AND fk_object=".(int) $fk_object;
|
||||
}
|
||||
|
||||
if ($search_fk_user > 0) $sql.=natural_search("fk_user", $search_fk_user, 2);
|
||||
if ($search_start > 0) $sql.=" AND date_creation >= '".$this->db->idate($search_start)."'";
|
||||
if ($search_end > 0) $sql.=" AND date_creation <= '".$this->db->idate($search_end)."'";
|
||||
if ($search_ref != '') $sql.=natural_search("ref_object", $search_ref);
|
||||
if ($search_amount != '') $sql.=natural_search("amounts", $search_amount, 1);
|
||||
if ($search_code != '' && $search_code != '-1') $sql.=natural_search("action", $search_code, 3);
|
||||
if ($search_fk_user > 0) $sql .= natural_search("fk_user", $search_fk_user, 2);
|
||||
if ($search_start > 0) $sql .= " AND date_creation >= '".$this->db->idate($search_start)."'";
|
||||
if ($search_end > 0) $sql .= " AND date_creation <= '".$this->db->idate($search_end)."'";
|
||||
if ($search_ref != '') $sql .= natural_search("ref_object", $search_ref);
|
||||
if ($search_amount != '') $sql .= natural_search("amounts", $search_amount, 1);
|
||||
if ($search_code != '' && $search_code != '-1') $sql .= natural_search("action", $search_code, 3);
|
||||
|
||||
$sql.=$this->db->order($sortfield, $sortorder);
|
||||
$sql.=$this->db->plimit($limit+1); // We want more, because we will stop into loop later with error if we reach max
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
$sql .= $this->db->plimit($limit + 1); // We want more, because we will stop into loop later with error if we reach max
|
||||
|
||||
$res = $this->db->query($sql);
|
||||
if($res) {
|
||||
$results=array();
|
||||
if ($res) {
|
||||
$results = array();
|
||||
|
||||
$i = 0;
|
||||
while ($obj = $this->db->fetch_object($res))
|
||||
@@ -1026,7 +1026,7 @@ class BlockedLog
|
||||
|
||||
if (!isset($cachedlogs[$obj->rowid]))
|
||||
{
|
||||
$b=new BlockedLog($this->db);
|
||||
$b = new BlockedLog($this->db);
|
||||
$b->fetch($obj->rowid);
|
||||
|
||||
$cachedlogs[$obj->rowid] = $b;
|
||||
@@ -1048,7 +1048,7 @@ class BlockedLog
|
||||
*/
|
||||
public function getSignature()
|
||||
{
|
||||
global $db,$conf,$mysoc;
|
||||
global $db, $conf, $mysoc;
|
||||
|
||||
if (empty($conf->global->BLOCKEDLOG_ENTITY_FINGERPRINT)) { // creation of a unique fingerprint
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
@@ -1059,7 +1059,7 @@ class BlockedLog
|
||||
|
||||
dolibarr_set_const($db, 'BLOCKEDLOG_ENTITY_FINGERPRINT', $fingerprint, 'chaine', 0, 'Numeric Unique Fingerprint', $conf->entity);
|
||||
|
||||
$conf->global->BLOCKEDLOG_ENTITY_FINGERPRINT=$fingerprint;
|
||||
$conf->global->BLOCKEDLOG_ENTITY_FINGERPRINT = $fingerprint;
|
||||
}
|
||||
|
||||
return $conf->global->BLOCKEDLOG_ENTITY_FINGERPRINT;
|
||||
@@ -1079,12 +1079,12 @@ class BlockedLog
|
||||
$result = false;
|
||||
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog";
|
||||
$sql.= " WHERE entity = ".$conf->entity;
|
||||
if ($ignoresystem) $sql.=" AND action not in ('MODULE_SET','MODULE_RESET')";
|
||||
$sql.= $this->db->plimit(1);
|
||||
$sql .= " WHERE entity = ".$conf->entity;
|
||||
if ($ignoresystem) $sql .= " AND action not in ('MODULE_SET','MODULE_RESET')";
|
||||
$sql .= $this->db->plimit(1);
|
||||
|
||||
$res = $this->db->query($sql);
|
||||
if ($res!==false)
|
||||
if ($res !== false)
|
||||
{
|
||||
$obj = $this->db->fetch_object($res);
|
||||
if ($obj) $result = true;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($langs) || ! is_object($langs))
|
||||
if (empty($langs) || !is_object($langs))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
@@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("main","bills","cashdesk"));
|
||||
$langs->loadLangs(array("main", "bills", "cashdesk"));
|
||||
|
||||
?>
|
||||
|
||||
@@ -45,18 +45,18 @@ $societe = new Societe($db);
|
||||
$societe->fetch($thirdpartyid);
|
||||
/** end add Ditto */
|
||||
|
||||
$tab = (! empty($_SESSION['poscart'])?$_SESSION['poscart']:array());
|
||||
$tab = (!empty($_SESSION['poscart']) ? $_SESSION['poscart'] : array());
|
||||
|
||||
$tab_size=count($tab);
|
||||
$tab_size = count($tab);
|
||||
if ($tab_size <= 0) print '<div class="center">'.$langs->trans("NoArticle").'</div><br>';
|
||||
else
|
||||
{
|
||||
for ($i=0;$i < $tab_size;$i++)
|
||||
for ($i = 0; $i < $tab_size; $i++)
|
||||
{
|
||||
echo ('<div class="cadre_article">'."\n");
|
||||
echo ('<p><a href="facturation_verif.php?action=suppr_article&suppr_id='.$tab[$i]['id'].'" title="'.$langs->trans("DeleteArticle").'">'.$tab[$i]['ref'].' - '.$tab[$i]['label'].'</a></p>'."\n");
|
||||
|
||||
if ( $tab[$i]['remise_percent'] > 0 ) {
|
||||
if ($tab[$i]['remise_percent'] > 0) {
|
||||
$remise_percent = ' -'.$tab[$i]['remise_percent'].'%';
|
||||
} else {
|
||||
$remise_percent = '';
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($langs) || ! is_object($langs))
|
||||
if (empty($langs) || !is_object($langs))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("main","bills","banks"));
|
||||
$langs->loadLangs(array("main", "bills", "banks"));
|
||||
|
||||
// Object $form must de defined
|
||||
|
||||
@@ -53,30 +53,30 @@ else
|
||||
{
|
||||
case 'ESP':
|
||||
echo $langs->trans("Cash");
|
||||
$filtre='courant=2';
|
||||
$filtre = 'courant=2';
|
||||
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]))
|
||||
$selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"];
|
||||
break;
|
||||
case 'CB':
|
||||
echo $langs->trans("CreditCard");
|
||||
$filtre='courant=1';
|
||||
$filtre = 'courant=1';
|
||||
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]))
|
||||
$selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CB"];
|
||||
break;
|
||||
case 'CHQ':
|
||||
echo $langs->trans("Cheque");
|
||||
$filtre='courant=1';
|
||||
$filtre = 'courant=1';
|
||||
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"]))
|
||||
$selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"];
|
||||
break;
|
||||
case 'DIF':
|
||||
echo $langs->trans("Reported");
|
||||
$filtre='courant=1 OR courant=2';
|
||||
$selected='';
|
||||
$filtre = 'courant=1 OR courant=2';
|
||||
$selected = '';
|
||||
break;
|
||||
default:
|
||||
$filtre='courant=1 OR courant=2';
|
||||
$selected='';
|
||||
$filtre = 'courant=1 OR courant=2';
|
||||
$selected = '';
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -103,7 +103,7 @@ if ( $obj_facturation->montantRendu() ) {
|
||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
|
||||
<p class="note_label">
|
||||
<?php
|
||||
echo $langs->trans("BankToPay"). "<br>";
|
||||
echo $langs->trans("BankToPay")."<br>";
|
||||
$form->select_comptes($selected, 'cashdeskbank', 0, $filtre);
|
||||
?>
|
||||
</p>
|
||||
|
||||
@@ -76,11 +76,12 @@ class Categories extends DolibarrApi
|
||||
* Return an array with category informations
|
||||
*
|
||||
* @param int $id ID of category
|
||||
* @param bool $include_childs Include child categories list (true or false)
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function get($id)
|
||||
public function get($id, $include_childs = false)
|
||||
{
|
||||
if (! DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||
throw new RestException(401);
|
||||
@@ -95,6 +96,17 @@ class Categories extends DolibarrApi
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if ($include_childs) {
|
||||
$cats = $this->category->get_filles();
|
||||
if (!is_array($cats)) {
|
||||
throw new RestException(500, 'Error when fetching child categories', array_merge(array($this->category->error), $this->category->errors));
|
||||
}
|
||||
$this->category->childs = [];
|
||||
foreach ($cats as $cat) {
|
||||
$this->category->childs[] = $this->_cleanObjectDatas($cat);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_cleanObjectDatas($this->category);
|
||||
}
|
||||
|
||||
@@ -270,6 +282,58 @@ class Categories extends DolibarrApi
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* List categories of an object
|
||||
*
|
||||
* Get the list of categories linked to an object
|
||||
*
|
||||
* @param int $id Object ID
|
||||
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact')
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order
|
||||
* @param int $limit Limit for list
|
||||
* @param int $page Page number
|
||||
* @return array Array of category objects
|
||||
*
|
||||
* @throws RestException
|
||||
*
|
||||
* @url GET /object/{type}/{id}
|
||||
*/
|
||||
public function getListForObject($id, $type, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
|
||||
{
|
||||
if (!in_array($type, [
|
||||
Categorie::TYPE_PRODUCT,
|
||||
Categorie::TYPE_CONTACT,
|
||||
Categorie::TYPE_CUSTOMER,
|
||||
Categorie::TYPE_SUPPLIER,
|
||||
Categorie::TYPE_MEMBER
|
||||
])) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
if($type == Categorie::TYPE_PRODUCT && ! (DolibarrApiAccess::$user->rights->produit->lire || DolibarrApiAccess::$user->rights->service->lire)) {
|
||||
throw new RestException(401);
|
||||
} elseif ($type == Categorie::TYPE_CONTACT && ! DolibarrApiAccess::$user->rights->contact->lire) {
|
||||
throw new RestException(401);
|
||||
} elseif ($type == Categorie::TYPE_CUSTOMER && ! DolibarrApiAccess::$user->rights->societe->lire) {
|
||||
throw new RestException(401);
|
||||
} elseif ($type == Categorie::TYPE_SUPPLIER && ! DolibarrApiAccess::$user->rights->fournisseur->lire) {
|
||||
throw new RestException(401);
|
||||
} elseif ($type == Categorie::TYPE_MEMBER && ! DolibarrApiAccess::$user->rights->adherent->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$categories = $this->category->getListForItem($id, $type, $sortfield, $sortorder, $limit, $page);
|
||||
|
||||
if( ! is_array($categories)) {
|
||||
if ($categories == 0) {
|
||||
throw new RestException(404, 'No category found for this object');
|
||||
}
|
||||
throw new RestException(500, 'Error when fetching object categories', array_merge(array($this->category->error), $this->category->errors));
|
||||
}
|
||||
return $categories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Link an object to a category by id
|
||||
*
|
||||
@@ -297,12 +361,31 @@ class Categories extends DolibarrApi
|
||||
throw new RestException(404, 'category not found');
|
||||
}
|
||||
|
||||
// TODO Add all types
|
||||
if ($type === "product") {
|
||||
if ($type === Categorie::TYPE_PRODUCT) {
|
||||
if(! (DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Product($this->db);
|
||||
} elseif ($type === Categorie::TYPE_CUSTOMER) {
|
||||
if(! DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Societe($this->db);
|
||||
} elseif ($type === Categorie::TYPE_SUPPLIER) {
|
||||
if(! DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Societe($this->db);
|
||||
} elseif ($type === Categorie::TYPE_CONTACT) {
|
||||
if(! DolibarrApiAccess::$user->rights->societe->contact->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Contact($this->db);
|
||||
} elseif ($type === Categorie::TYPE_MEMBER) {
|
||||
if(! DolibarrApiAccess::$user->rights->adherent->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Adherent($this->db);
|
||||
} else {
|
||||
throw new RestException(401, "this type is not recognized yet.");
|
||||
}
|
||||
@@ -358,12 +441,31 @@ class Categories extends DolibarrApi
|
||||
throw new RestException(404, 'category not found');
|
||||
}
|
||||
|
||||
// TODO Add all types
|
||||
if ($type === "product") {
|
||||
if ($type === Categorie::TYPE_PRODUCT) {
|
||||
if(! (DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Product($this->db);
|
||||
} elseif ($type === Categorie::TYPE_CUSTOMER) {
|
||||
if(! DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Societe($this->db);
|
||||
} elseif ($type === Categorie::TYPE_SUPPLIER) {
|
||||
if(! DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Societe($this->db);
|
||||
} elseif ($type === Categorie::TYPE_CONTACT) {
|
||||
if(! DolibarrApiAccess::$user->rights->societe->contact->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Contact($this->db);
|
||||
} elseif ($type === Categorie::TYPE_MEMBER) {
|
||||
if(! DolibarrApiAccess::$user->rights->adherent->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Adherent($this->db);
|
||||
} else {
|
||||
throw new RestException(401, "this type is not recognized yet.");
|
||||
}
|
||||
@@ -419,12 +521,31 @@ class Categories extends DolibarrApi
|
||||
throw new RestException(404, 'category not found');
|
||||
}
|
||||
|
||||
// TODO Add all types
|
||||
if ($type === "product") {
|
||||
if ($type === Categorie::TYPE_PRODUCT) {
|
||||
if(! (DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Product($this->db);
|
||||
} elseif ($type === Categorie::TYPE_CUSTOMER) {
|
||||
if(! DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Societe($this->db);
|
||||
} elseif ($type === Categorie::TYPE_SUPPLIER) {
|
||||
if(! DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Societe($this->db);
|
||||
} elseif ($type === Categorie::TYPE_CONTACT) {
|
||||
if(! DolibarrApiAccess::$user->rights->societe->contact->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Contact($this->db);
|
||||
} elseif ($type === Categorie::TYPE_MEMBER) {
|
||||
if(! DolibarrApiAccess::$user->rights->adherent->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Adherent($this->db);
|
||||
} else {
|
||||
throw new RestException(401, "this type is not recognized yet.");
|
||||
}
|
||||
@@ -478,12 +599,31 @@ class Categories extends DolibarrApi
|
||||
throw new RestException(404, 'category not found');
|
||||
}
|
||||
|
||||
// TODO Add all types
|
||||
if ($type === "product") {
|
||||
if ($type === Categorie::TYPE_PRODUCT) {
|
||||
if(! (DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Product($this->db);
|
||||
} elseif ($type === Categorie::TYPE_CUSTOMER) {
|
||||
if(! DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Societe($this->db);
|
||||
} elseif ($type === Categorie::TYPE_SUPPLIER) {
|
||||
if(! DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Societe($this->db);
|
||||
} elseif ($type === Categorie::TYPE_CONTACT) {
|
||||
if(! DolibarrApiAccess::$user->rights->societe->contact->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Contact($this->db);
|
||||
} elseif ($type === Categorie::TYPE_MEMBER) {
|
||||
if(! DolibarrApiAccess::$user->rights->adherent->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Adherent($this->db);
|
||||
} else {
|
||||
throw new RestException(401, "this type is not recognized yet.");
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ class Categorie extends CommonObject
|
||||
'member' => 'member',
|
||||
'contact' => 'socpeople',
|
||||
'user' => 'user',
|
||||
'account' => 'account', // old key for bank_account
|
||||
'account' => 'account', // old key for bank_account
|
||||
'bank_account' => 'account',
|
||||
'project' => 'project',
|
||||
'warehouse'=> 'warehouse',
|
||||
@@ -129,7 +129,7 @@ class Categorie extends CommonObject
|
||||
'member' => 'member',
|
||||
'contact' => 'contact',
|
||||
'user' => 'user',
|
||||
'account' => 'account', // old key for bank_account
|
||||
'account' => 'account', // old key for bank_account
|
||||
'bank_account'=> 'account',
|
||||
'project' => 'project',
|
||||
'warehouse'=> 'warehouse',
|
||||
@@ -248,25 +248,30 @@ class Categorie extends CommonObject
|
||||
/**
|
||||
* Load category into memory from database
|
||||
*
|
||||
* @param int $id Id of category
|
||||
* @param string $label Label of category
|
||||
* @param string $type Type of category ('product', '...') or (0, 1, ...)
|
||||
* @param int $id Id of category
|
||||
* @param string $label Label of category
|
||||
* @param string $type Type of category ('product', '...') or (0, 1, ...)
|
||||
* @param string $ref_ext External reference of object
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetch($id, $label = '', $type = null)
|
||||
public function fetch($id, $label = '', $type = null, $ref_ext = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Check parameters
|
||||
if (empty($id) && empty($label)) return -1;
|
||||
if (empty($id) && empty($label) && empty($ref_ext)) return -1;
|
||||
if (!is_numeric($type)) $type = $this->MAP_ID[$type];
|
||||
|
||||
$sql = "SELECT rowid, fk_parent, entity, label, description, color, fk_soc, visible, type";
|
||||
$sql = "SELECT rowid, fk_parent, entity, label, description, color, fk_soc, visible, type, ref_ext";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."categorie";
|
||||
if ($id > 0)
|
||||
{
|
||||
$sql .= " WHERE rowid = ".$id;
|
||||
}
|
||||
elseif (!empty($ref_ext))
|
||||
{
|
||||
$sql .= " WHERE ref_ext LIKE '".$this->db->escape($ref_ext)."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql .= " WHERE label = '".$this->db->escape($label)."' AND entity IN (".getEntity('category').")";
|
||||
@@ -290,6 +295,7 @@ class Categorie extends CommonObject
|
||||
$this->socid = $res['fk_soc'];
|
||||
$this->visible = $res['visible'];
|
||||
$this->type = $res['type'];
|
||||
$this->ref_ext = $res['ref_ext'];
|
||||
$this->entity = $res['entity'];
|
||||
|
||||
// Retreive all extrafield
|
||||
@@ -342,6 +348,7 @@ class Categorie extends CommonObject
|
||||
$this->description = trim($this->description);
|
||||
$this->color = trim($this->color);
|
||||
$this->import_key = trim($this->import_key);
|
||||
$this->ref_ext = trim($this->ref_ext);
|
||||
if (empty($this->visible)) $this->visible = 0;
|
||||
$this->fk_parent = ($this->fk_parent != "" ? intval($this->fk_parent) : 0);
|
||||
|
||||
@@ -367,6 +374,7 @@ class Categorie extends CommonObject
|
||||
$sql .= " visible,";
|
||||
$sql .= " type,";
|
||||
$sql .= " import_key,";
|
||||
$sql .= " ref_ext,";
|
||||
$sql .= " entity";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= $this->db->escape($this->fk_parent).",";
|
||||
@@ -380,6 +388,7 @@ class Categorie extends CommonObject
|
||||
$sql .= "'".$this->db->escape($this->visible)."',";
|
||||
$sql .= $this->db->escape($type).",";
|
||||
$sql .= (!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : 'null').",";
|
||||
$sql .= (!empty($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : 'null').",";
|
||||
$sql .= $this->db->escape($conf->entity);
|
||||
$sql .= ")";
|
||||
|
||||
@@ -454,6 +463,7 @@ class Categorie extends CommonObject
|
||||
// Clean parameters
|
||||
$this->label = trim($this->label);
|
||||
$this->description = trim($this->description);
|
||||
$this->ref_ext = trim($this->ref_ext);
|
||||
$this->fk_parent = ($this->fk_parent != "" ? intval($this->fk_parent) : 0);
|
||||
$this->visible = ($this->visible != "" ? intval($this->visible) : 0);
|
||||
|
||||
@@ -469,6 +479,7 @@ class Categorie extends CommonObject
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."categorie";
|
||||
$sql .= " SET label = '".$this->db->escape($this->label)."',";
|
||||
$sql .= " description = '".$this->db->escape($this->description)."',";
|
||||
$sql .= " ref_ext = '".$this->db->escape($this->ref_ext)."',";
|
||||
$sql .= " color = '".$this->db->escape($this->color)."'";
|
||||
if (!empty($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER))
|
||||
{
|
||||
@@ -861,29 +872,29 @@ class Categorie extends CommonObject
|
||||
|
||||
$sub_type = $type;
|
||||
$subcol_name = "fk_".$type;
|
||||
if ($type=="customer") {
|
||||
$sub_type="societe";
|
||||
$subcol_name="fk_soc";
|
||||
if ($type == "customer") {
|
||||
$sub_type = "societe";
|
||||
$subcol_name = "fk_soc";
|
||||
}
|
||||
if ($type=="supplier") {
|
||||
$sub_type="fournisseur";
|
||||
$subcol_name="fk_soc";
|
||||
if ($type == "supplier") {
|
||||
$sub_type = "fournisseur";
|
||||
$subcol_name = "fk_soc";
|
||||
}
|
||||
if ($type=="contact") {
|
||||
$subcol_name="fk_socpeople";
|
||||
if ($type == "contact") {
|
||||
$subcol_name = "fk_socpeople";
|
||||
}
|
||||
|
||||
$idoftype = array_search($type, self::$MAP_ID_TO_CODE);
|
||||
|
||||
$sql = "SELECT s.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as s";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."categorie_".$sub_type." as sub ";
|
||||
$sql.= ' WHERE s.entity IN ('.getEntity('category').')';
|
||||
$sql.= ' AND s.type='.$idoftype;
|
||||
$sql.= ' AND s.rowid = sub.fk_categorie';
|
||||
$sql.= ' AND sub.'.$subcol_name.' = '.$id;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."categorie as s";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."categorie_".$sub_type." as sub ";
|
||||
$sql .= ' WHERE s.entity IN ('.getEntity('category').')';
|
||||
$sql .= ' AND s.type='.$idoftype;
|
||||
$sql .= ' AND s.rowid = sub.fk_categorie';
|
||||
$sql .= ' AND sub.'.$subcol_name.' = '.$id;
|
||||
|
||||
$sql.= $this->db->order($sortfield, $sortorder);
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
|
||||
$offset = 0;
|
||||
$nbtotalofrecords = '';
|
||||
@@ -905,13 +916,13 @@ class Categorie extends CommonObject
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
$sql.= $this->db->plimit($limit + 1, $offset);
|
||||
$sql .= $this->db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$i=0;
|
||||
$i = 0;
|
||||
$num = $this->db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
while ($i < $min)
|
||||
@@ -926,6 +937,7 @@ class Categorie extends CommonObject
|
||||
$categories[$i]['description'] = $category_static->description;
|
||||
$categories[$i]['color'] = $category_static->color;
|
||||
$categories[$i]['socid'] = $category_static->socid;
|
||||
$categories[$i]['ref_ext'] = $category_static->ref_ext;
|
||||
$categories[$i]['visible'] = $category_static->visible;
|
||||
$categories[$i]['type'] = $category_static->type;
|
||||
$categories[$i]['entity'] = $category_static->entity;
|
||||
@@ -1090,6 +1102,7 @@ class Categorie extends CommonObject
|
||||
$this->cats[$obj->rowid]['description'] = !empty($obj->description_trans) ? $obj->description_trans : $obj->description;
|
||||
$this->cats[$obj->rowid]['color'] = $obj->color;
|
||||
$this->cats[$obj->rowid]['visible'] = $obj->visible;
|
||||
$this->cats[$obj->rowid]['ref_ext'] = $obj->ref_ext;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@@ -1644,8 +1657,8 @@ class Categorie extends CommonObject
|
||||
if (is_array($file['name']) && count($file['name']) > 0)
|
||||
{
|
||||
$nbfile = count($file['name']);
|
||||
for ($i = 0; $i <= $nbfile; $i ++) {
|
||||
$originImage = $dir . $file['name'][$i];
|
||||
for ($i = 0; $i <= $nbfile; $i++) {
|
||||
$originImage = $dir.$file['name'][$i];
|
||||
|
||||
// Cree fichier en taille origine
|
||||
dol_move_uploaded_file($file['tmp_name'][$i], $originImage, 1, 0, 0);
|
||||
|
||||
@@ -36,13 +36,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php';
|
||||
$langs->loadlangs(array('categories', 'bills'));
|
||||
|
||||
|
||||
$id=GETPOST('id', 'int');
|
||||
$ref=GETPOST('ref');
|
||||
$type=GETPOST('type');
|
||||
$action=GETPOST('action', 'aZ09');
|
||||
$confirm=GETPOST('confirm');
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref');
|
||||
$type = GETPOST('type');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm');
|
||||
|
||||
if (is_numeric($type)) $type=Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
|
||||
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
|
||||
|
||||
if ($id == "")
|
||||
{
|
||||
@@ -66,7 +66,7 @@ if ($id > 0)
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (isset($_FILES['userfile']) && $_FILES['userfile']['size'] > 0 && $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
if (isset($_FILES['userfile']) && $_FILES['userfile']['size'] > 0 && $_POST["sendit"] && !empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
if ($object->id) {
|
||||
$file = $_FILES['userfile'];
|
||||
@@ -74,15 +74,15 @@ if (isset($_FILES['userfile']) && $_FILES['userfile']['size'] > 0 && $_POST["sen
|
||||
{
|
||||
foreach ($file['name'] as $i => $name)
|
||||
{
|
||||
if(empty($file['tmp_name'][$i]) || intval($conf->global->MAIN_UPLOAD_DOC) * 1000 <= filesize($file['tmp_name'][$i]) )
|
||||
if (empty($file['tmp_name'][$i]) || intval($conf->global->MAIN_UPLOAD_DOC) * 1000 <= filesize($file['tmp_name'][$i]))
|
||||
{
|
||||
setEventMessage($file['name'][$i] .' : '. $langs->trans(empty($file['tmp_name'][$i])? 'ErrorFailedToSaveFile' : 'MaxSizeForUploadedFiles'));
|
||||
setEventMessage($file['name'][$i].' : '.$langs->trans(empty($file['tmp_name'][$i]) ? 'ErrorFailedToSaveFile' : 'MaxSizeForUploadedFiles'));
|
||||
unset($file['name'][$i], $file['type'][$i], $file['tmp_name'][$i], $file['error'][$i], $file['size'][$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($file['tmp_name'])) {
|
||||
if (!empty($file['tmp_name'])) {
|
||||
$object->add_photo($upload_dir, $file);
|
||||
}
|
||||
}
|
||||
@@ -110,15 +110,15 @@ $formother = new FormOther($db);
|
||||
|
||||
if ($object->id)
|
||||
{
|
||||
if ($type == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductsCategoryShort");
|
||||
elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCategoryShort");
|
||||
elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoryShort");
|
||||
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort");
|
||||
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_USER) $title=$langs->trans("UsersCategoriesShort");
|
||||
else $title=$langs->trans("Category");
|
||||
if ($type == Categorie::TYPE_PRODUCT) $title = $langs->trans("ProductsCategoryShort");
|
||||
elseif ($type == Categorie::TYPE_SUPPLIER) $title = $langs->trans("SuppliersCategoryShort");
|
||||
elseif ($type == Categorie::TYPE_CUSTOMER) $title = $langs->trans("CustomersCategoryShort");
|
||||
elseif ($type == Categorie::TYPE_MEMBER) $title = $langs->trans("MembersCategoryShort");
|
||||
elseif ($type == Categorie::TYPE_CONTACT) $title = $langs->trans("ContactCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_ACCOUNT) $title = $langs->trans("AccountsCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_PROJECT) $title = $langs->trans("ProjectsCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_USER) $title = $langs->trans("UsersCategoriesShort");
|
||||
else $title = $langs->trans("Category");
|
||||
|
||||
$head = categories_prepare_head($object, $type);
|
||||
|
||||
@@ -181,7 +181,7 @@ if ($object->id)
|
||||
|
||||
if ($action != 'ajout_photo' && $user->rights->categorie->creer)
|
||||
{
|
||||
if (! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
if (!empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
print '<a class="butAction hideonsmartphone" href="'.$_SERVER['PHP_SELF'].'?action=ajout_photo&id='.$object->id.'&type='.$type.'">';
|
||||
print $langs->trans("AddPhoto").'</a>';
|
||||
@@ -198,23 +198,23 @@ if ($object->id)
|
||||
/*
|
||||
* Ajouter une photo
|
||||
*/
|
||||
if ($action == 'ajout_photo' && $user->rights->categorie->creer && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
if ($action == 'ajout_photo' && $user->rights->categorie->creer && !empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
// Affiche formulaire upload
|
||||
$formfile=new FormFile($db);
|
||||
$formfile = new FormFile($db);
|
||||
$formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?id='.$object->id.'&type='.$type, $langs->trans("AddPhoto"), 1, '', $user->rights->categorie->creer, 50, $object, '', false, '', 0);
|
||||
}
|
||||
|
||||
// Affiche photos
|
||||
if ($action != 'ajout_photo')
|
||||
{
|
||||
$nbphoto=0;
|
||||
$nbbyrow=5;
|
||||
$nbphoto = 0;
|
||||
$nbbyrow = 5;
|
||||
|
||||
$maxWidth = 160;
|
||||
$maxHeight = 120;
|
||||
|
||||
$pdir = get_exdir($object->id, 2, 0, 0, $object, 'category') . $object->id ."/photos/";
|
||||
$pdir = get_exdir($object->id, 2, 0, 0, $object, 'category').$object->id."/photos/";
|
||||
$dir = $upload_dir.'/'.$pdir;
|
||||
|
||||
$listofphoto = $object->liste_photos($dir);
|
||||
@@ -229,22 +229,22 @@ if ($object->id)
|
||||
$nbphoto++;
|
||||
|
||||
if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print '<tr align=center valign=middle border=1>';
|
||||
if ($nbbyrow) print '<td width="'.ceil(100/$nbbyrow).'%" class="photo">';
|
||||
if ($nbbyrow) print '<td width="'.ceil(100 / $nbbyrow).'%" class="photo">';
|
||||
|
||||
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$obj['photo']).'" alt="Taille origine" target="_blank">';
|
||||
|
||||
// Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine
|
||||
if ($obj['photo_vignette'])
|
||||
{
|
||||
$filename=$obj['photo_vignette'];
|
||||
$filename = $obj['photo_vignette'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$filename=$obj['photo'];
|
||||
$filename = $obj['photo'];
|
||||
}
|
||||
|
||||
// Nom affiche
|
||||
$viewfilename=$obj['photo'];
|
||||
$viewfilename = $obj['photo'];
|
||||
|
||||
// Taille de l'image
|
||||
$object->get_image_size($dir.$filename);
|
||||
@@ -274,7 +274,7 @@ if ($object->id)
|
||||
// Ferme tableau
|
||||
while ($nbphoto % $nbbyrow)
|
||||
{
|
||||
print '<td width="'.ceil(100/$nbbyrow).'%"> </td>';
|
||||
print '<td width="'.ceil(100 / $nbbyrow).'%"> </td>';
|
||||
$nbphoto++;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -476,7 +476,7 @@ if ($object->id > 0)
|
||||
print '</td><td>';
|
||||
if ($action == 'editshipping')
|
||||
{
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->shipping_method_id, 'shipping_method_id');
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ class FormAdvTargetEmailing extends Form
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error='';
|
||||
public $error = '';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -62,15 +62,15 @@ class FormAdvTargetEmailing extends Form
|
||||
$options_array = array();
|
||||
|
||||
$sql = "SELECT code, label";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "c_prospectlevel";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_prospectlevel";
|
||||
$sql .= " WHERE active > 0";
|
||||
$sql .= " ORDER BY sortorder";
|
||||
dol_syslog(get_class($this) . '::multiselectProspectionStatus sql=' . $sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this).'::multiselectProspectionStatus sql='.$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ( $i < $num ) {
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$level = $langs->trans($obj->code);
|
||||
@@ -78,7 +78,7 @@ class FormAdvTargetEmailing extends Form
|
||||
$level = $langs->trans($obj->label);
|
||||
$options_array[$obj->code] = $level;
|
||||
|
||||
$i ++;
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
@@ -102,16 +102,16 @@ class FormAdvTargetEmailing extends Form
|
||||
|
||||
$out = '';
|
||||
$countryArray = array();
|
||||
$label = array ();
|
||||
$label = array();
|
||||
|
||||
$options_array = array();
|
||||
|
||||
$sql = "SELECT rowid, code as code_iso, label";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "c_country";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_country";
|
||||
$sql .= " WHERE active = 1 AND code<>''";
|
||||
$sql .= " ORDER BY code ASC";
|
||||
|
||||
dol_syslog(get_class($this) . "::select_country sql=" . $sql);
|
||||
dol_syslog(get_class($this)."::select_country sql=".$sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
@@ -123,9 +123,9 @@ class FormAdvTargetEmailing extends Form
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$countryArray [$i] ['rowid'] = $obj->rowid;
|
||||
$countryArray [$i] ['code_iso'] = $obj->code_iso;
|
||||
$countryArray [$i] ['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country" . $obj->code_iso) != "Country" . $obj->code_iso ? $langs->transnoentitiesnoconv("Country" . $obj->code_iso) : ($obj->label != '-' ? $obj->label : ''));
|
||||
$countryArray [$i] ['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso) != "Country".$obj->code_iso ? $langs->transnoentitiesnoconv("Country".$obj->code_iso) : ($obj->label != '-' ? $obj->label : ''));
|
||||
$label[$i] = $countryArray[$i]['label'];
|
||||
$i ++;
|
||||
$i++;
|
||||
}
|
||||
|
||||
array_multisort($label, SORT_ASC, $countryArray);
|
||||
@@ -133,7 +133,7 @@ class FormAdvTargetEmailing extends Form
|
||||
foreach ($countryArray as $row) {
|
||||
$label = dol_trunc($row['label'], $maxlength, 'middle');
|
||||
if ($row['code_iso'])
|
||||
$label .= ' (' . $row['code_iso'] . ')';
|
||||
$label .= ' ('.$row['code_iso'].')';
|
||||
|
||||
$options_array[$row['rowid']] = $label;
|
||||
}
|
||||
@@ -158,23 +158,23 @@ class FormAdvTargetEmailing extends Form
|
||||
|
||||
global $conf;
|
||||
|
||||
$options_array = array ();
|
||||
$options_array = array();
|
||||
|
||||
$sql_usr = '';
|
||||
$sql_usr = '';
|
||||
$sql_usr .= "SELECT DISTINCT u2.rowid, u2.lastname as name, u2.firstname, u2.login";
|
||||
$sql_usr .= " FROM " . MAIN_DB_PREFIX . "user as u2, " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
|
||||
$sql_usr .= " WHERE u2.entity IN (0," . $conf->entity . ")";
|
||||
$sql_usr .= " FROM ".MAIN_DB_PREFIX."user as u2, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql_usr .= " WHERE u2.entity IN (0,".$conf->entity.")";
|
||||
$sql_usr .= " AND u2.rowid = sc.fk_user ";
|
||||
|
||||
if (! empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX))
|
||||
if (!empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX))
|
||||
$sql_usr .= " AND u2.statut<>0 ";
|
||||
$sql_usr .= " ORDER BY name ASC";
|
||||
// print $sql_usr;exit;
|
||||
|
||||
$resql_usr = $this->db->query($sql_usr);
|
||||
if ($resql_usr) {
|
||||
while ( $obj_usr = $this->db->fetch_object($resql_usr) ) {
|
||||
$label = $obj_usr->firstname . " " . $obj_usr->name . " (" . $obj_usr->login . ')';
|
||||
while ($obj_usr = $this->db->fetch_object($resql_usr)) {
|
||||
$label = $obj_usr->firstname." ".$obj_usr->name." (".$obj_usr->login.')';
|
||||
|
||||
$options_array [$obj_usr->rowid] = $label;
|
||||
}
|
||||
@@ -196,11 +196,11 @@ class FormAdvTargetEmailing extends Form
|
||||
public function multiselectselectLanguage($htmlname = '', $selected_array = array())
|
||||
{
|
||||
|
||||
global $conf,$langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$options_array = array ();
|
||||
$options_array = array();
|
||||
|
||||
$langs_available=$langs->get_available_languages(DOL_DOCUMENT_ROOT, 12);
|
||||
$langs_available = $langs->get_available_languages(DOL_DOCUMENT_ROOT, 12);
|
||||
|
||||
foreach ($langs_available as $key => $value)
|
||||
{
|
||||
@@ -222,7 +222,7 @@ class FormAdvTargetEmailing extends Form
|
||||
*/
|
||||
public function advMultiselectarraySelllist($htmlname, $sqlqueryparam = array(), $selected_array = array())
|
||||
{
|
||||
$options_array=array();
|
||||
$options_array = array();
|
||||
|
||||
if (is_array($sqlqueryparam))
|
||||
{
|
||||
@@ -238,39 +238,39 @@ class FormAdvTargetEmailing extends Form
|
||||
|
||||
if (count($InfoFieldList) >= 3) {
|
||||
if (strpos($InfoFieldList [3], 'extra.') !== false) {
|
||||
$keyList = 'main.' . $InfoFieldList [2] . ' as rowid';
|
||||
$keyList = 'main.'.$InfoFieldList [2].' as rowid';
|
||||
} else {
|
||||
$keyList = $InfoFieldList [2] . ' as rowid';
|
||||
$keyList = $InfoFieldList [2].' as rowid';
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'SELECT ' . $keyList . ', ' . $InfoFieldList [1];
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList [0];
|
||||
if (! empty($InfoFieldList [3])) {
|
||||
$sql = 'SELECT '.$keyList.', '.$InfoFieldList [1];
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList [0];
|
||||
if (!empty($InfoFieldList [3])) {
|
||||
// We have to join on extrafield table
|
||||
if (strpos($InfoFieldList [3], 'extra') !== false) {
|
||||
$sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList [0] . '_extrafields as extra';
|
||||
$sql .= ' WHERE extra.fk_object=main.' . $InfoFieldList [2] . ' AND ' . $InfoFieldList [3];
|
||||
$sql .= ' as main, '.MAIN_DB_PREFIX.$InfoFieldList [0].'_extrafields as extra';
|
||||
$sql .= ' WHERE extra.fk_object=main.'.$InfoFieldList [2].' AND '.$InfoFieldList [3];
|
||||
} else {
|
||||
$sql .= ' WHERE ' . $InfoFieldList [3];
|
||||
$sql .= ' WHERE '.$InfoFieldList [3];
|
||||
}
|
||||
}
|
||||
if (! empty($InfoFieldList[1])) {
|
||||
if (!empty($InfoFieldList[1])) {
|
||||
$sql .= " ORDER BY nom";
|
||||
}
|
||||
// $sql.= ' WHERE entity = '.$conf->entity;
|
||||
|
||||
dol_syslog(get_class($this) . "::".__METHOD__, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ( $i < $num ) {
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$labeltoshow = dol_trunc($obj->$InfoFieldList [1], 90);
|
||||
$options_array[$obj->rowid]=$labeltoshow;
|
||||
$i ++;
|
||||
$options_array[$obj->rowid] = $labeltoshow;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$this->db->free($resql);
|
||||
@@ -289,17 +289,17 @@ class FormAdvTargetEmailing extends Form
|
||||
*/
|
||||
public function multiselectCivility($htmlname = 'civilite_id', $selected_array = array())
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
global $conf, $langs, $user;
|
||||
$langs->load("dict");
|
||||
|
||||
$options_array=array();
|
||||
$options_array = array();
|
||||
|
||||
|
||||
$sql = "SELECT rowid, code, label as civilite, active FROM ".MAIN_DB_PREFIX."c_civility";
|
||||
$sql.= " WHERE active = 1";
|
||||
$sql .= " WHERE active = 1";
|
||||
|
||||
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
@@ -310,10 +310,10 @@ class FormAdvTargetEmailing extends Form
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
|
||||
$label= ($langs->trans("Civility".$obj->code)!="Civility".$obj->code ? $langs->trans("Civility".$obj->code) : ($obj->civilite!='-'?$obj->civilite:''));
|
||||
$label = ($langs->trans("Civility".$obj->code) != "Civility".$obj->code ? $langs->trans("Civility".$obj->code) : ($obj->civilite != '-' ? $obj->civilite : ''));
|
||||
|
||||
|
||||
$options_array[$obj->code]=$label;
|
||||
$options_array[$obj->code] = $label;
|
||||
|
||||
$i++;
|
||||
}
|
||||
@@ -340,7 +340,7 @@ class FormAdvTargetEmailing extends Form
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$form=new Form($this->db);
|
||||
$form = new Form($this->db);
|
||||
$return = $form->multiselectarray($htmlname, $options_array, $selected_array, 0, 0, '', 0, 295);
|
||||
return $return;
|
||||
}
|
||||
@@ -379,16 +379,16 @@ class FormAdvTargetEmailing extends Form
|
||||
*/
|
||||
public function multiselectCategories($htmlname = '', $selected_array = array(), $type = 0)
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
global $conf, $langs, $user;
|
||||
$langs->load("dict");
|
||||
|
||||
$options_array=array();
|
||||
$options_array = array();
|
||||
|
||||
$sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."categorie";
|
||||
$sql.= " WHERE type=".$type;
|
||||
$sql .= " WHERE type=".$type;
|
||||
|
||||
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
@@ -399,7 +399,7 @@ class FormAdvTargetEmailing extends Form
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$options_array[$obj->rowid]=$obj->label;
|
||||
$options_array[$obj->rowid] = $obj->label;
|
||||
|
||||
$i++;
|
||||
}
|
||||
@@ -429,32 +429,32 @@ class FormAdvTargetEmailing extends Form
|
||||
$out = '';
|
||||
|
||||
$sql = "SELECT c.rowid, c.name, c.fk_element";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "advtargetemailing as c";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."advtargetemailing as c";
|
||||
$sql .= " WHERE type_element='$type_element'";
|
||||
$sql .= " ORDER BY c.name";
|
||||
|
||||
dol_syslog(get_class($this) . "::".__METHOD__, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">';
|
||||
$out .= '<select id="'.$htmlname.'" class="flat" name="'.$htmlname.'">';
|
||||
if ($showempty)
|
||||
$out .= '<option value=""></option>';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ( $i < $num ) {
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$label = $obj->name;
|
||||
if (empty($label)) {
|
||||
$label=$obj->fk_element;
|
||||
$label = $obj->fk_element;
|
||||
}
|
||||
|
||||
if ($selected > 0 && $selected == $obj->rowid) {
|
||||
$out .= '<option value="' . $obj->rowid . '" selected="selected">' . $label . '</option>';
|
||||
$out .= '<option value="'.$obj->rowid.'" selected="selected">'.$label.'</option>';
|
||||
} else {
|
||||
$out .= '<option value="' . $obj->rowid . '">' . $label . '</option>';
|
||||
$out .= '<option value="'.$obj->rowid.'">'.$label.'</option>';
|
||||
}
|
||||
$i ++;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$out .= '</select>';
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -63,18 +63,18 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$datev=dol_mktime(12, 0, 0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]);
|
||||
$datep=dol_mktime(12, 0, 0, $_POST["datepmonth"], $_POST["datepday"], $_POST["datepyear"]);
|
||||
$datev = dol_mktime(12, 0, 0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]);
|
||||
$datep = dol_mktime(12, 0, 0, $_POST["datepmonth"], $_POST["datepday"], $_POST["datepyear"]);
|
||||
|
||||
$object->accountid=GETPOST("accountid");
|
||||
$object->paymenttype=GETPOST("paiementtype");
|
||||
$object->datev=$datev;
|
||||
$object->datep=$datep;
|
||||
$object->amount=price2num(GETPOST("amount"));
|
||||
$object->label=GETPOST("label");
|
||||
$object->ltt=$lttype;
|
||||
$object->accountid = GETPOST("accountid");
|
||||
$object->paymenttype = GETPOST("paiementtype");
|
||||
$object->datev = $datev;
|
||||
$object->datep = $datep;
|
||||
$object->amount = price2num(GETPOST("amount"));
|
||||
$object->label = GETPOST("label");
|
||||
$object->ltt = $lttype;
|
||||
|
||||
$ret=$object->addPayment($user);
|
||||
$ret = $object->addPayment($user);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$db->commit();
|
||||
@@ -85,27 +85,27 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
|
||||
{
|
||||
$db->rollback();
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$_GET["action"]="create";
|
||||
$_GET["action"] = "create";
|
||||
}
|
||||
}
|
||||
|
||||
//delete payment of localtax
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$result=$object->fetch($id);
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($object->rappro == 0)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$ret=$object->delete($user);
|
||||
$ret = $object->delete($user);
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($object->fk_bank)
|
||||
{
|
||||
$accountline=new AccountLine($db);
|
||||
$result=$accountline->fetch($object->fk_bank);
|
||||
if ($result > 0) $result=$accountline->delete($user); // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing)
|
||||
$accountline = new AccountLine($db);
|
||||
$result = $accountline->fetch($object->fk_bank);
|
||||
if ($result > 0) $result = $accountline->delete($user); // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing)
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
@@ -116,7 +116,7 @@ if ($action == 'delete')
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->error=$accountline->error;
|
||||
$object->error = $accountline->error;
|
||||
$db->rollback();
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
@@ -129,7 +129,7 @@ if ($action == 'delete')
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='Error try do delete a line linked to a conciliated bank transaction';
|
||||
$mesg = 'Error try do delete a line linked to a conciliated bank transaction';
|
||||
setEventMessages($mesg, null, 'errors');
|
||||
}
|
||||
}
|
||||
@@ -151,13 +151,13 @@ if ($id)
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$title=$langs->trans("LT".$object->ltt) . " - " . $langs->trans("Card");
|
||||
$help_url='';
|
||||
$title = $langs->trans("LT".$object->ltt)." - ".$langs->trans("Card");
|
||||
$help_url = '';
|
||||
llxHeader("", $title, $helpurl);
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print load_fiche_titre($langs->transcountry($lttype==2?"newLT2Payment":"newLT1Payment", $mysoc->country_code));
|
||||
print load_fiche_titre($langs->transcountry($lttype == 2 ? "newLT2Payment" : "newLT1Payment", $mysoc->country_code));
|
||||
|
||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" name="formlocaltax" method="post">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@@ -178,15 +178,15 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" class="minwidth200" value="'.($_POST["label"]?GETPOST("label", '', 2):$langs->transcountry(($lttype==2?"LT2Payment":"LT1Payment"), $mysoc->country_code)).'"></td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" class="minwidth200" value="'.($_POST["label"] ?GETPOST("label", '', 2) : $langs->transcountry(($lttype == 2 ? "LT2Payment" : "LT1Payment"), $mysoc->country_code)).'"></td></tr>';
|
||||
|
||||
// Amount
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input name="amount" size="10" value="'.GETPOST("amount").'"></td></tr>';
|
||||
|
||||
if (! empty($conf->banque->enabled))
|
||||
if (!empty($conf->banque->enabled))
|
||||
{
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Account").'</td><td>';
|
||||
$form->select_comptes($_POST["accountid"], "accountid", 0, "courant=1", 1); // Affiche liste des comptes courant
|
||||
$form->select_comptes($_POST["accountid"], "accountid", 0, "courant=1", 1); // Affiche liste des comptes courant
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
|
||||
@@ -200,8 +200,8 @@ if ($action == 'create')
|
||||
print '<td><input name="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
|
||||
}
|
||||
// Other attributes
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</table>';
|
||||
@@ -254,11 +254,11 @@ if ($id)
|
||||
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
|
||||
|
||||
if (! empty($conf->banque->enabled))
|
||||
if (!empty($conf->banque->enabled))
|
||||
{
|
||||
if ($object->fk_account > 0)
|
||||
{
|
||||
$bankline=new AccountLine($db);
|
||||
$bankline = new AccountLine($db);
|
||||
$bankline->fetch($object->fk_bank);
|
||||
|
||||
print '<tr>';
|
||||
@@ -271,8 +271,8 @@ if ($id)
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</table>';
|
||||
|
||||
@@ -46,9 +46,9 @@ if ($user->socid > 0)
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm=='yes'))
|
||||
if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'yes'))
|
||||
{
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
if ($_POST["cancel"])
|
||||
{
|
||||
@@ -59,7 +59,7 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm=='yes
|
||||
|
||||
$datepaye = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
||||
|
||||
if (! $_POST["paiementtype"] > 0)
|
||||
if (!$_POST["paiementtype"] > 0)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode")), null, 'errors');
|
||||
$error++;
|
||||
@@ -71,14 +71,14 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm=='yes
|
||||
$error++;
|
||||
$action = 'create';
|
||||
}
|
||||
if (! empty($conf->banque->enabled) && ! ($_POST["accountid"] > 0))
|
||||
if (!empty($conf->banque->enabled) && !($_POST["accountid"] > 0))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountToCredit")), null, 'errors');
|
||||
$error++;
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$paymentid = 0;
|
||||
|
||||
@@ -96,10 +96,10 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm=='yes
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorNoPaymentDefined"), null, 'errors');
|
||||
$action='create';
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
@@ -107,34 +107,34 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm=='yes
|
||||
$paiement = new PaymentSocialContribution($db);
|
||||
$paiement->chid = $chid;
|
||||
$paiement->datepaye = $datepaye;
|
||||
$paiement->amounts = $amounts; // Tableau de montant
|
||||
$paiement->amounts = $amounts; // Tableau de montant
|
||||
$paiement->paiementtype = $_POST["paiementtype"];
|
||||
$paiement->num_paiement = $_POST["num_paiement"];
|
||||
$paiement->note = $_POST["note"];
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$paymentid = $paiement->create($user, (GETPOST('closepaidcontrib')=='on'?1:0));
|
||||
$paymentid = $paiement->create($user, (GETPOST('closepaidcontrib') == 'on' ? 1 : 0));
|
||||
if ($paymentid < 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($paiement->error, null, 'errors');
|
||||
$action='create';
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$result=$paiement->addPaymentToBank($user, 'payment_sc', '(SocialContributionPayment)', GETPOST('accountid', 'int'), '', '');
|
||||
if (! ($result > 0))
|
||||
$result = $paiement->addPaymentToBank($user, 'payment_sc', '(SocialContributionPayment)', GETPOST('accountid', 'int'), '', '');
|
||||
if (!($result > 0))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($paiement->error, null, 'errors');
|
||||
$action='create';
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
$loc = DOL_URL_ROOT.'/compta/sociales/card.php?id='.$chid;
|
||||
@@ -156,7 +156,7 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm=='yes
|
||||
|
||||
llxHeader();
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
|
||||
// Formulaire de creation d'un paiement de charge
|
||||
@@ -209,12 +209,12 @@ if ($action == 'create')
|
||||
print '<tr><td>'.$langs->trans("Amount")."</td><td>".price($charge->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';*/
|
||||
|
||||
$sql = "SELECT sum(p.amount) as total";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
|
||||
$sql.= " WHERE p.fk_charge = ".$chid;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
|
||||
$sql .= " WHERE p.fk_charge = ".$chid;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj=$db->fetch_object($resql);
|
||||
$obj = $db->fetch_object($resql);
|
||||
$sumpaid = $obj->total;
|
||||
$db->free();
|
||||
}
|
||||
@@ -223,20 +223,20 @@ if ($action == 'create')
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
|
||||
$datepaye = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
||||
$datepayment=empty($conf->global->MAIN_AUTOFILL_DATE)?(empty($_POST["remonth"])?-1:$datepaye):0;
|
||||
$datepayment = empty($conf->global->MAIN_AUTOFILL_DATE) ? (empty($_POST["remonth"]) ?-1 : $datepaye) : 0;
|
||||
print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1);
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
|
||||
$form->select_types_paiements(isset($_POST["paiementtype"])?$_POST["paiementtype"]:$charge->paiementtype, "paiementtype");
|
||||
$form->select_types_paiements(isset($_POST["paiementtype"]) ? $_POST["paiementtype"] : $charge->paiementtype, "paiementtype");
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">'.$langs->trans('AccountToDebit').'</td>';
|
||||
print '<td>';
|
||||
$form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$charge->accountid, "accountid", 0, '', 1); // Show opend bank account list
|
||||
$form->select_comptes(isset($_POST["accountid"]) ? $_POST["accountid"] : $charge->accountid, "accountid", 0, '', 1); // Show opend bank account list
|
||||
print '</td></tr>';
|
||||
|
||||
// Number
|
||||
@@ -270,8 +270,8 @@ if ($action == 'create')
|
||||
print '<td align="center">'.$langs->trans("Amount").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$total=0;
|
||||
$totalrecu=0;
|
||||
$total = 0;
|
||||
$totalrecu = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
@@ -301,7 +301,7 @@ if ($action == 'create')
|
||||
$nameRemain = "remain_".$objp->id;
|
||||
if (!empty($conf->use_javascript_ajax))
|
||||
print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmount' data-rowid='".$namef."' data-value='".($objp->amount - $sumpaid)."'");
|
||||
$remaintopay=$objp->amount - $sumpaid;
|
||||
$remaintopay = $objp->amount - $sumpaid;
|
||||
print '<input type=hidden class="sum_remain" name="'.$nameRemain.'" value="'.$remaintopay.'">';
|
||||
print '<input type="text" size="8" name="'.$namef.'" id="'.$namef.'">';
|
||||
}
|
||||
@@ -312,9 +312,9 @@ if ($action == 'create')
|
||||
print "</td>";
|
||||
|
||||
print "</tr>\n";
|
||||
$total+=$objp->total;
|
||||
$total_ttc+=$objp->total_ttc;
|
||||
$totalrecu+=$objp->am;
|
||||
$total += $objp->total;
|
||||
$total_ttc += $objp->total_ttc;
|
||||
$totalrecu += $objp->am;
|
||||
$i++;
|
||||
}
|
||||
if ($i > 1)
|
||||
|
||||
@@ -101,14 +101,14 @@ if ($result)
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
$urladd= "&statut=".$statut;
|
||||
$urladd = "&statut=".$statut;
|
||||
|
||||
$selectedfields='';
|
||||
$selectedfields = '';
|
||||
|
||||
$newcardbutton='';
|
||||
$newcardbutton = '';
|
||||
if ($user->rights->prelevement->bons->creer)
|
||||
{
|
||||
$newcardbutton.= dolGetButtonTitle($langs->trans('NewStandingOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/prelevement/create.php');
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewStandingOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/prelevement/create.php');
|
||||
}
|
||||
|
||||
// Lines of title fields
|
||||
@@ -124,18 +124,18 @@ if ($result)
|
||||
|
||||
print_barre_liste($langs->trans("WithdrawalsReceipts"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit);
|
||||
|
||||
$moreforfilter='';
|
||||
$moreforfilter = '';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_ref" value="'. dol_escape_htmltag($search_ref).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre right"><input type="text" class="flat maxwidth100" name="search_amount" value="'. dol_escape_htmltag($search_amount).'"></td>';
|
||||
print '<td class="liste_titre right"><input type="text" class="flat maxwidth100" name="search_amount" value="'.dol_escape_htmltag($search_amount).'"></td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@@ -46,8 +46,8 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined,
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="p.datec";
|
||||
if (!$sortorder) $sortorder = "DESC";
|
||||
if (!$sortfield) $sortfield = "p.datec";
|
||||
|
||||
$search_line = GETPOST('search_line', 'alpha');
|
||||
$search_bon = GETPOST('search_bon', 'alpha');
|
||||
@@ -55,8 +55,8 @@ $search_code = GETPOST('search_code', 'alpha');
|
||||
$search_company = GETPOST('search_company', 'alpha');
|
||||
$statut = GETPOST('statut', 'int');
|
||||
|
||||
$bon=new BonPrelevement($db, "");
|
||||
$ligne=new LignePrelevement($db, $user);
|
||||
$bon = new BonPrelevement($db, "");
|
||||
$ligne = new LignePrelevement($db, $user);
|
||||
|
||||
|
||||
/*
|
||||
@@ -65,11 +65,11 @@ $ligne=new LignePrelevement($db, $user);
|
||||
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_line="";
|
||||
$search_bon="";
|
||||
$search_code="";
|
||||
$search_company="";
|
||||
$statut="";
|
||||
$search_line = "";
|
||||
$search_bon = "";
|
||||
$search_code = "";
|
||||
$search_company = "";
|
||||
$statut = "";
|
||||
}
|
||||
|
||||
|
||||
@@ -77,31 +77,31 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('', $langs->trans("WithdrawalsLines"));
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.statut, p.datec";
|
||||
$sql.= " ,f.rowid as facid, f.ref, f.total_ttc";
|
||||
$sql.= " , s.rowid as socid, s.nom as name, s.code_client";
|
||||
$sql.= " , pl.amount, pl.statut as statut_ligne, pl.rowid as rowid_ligne";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= " WHERE pl.fk_prelevement_bons = p.rowid";
|
||||
$sql.= " AND pf.fk_prelevement_lignes = pl.rowid";
|
||||
$sql.= " AND pf.fk_facture = f.rowid";
|
||||
$sql.= " AND f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.entity IN (".getEntity('invoice').")";
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
if ($search_line) $sql.= " AND pl.rowid = '".$db->escape($search_line)."'";
|
||||
if ($search_bon) $sql.= natural_search("p.ref", $search_bon);
|
||||
if ($search_code) $sql.= natural_search("s.code_client", $search_code);
|
||||
if ($search_company) $sql.= natural_search("s.nom", $search_company);
|
||||
$sql .= " ,f.rowid as facid, f.ref, f.total_ttc";
|
||||
$sql .= " , s.rowid as socid, s.nom as name, s.code_client";
|
||||
$sql .= " , pl.amount, pl.statut as statut_ligne, pl.rowid as rowid_ligne";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " WHERE pl.fk_prelevement_bons = p.rowid";
|
||||
$sql .= " AND pf.fk_prelevement_lignes = pl.rowid";
|
||||
$sql .= " AND pf.fk_facture = f.rowid";
|
||||
$sql .= " AND f.fk_soc = s.rowid";
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
||||
if ($socid) $sql .= " AND s.rowid = ".$socid;
|
||||
if ($search_line) $sql .= " AND pl.rowid = '".$db->escape($search_line)."'";
|
||||
if ($search_bon) $sql .= natural_search("p.ref", $search_bon);
|
||||
if ($search_code) $sql .= natural_search("s.code_client", $search_code);
|
||||
if ($search_company) $sql .= natural_search("s.nom", $search_company);
|
||||
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
@@ -116,7 +116,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
}
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
@@ -126,28 +126,28 @@ if ($result)
|
||||
|
||||
$urladd = "&statut=".$statut;
|
||||
$urladd .= "&search_bon=".$search_bon;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $urladd.='&limit='.urlencode($limit);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $urladd .= '&limit='.urlencode($limit);
|
||||
|
||||
print"\n<!-- debut table -->\n";
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">';
|
||||
|
||||
print_barre_liste($langs->trans("WithdrawalsLines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, '', '', $limit);
|
||||
|
||||
$moreforfilter='';
|
||||
$moreforfilter = '';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_line" value="'. dol_escape_htmltag($search_line).'" size="6"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_bon" value="'. dol_escape_htmltag($search_bon).'" size="6"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_line" value="'.dol_escape_htmltag($search_line).'" size="6"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_bon" value="'.dol_escape_htmltag($search_bon).'" size="6"></td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_company" value="'. dol_escape_htmltag($search_company).'" size="6"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="search_code" value="'. dol_escape_htmltag($search_code).'" size="6"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_company" value="'.dol_escape_htmltag($search_company).'" size="6"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="search_code" value="'.dol_escape_htmltag($search_code).'" size="6"></td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@@ -34,12 +34,12 @@ class PaymentSocialContribution extends CommonObject
|
||||
/**
|
||||
* @var string ID to identify managed object
|
||||
*/
|
||||
public $element='paiementcharge';
|
||||
public $element = 'paiementcharge';
|
||||
|
||||
/**
|
||||
* @var string Name of table without prefix where object is stored
|
||||
*/
|
||||
public $table_element='paiementcharge';
|
||||
public $table_element = 'paiementcharge';
|
||||
|
||||
/**
|
||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||
@@ -51,9 +51,9 @@ class PaymentSocialContribution extends CommonObject
|
||||
*/
|
||||
public $fk_charge;
|
||||
|
||||
public $datec='';
|
||||
public $tms='';
|
||||
public $datep='';
|
||||
public $datec = '';
|
||||
public $tms = '';
|
||||
public $datep = '';
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
@@ -61,8 +61,8 @@ class PaymentSocialContribution extends CommonObject
|
||||
*/
|
||||
public $total;
|
||||
|
||||
public $amount; // Total amount of payment
|
||||
public $amounts=array(); // Array of amounts
|
||||
public $amount; // Total amount of payment
|
||||
public $amounts = array(); // Array of amounts
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
@@ -108,28 +108,28 @@ class PaymentSocialContribution extends CommonObject
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
$now=dol_now();
|
||||
$now = dol_now();
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
|
||||
// Validate parametres
|
||||
if (! $this->datepaye)
|
||||
if (!$this->datepaye)
|
||||
{
|
||||
$this->error='ErrorBadValueForParameterCreatePaymentSocialContrib';
|
||||
$this->error = 'ErrorBadValueForParameterCreatePaymentSocialContrib';
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Clean parameters
|
||||
if (isset($this->fk_charge)) $this->fk_charge= (int) $this->fk_charge;
|
||||
if (isset($this->amount)) $this->amount=trim($this->amount);
|
||||
if (isset($this->fk_typepaiement)) $this->fk_typepaiement= (int) $this->fk_typepaiement;
|
||||
if (isset($this->num_paiement)) $this->num_paiement=trim($this->num_paiement);
|
||||
if (isset($this->note)) $this->note=trim($this->note);
|
||||
if (isset($this->fk_bank)) $this->fk_bank= (int) $this->fk_bank;
|
||||
if (isset($this->fk_user_creat)) $this->fk_user_creat= (int) $this->fk_user_creat;
|
||||
if (isset($this->fk_user_modif)) $this->fk_user_modif= (int) $this->fk_user_modif;
|
||||
if (isset($this->fk_charge)) $this->fk_charge = (int) $this->fk_charge;
|
||||
if (isset($this->amount)) $this->amount = trim($this->amount);
|
||||
if (isset($this->fk_typepaiement)) $this->fk_typepaiement = (int) $this->fk_typepaiement;
|
||||
if (isset($this->num_paiement)) $this->num_paiement = trim($this->num_paiement);
|
||||
if (isset($this->note)) $this->note = trim($this->note);
|
||||
if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank;
|
||||
if (isset($this->fk_user_creat)) $this->fk_user_creat = (int) $this->fk_user_creat;
|
||||
if (isset($this->fk_user_modif)) $this->fk_user_modif = (int) $this->fk_user_modif;
|
||||
|
||||
$totalamount = 0;
|
||||
foreach ($this->amounts as $key => $value) // How payment is dispatch
|
||||
@@ -149,14 +149,14 @@ class PaymentSocialContribution extends CommonObject
|
||||
if ($totalamount != 0)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."paiementcharge (fk_charge, datec, datep, amount,";
|
||||
$sql.= " fk_typepaiement, num_paiement, note, fk_user_creat, fk_bank)";
|
||||
$sql.= " VALUES ($this->chid, '".$this->db->idate($now)."',";
|
||||
$sql.= " '".$this->db->idate($this->datepaye)."',";
|
||||
$sql.= " ".$totalamount.",";
|
||||
$sql.= " ".$this->paiementtype.", '".$this->db->escape($this->num_paiement)."', '".$this->db->escape($this->note)."', ".$user->id.",";
|
||||
$sql.= " 0)";
|
||||
$sql .= " fk_typepaiement, num_paiement, note, fk_user_creat, fk_bank)";
|
||||
$sql .= " VALUES ($this->chid, '".$this->db->idate($now)."',";
|
||||
$sql .= " '".$this->db->idate($this->datepaye)."',";
|
||||
$sql .= " ".$totalamount.",";
|
||||
$sql .= " ".$this->paiementtype.", '".$this->db->escape($this->num_paiement)."', '".$this->db->escape($this->note)."', ".$user->id.",";
|
||||
$sql .= " 0)";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."paiementcharge");
|
||||
@@ -172,18 +172,18 @@ class PaymentSocialContribution extends CommonObject
|
||||
// If we want to closed payed invoices
|
||||
if ($closepaidcontrib)
|
||||
{
|
||||
$contrib=new ChargeSociales($this->db);
|
||||
$contrib = new ChargeSociales($this->db);
|
||||
$contrib->fetch($contribid);
|
||||
$paiement = $contrib->getSommePaiement();
|
||||
//$creditnotes=$contrib->getSumCreditNotesUsed();
|
||||
$creditnotes=0;
|
||||
$creditnotes = 0;
|
||||
//$deposits=$contrib->getSumDepositsUsed();
|
||||
$deposits=0;
|
||||
$alreadypayed=price2num($paiement + $creditnotes + $deposits, 'MT');
|
||||
$remaintopay=price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT');
|
||||
$deposits = 0;
|
||||
$alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT');
|
||||
$remaintopay = price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT');
|
||||
if ($remaintopay == 0)
|
||||
{
|
||||
$result=$contrib->set_paid($user);
|
||||
$result = $contrib->set_paid($user);
|
||||
}
|
||||
else dol_syslog("Remain to pay for conrib ".$contribid." not null. We do nothing.");
|
||||
}
|
||||
@@ -197,18 +197,18 @@ class PaymentSocialContribution extends CommonObject
|
||||
}
|
||||
|
||||
$result = $this->call_trigger('PAYMENTSOCIALCONTRIBUTION_CREATE', $user);
|
||||
if($result < 0) $error++;
|
||||
if ($result < 0) $error++;
|
||||
|
||||
if ($totalamount != 0 && ! $error)
|
||||
if ($totalamount != 0 && !$error)
|
||||
{
|
||||
$this->amount=$totalamount;
|
||||
$this->total=$totalamount; // deprecated
|
||||
$this->amount = $totalamount;
|
||||
$this->total = $totalamount; // deprecated
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error = $this->db->error();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@@ -278,7 +278,7 @@ class PaymentSocialContribution extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -294,18 +294,18 @@ class PaymentSocialContribution extends CommonObject
|
||||
public function update($user = null, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
// Clean parameters
|
||||
|
||||
if (isset($this->fk_charge)) $this->fk_charge= (int) $this->fk_charge;
|
||||
if (isset($this->amount)) $this->amount=trim($this->amount);
|
||||
if (isset($this->fk_typepaiement)) $this->fk_typepaiement= (int) $this->fk_typepaiement;
|
||||
if (isset($this->num_paiement)) $this->num_paiement=trim($this->num_paiement);
|
||||
if (isset($this->note)) $this->note=trim($this->note);
|
||||
if (isset($this->fk_bank)) $this->fk_bank= (int) $this->fk_bank;
|
||||
if (isset($this->fk_user_creat)) $this->fk_user_creat= (int) $this->fk_user_creat;
|
||||
if (isset($this->fk_user_modif)) $this->fk_user_modif= (int) $this->fk_user_modif;
|
||||
if (isset($this->fk_charge)) $this->fk_charge = (int) $this->fk_charge;
|
||||
if (isset($this->amount)) $this->amount = trim($this->amount);
|
||||
if (isset($this->fk_typepaiement)) $this->fk_typepaiement = (int) $this->fk_typepaiement;
|
||||
if (isset($this->num_paiement)) $this->num_paiement = trim($this->num_paiement);
|
||||
if (isset($this->note)) $this->note = trim($this->note);
|
||||
if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank;
|
||||
if (isset($this->fk_user_creat)) $this->fk_user_creat = (int) $this->fk_user_creat;
|
||||
if (isset($this->fk_user_modif)) $this->fk_user_modif = (int) $this->fk_user_modif;
|
||||
|
||||
|
||||
|
||||
@@ -315,26 +315,26 @@ class PaymentSocialContribution extends CommonObject
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET";
|
||||
|
||||
$sql.= " fk_charge=".(isset($this->fk_charge)?$this->fk_charge:"null").",";
|
||||
$sql.= " datec=".(dol_strlen($this->datec)!=0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
|
||||
$sql.= " tms=".(dol_strlen($this->tms)!=0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
|
||||
$sql.= " datep=".(dol_strlen($this->datep)!=0 ? "'".$this->db->idate($this->datep)."'" : 'null').",";
|
||||
$sql.= " amount=".(isset($this->amount)?$this->amount:"null").",";
|
||||
$sql.= " fk_typepaiement=".(isset($this->fk_typepaiement)?$this->fk_typepaiement:"null").",";
|
||||
$sql.= " num_paiement=".(isset($this->num_paiement)?"'".$this->db->escape($this->num_paiement)."'":"null").",";
|
||||
$sql.= " note=".(isset($this->note)?"'".$this->db->escape($this->note)."'":"null").",";
|
||||
$sql.= " fk_bank=".(isset($this->fk_bank)?$this->fk_bank:"null").",";
|
||||
$sql.= " fk_user_creat=".(isset($this->fk_user_creat)?$this->fk_user_creat:"null").",";
|
||||
$sql.= " fk_user_modif=".(isset($this->fk_user_modif)?$this->fk_user_modif:"null")."";
|
||||
$sql .= " fk_charge=".(isset($this->fk_charge) ? $this->fk_charge : "null").",";
|
||||
$sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
|
||||
$sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
|
||||
$sql .= " datep=".(dol_strlen($this->datep) != 0 ? "'".$this->db->idate($this->datep)."'" : 'null').",";
|
||||
$sql .= " amount=".(isset($this->amount) ? $this->amount : "null").",";
|
||||
$sql .= " fk_typepaiement=".(isset($this->fk_typepaiement) ? $this->fk_typepaiement : "null").",";
|
||||
$sql .= " num_paiement=".(isset($this->num_paiement) ? "'".$this->db->escape($this->num_paiement)."'" : "null").",";
|
||||
$sql .= " note=".(isset($this->note) ? "'".$this->db->escape($this->note)."'" : "null").",";
|
||||
$sql .= " fk_bank=".(isset($this->fk_bank) ? $this->fk_bank : "null").",";
|
||||
$sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? $this->fk_user_creat : "null").",";
|
||||
$sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null")."";
|
||||
|
||||
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
$sql .= " WHERE rowid=".$this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
|
||||
|
||||
//if (! $error)
|
||||
//{
|
||||
@@ -355,13 +355,13 @@ class PaymentSocialContribution extends CommonObject
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
foreach ($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
return -1 * $error;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -381,7 +381,7 @@ class PaymentSocialContribution extends CommonObject
|
||||
public function delete($user, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
dol_syslog(get_class($this)."::delete");
|
||||
|
||||
@@ -392,20 +392,20 @@ class PaymentSocialContribution extends CommonObject
|
||||
$accline = new AccountLine($this->db);
|
||||
$accline->fetch($this->bank_line);
|
||||
$result = $accline->delete();
|
||||
if($result < 0) {
|
||||
if ($result < 0) {
|
||||
$this->errors[] = $accline->error;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
$sql .= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
|
||||
}
|
||||
|
||||
//if (! $error)
|
||||
@@ -427,13 +427,13 @@ class PaymentSocialContribution extends CommonObject
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
foreach ($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
return -1 * $error;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -453,35 +453,35 @@ class PaymentSocialContribution extends CommonObject
|
||||
*/
|
||||
public function createFromClone(User $user, $fromid)
|
||||
{
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
$object=new PaymentSocialContribution($this->db);
|
||||
$object = new PaymentSocialContribution($this->db);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Load source object
|
||||
$object->fetch($fromid);
|
||||
$object->id=0;
|
||||
$object->statut=0;
|
||||
$object->id = 0;
|
||||
$object->statut = 0;
|
||||
|
||||
// Clear fields
|
||||
// ...
|
||||
|
||||
// Create clone
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
$result=$object->create($user);
|
||||
$result = $object->create($user);
|
||||
|
||||
// Other options
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error=$object->error;
|
||||
$this->error = $object->error;
|
||||
$error++;
|
||||
}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return $object->id;
|
||||
@@ -503,19 +503,19 @@ class PaymentSocialContribution extends CommonObject
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
$this->id=0;
|
||||
$this->id = 0;
|
||||
|
||||
$this->fk_charge='';
|
||||
$this->datec='';
|
||||
$this->tms='';
|
||||
$this->datep='';
|
||||
$this->amount='';
|
||||
$this->fk_typepaiement='';
|
||||
$this->num_paiement='';
|
||||
$this->note='';
|
||||
$this->fk_bank='';
|
||||
$this->fk_user_creat='';
|
||||
$this->fk_user_modif='';
|
||||
$this->fk_charge = '';
|
||||
$this->datec = '';
|
||||
$this->tms = '';
|
||||
$this->datep = '';
|
||||
$this->amount = '';
|
||||
$this->fk_typepaiement = '';
|
||||
$this->num_paiement = '';
|
||||
$this->note = '';
|
||||
$this->fk_bank = '';
|
||||
$this->fk_user_creat = '';
|
||||
$this->fk_user_modif = '';
|
||||
}
|
||||
|
||||
|
||||
@@ -535,22 +535,22 @@ class PaymentSocialContribution extends CommonObject
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
if (! empty($conf->banque->enabled))
|
||||
if (!empty($conf->banque->enabled))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
|
||||
$acc = new Account($this->db);
|
||||
$acc->fetch($accountid);
|
||||
|
||||
$total=$this->total;
|
||||
if ($mode == 'payment_sc') $total=-$total;
|
||||
$total = $this->total;
|
||||
if ($mode == 'payment_sc') $total = -$total;
|
||||
|
||||
// Insert payment into llx_bank
|
||||
$bank_line_id = $acc->addline(
|
||||
$this->datepaye,
|
||||
$this->paiementtype, // Payment mode id or code ("CHQ or VIR for example")
|
||||
$this->paiementtype, // Payment mode id or code ("CHQ or VIR for example")
|
||||
$label,
|
||||
$total,
|
||||
$this->num_paiement,
|
||||
@@ -564,7 +564,7 @@ class PaymentSocialContribution extends CommonObject
|
||||
// On connait ainsi le paiement qui a genere l'ecriture bancaire
|
||||
if ($bank_line_id > 0)
|
||||
{
|
||||
$result=$this->update_fk_bank($bank_line_id);
|
||||
$result = $this->update_fk_bank($bank_line_id);
|
||||
if ($result <= 0)
|
||||
{
|
||||
$error++;
|
||||
@@ -572,11 +572,11 @@ class PaymentSocialContribution extends CommonObject
|
||||
}
|
||||
|
||||
// Add link 'payment', 'payment_supplier', 'payment_sc' in bank_url between payment and bank transaction
|
||||
$url='';
|
||||
if ($mode == 'payment_sc') $url=DOL_URL_ROOT.'/compta/payment_sc/card.php?id=';
|
||||
$url = '';
|
||||
if ($mode == 'payment_sc') $url = DOL_URL_ROOT.'/compta/payment_sc/card.php?id=';
|
||||
if ($url)
|
||||
{
|
||||
$result=$acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode);
|
||||
$result = $acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode);
|
||||
if ($result <= 0)
|
||||
{
|
||||
$error++;
|
||||
@@ -635,7 +635,7 @@ class PaymentSocialContribution extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error = $this->db->error();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -663,7 +663,7 @@ class PaymentSocialContribution extends CommonObject
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
|
||||
global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
|
||||
|
||||
$langs->load('compta');
|
||||
/*if ($mode == 0)
|
||||
@@ -715,18 +715,18 @@ class PaymentSocialContribution extends CommonObject
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
$result = '';
|
||||
|
||||
if (empty($this->ref)) $this->ref=$this->lib;
|
||||
if (empty($this->ref)) $this->ref = $this->lib;
|
||||
$label = $langs->trans("ShowPayment").': '.$this->ref;
|
||||
|
||||
if (!empty($this->id)) {
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
$linkend = '</a>';
|
||||
|
||||
if ($withpicto) $result.=($link.img_object($label, 'payment', 'class="classfortooltip"').$linkend.' ');
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$link.($maxlen?dol_trunc($this->ref, $maxlen):$this->ref).$linkend;
|
||||
if ($withpicto) $result .= ($link.img_object($label, 'payment', 'class="classfortooltip"').$linkend.' ');
|
||||
if ($withpicto && $withpicto != 2) $result .= ' ';
|
||||
if ($withpicto != 2) $result .= $link.($maxlen ?dol_trunc($this->ref, $maxlen) : $this->ref).$linkend;
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
||||
@@ -33,9 +33,9 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
|
||||
*/
|
||||
class box_goodcustomers extends ModeleBoxes
|
||||
{
|
||||
public $boxcode="goodcustomers";
|
||||
public $boximg="object_company";
|
||||
public $boxlabel="BoxGoodCustomers";
|
||||
public $boxcode = "goodcustomers";
|
||||
public $boximg = "object_company";
|
||||
public $boxlabel = "BoxGoodCustomers";
|
||||
public $depends = array("societe");
|
||||
|
||||
/**
|
||||
@@ -62,10 +62,10 @@ class box_goodcustomers extends ModeleBoxes
|
||||
$this->db = $db;
|
||||
|
||||
// disable box for such cases
|
||||
if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $this->enabled=0; // disabled by this option
|
||||
if (empty($conf->global->MAIN_BOX_ENABLE_BEST_CUSTOMERS)) $this->enabled=0; // not enabled by default. Very slow on large database
|
||||
if (!empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $this->enabled = 0; // disabled by this option
|
||||
if (empty($conf->global->MAIN_BOX_ENABLE_BEST_CUSTOMERS)) $this->enabled = 0; // not enabled by default. Very slow on large database
|
||||
|
||||
$this->hidden = ! ($user->rights->societe->lire);
|
||||
$this->hidden = !($user->rights->societe->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,23 +79,23 @@ class box_goodcustomers extends ModeleBoxes
|
||||
global $user, $langs, $conf;
|
||||
$langs->load("boxes");
|
||||
|
||||
$this->max=$max;
|
||||
$this->max = $max;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
$thirdpartystatic=new Societe($this->db);
|
||||
$thirdpartystatic = new Societe($this->db);
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleGoodCustomers", $max));
|
||||
|
||||
if ($user->rights->societe->lire)
|
||||
{
|
||||
$sql = "SELECT s.rowid, s.nom as name, s.logo, s.code_client, s.code_fournisseur, s.client, s.fournisseur, s.tms as datem, s.status as status,";
|
||||
$sql.= " count(*) as nbfact, sum(". $this->db->ifsql('f.paye=1', '1', '0').") as nbfactpaye";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= ' WHERE s.entity IN ('.getEntity('societe').')';
|
||||
$sql.= ' AND s.rowid = f.fk_soc';
|
||||
$sql.= " GROUP BY s.rowid, s.nom, s.logo, s.code_client, s.code_fournisseur, s.client, s.fournisseur, s.tms, s.status";
|
||||
$sql.= $this->db->order("nbfact", "DESC");
|
||||
$sql.= $this->db->plimit($max, 0);
|
||||
$sql .= " count(*) as nbfact, sum(".$this->db->ifsql('f.paye=1', '1', '0').") as nbfactpaye";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= ' WHERE s.entity IN ('.getEntity('societe').')';
|
||||
$sql .= ' AND s.rowid = f.fk_soc';
|
||||
$sql .= " GROUP BY s.rowid, s.nom, s.logo, s.code_client, s.code_fournisseur, s.client, s.fournisseur, s.tms, s.status";
|
||||
$sql .= $this->db->order("nbfact", "DESC");
|
||||
$sql .= $this->db->plimit($max, 0);
|
||||
|
||||
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
@@ -107,7 +107,7 @@ class box_goodcustomers extends ModeleBoxes
|
||||
while ($line < $num)
|
||||
{
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$datem=$this->db->jdate($objp->tms);
|
||||
$datem = $this->db->jdate($objp->tms);
|
||||
$thirdpartystatic->id = $objp->rowid;
|
||||
$thirdpartystatic->name = $objp->name;
|
||||
$thirdpartystatic->code_client = $objp->code_client;
|
||||
@@ -131,7 +131,7 @@ class box_goodcustomers extends ModeleBoxes
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => $nbfact.( $nbimpaye != 0 ? ' ('.$nbimpaye.')':'')
|
||||
'text' => $nbfact.($nbimpaye != 0 ? ' ('.$nbimpaye.')' : '')
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
@@ -142,7 +142,7 @@ class box_goodcustomers extends ModeleBoxes
|
||||
$line++;
|
||||
}
|
||||
|
||||
if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center"','text'=>$langs->trans("NoRecordedCustomers"));
|
||||
if ($num == 0) $this->info_box_contents[$line][0] = array('td' => 'class="center"', 'text'=>$langs->trans("NoRecordedCustomers"));
|
||||
|
||||
$this->db->free($result);
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php";
|
||||
*/
|
||||
class box_task extends ModeleBoxes
|
||||
{
|
||||
public $boxcode="projettask";
|
||||
public $boximg="object_projecttask";
|
||||
public $boxcode = "projettask";
|
||||
public $boximg = "object_projecttask";
|
||||
public $boxlabel;
|
||||
public $depends = array("projet");
|
||||
|
||||
@@ -42,7 +42,7 @@ class box_task extends ModeleBoxes
|
||||
public $db;
|
||||
|
||||
public $param;
|
||||
public $enabled = 1; // enable because fixed ;-).
|
||||
public $enabled = 1; // enable because fixed ;-).
|
||||
|
||||
public $info_box_head = array();
|
||||
public $info_box_contents = array();
|
||||
@@ -61,10 +61,10 @@ class box_task extends ModeleBoxes
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('boxes', 'projects'));
|
||||
|
||||
$this->boxlabel="Tasks";
|
||||
$this->boxlabel = "Tasks";
|
||||
$this->db = $db;
|
||||
|
||||
$this->hidden = ! ($user->rights->projet->lire);
|
||||
$this->hidden = !($user->rights->projet->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,32 +77,32 @@ class box_task extends ModeleBoxes
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
|
||||
$this->max=$max;
|
||||
$this->max = $max;
|
||||
include_once DOL_DOCUMENT_ROOT."/projet/class/task.class.php";
|
||||
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT."/core/lib/project.lib.php";
|
||||
$projectstatic = new Project($this->db);
|
||||
$taskstatic=new Task($this->db);
|
||||
$form= new Form($this->db);
|
||||
$cookie_name='boxfilter_task';
|
||||
$boxcontent='';
|
||||
$taskstatic = new Task($this->db);
|
||||
$form = new Form($this->db);
|
||||
$cookie_name = 'boxfilter_task';
|
||||
$boxcontent = '';
|
||||
|
||||
$textHead = $langs->trans("CurentlyOpenedTasks");
|
||||
|
||||
$filterValue='all';
|
||||
if(in_array(GETPOST($cookie_name), array('all','im_project_contact','im_task_contact'))){
|
||||
$filterValue = 'all';
|
||||
if (in_array(GETPOST($cookie_name), array('all', 'im_project_contact', 'im_task_contact'))) {
|
||||
$filterValue = GETPOST($cookie_name);
|
||||
}
|
||||
elseif(!empty($_COOKIE[$cookie_name])){
|
||||
elseif (!empty($_COOKIE[$cookie_name])) {
|
||||
$filterValue = $_COOKIE[$cookie_name];
|
||||
}
|
||||
|
||||
|
||||
if($filterValue == 'im_task_contact'){
|
||||
$textHead.= ' : '.$langs->trans("WhichIamLinkedTo");
|
||||
if ($filterValue == 'im_task_contact') {
|
||||
$textHead .= ' : '.$langs->trans("WhichIamLinkedTo");
|
||||
}
|
||||
elseif($filterValue == 'im_project_contact'){
|
||||
$textHead.= ' : '.$langs->trans("WhichIamLinkedToProject");
|
||||
elseif ($filterValue == 'im_project_contact') {
|
||||
$textHead .= ' : '.$langs->trans("WhichIamLinkedToProject");
|
||||
}
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ class box_task extends ModeleBoxes
|
||||
});
|
||||
</script>';
|
||||
// set cookie by js
|
||||
$boxcontent.='<script>date = new Date(); date.setTime(date.getTime()+(30*86400000)); document.cookie = "'.$cookie_name.'='.$filterValue.'; expires= " + date.toGMTString() + "; path=/ "; </script>';
|
||||
$boxcontent .= '<script>date = new Date(); date.setTime(date.getTime()+(30*86400000)); document.cookie = "'.$cookie_name.'='.$filterValue.'; expires= " + date.toGMTString() + "; path=/ "; </script>';
|
||||
$this->info_box_contents[0][] = array(
|
||||
'tr'=>'class="nohover showiffilter'.$this->boxcode.' hideobject"',
|
||||
'td' => 'class="nohover"',
|
||||
@@ -144,43 +144,43 @@ class box_task extends ModeleBoxes
|
||||
|
||||
|
||||
$sql = "SELECT pt.rowid, pt.ref, pt.fk_projet, pt.fk_task_parent, pt.datec, pt.dateo, pt.datee, pt.datev, pt.label, pt.description, pt.duration_effective, pt.planned_workload, pt.progress";
|
||||
$sql.= ", p.rowid project_id, p.ref project_ref, p.title project_title";
|
||||
$sql .= ", p.rowid project_id, p.ref project_ref, p.title project_title";
|
||||
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."projet as p ON (pt.fk_projet = p.rowid)";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task as pt";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."projet as p ON (pt.fk_projet = p.rowid)";
|
||||
|
||||
if($filterValue === 'im_task_contact') {
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "element_contact as ec ON (ec.element_id = pt.rowid AND ec.fk_socpeople = '" . $user->id . "' )";
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "c_type_contact as tc ON (ec.fk_c_type_contact = tc.rowid AND tc.element = 'project_task' AND tc.source = 'internal' )";
|
||||
if ($filterValue === 'im_task_contact') {
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."element_contact as ec ON (ec.element_id = pt.rowid AND ec.fk_socpeople = '".$user->id."' )";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."c_type_contact as tc ON (ec.fk_c_type_contact = tc.rowid AND tc.element = 'project_task' AND tc.source = 'internal' )";
|
||||
}
|
||||
elseif($filterValue === 'im_project_contact') {
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "element_contact as ec ON (ec.element_id = p.rowid AND ec.fk_socpeople = '" . $user->id . "' )";
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "c_type_contact as tc ON (ec.fk_c_type_contact = tc.rowid AND tc.element = 'project' AND tc.source = 'internal' )";
|
||||
elseif ($filterValue === 'im_project_contact') {
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."element_contact as ec ON (ec.element_id = p.rowid AND ec.fk_socpeople = '".$user->id."' )";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."c_type_contact as tc ON (ec.fk_c_type_contact = tc.rowid AND tc.element = 'project' AND tc.source = 'internal' )";
|
||||
}
|
||||
|
||||
$sql.= " WHERE ";
|
||||
$sql.= " pt.entity = ".$conf->entity;
|
||||
$sql.= " AND p.fk_statut = ".Project::STATUS_VALIDATED;
|
||||
$sql.= " AND (pt.progress < 100 OR pt.progress IS NULL ) "; // 100% is done and not displayed
|
||||
$sql.= " AND p.usage_task = 1 ";
|
||||
$sql .= " WHERE ";
|
||||
$sql .= " pt.entity = ".$conf->entity;
|
||||
$sql .= " AND p.fk_statut = ".Project::STATUS_VALIDATED;
|
||||
$sql .= " AND (pt.progress < 100 OR pt.progress IS NULL ) "; // 100% is done and not displayed
|
||||
$sql .= " AND p.usage_task = 1 ";
|
||||
|
||||
|
||||
$sql.= " ORDER BY pt.datee ASC, pt.dateo ASC";
|
||||
$sql.= $this->db->plimit($max, 0);
|
||||
$sql .= " ORDER BY pt.datee ASC, pt.dateo ASC";
|
||||
$sql .= $this->db->plimit($max, 0);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
$i = 1;
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
while ($objp = $this->db->fetch_object($result)) {
|
||||
$taskstatic->id=$objp->rowid;
|
||||
$taskstatic->ref=$objp->ref;
|
||||
$taskstatic->label=$objp->label;
|
||||
$taskstatic->id = $objp->rowid;
|
||||
$taskstatic->ref = $objp->ref;
|
||||
$taskstatic->label = $objp->label;
|
||||
$taskstatic->progress = $objp->progress;
|
||||
$taskstatic->fk_statut = $objp->fk_statut;
|
||||
$taskstatic->date_end = $objp->datee;
|
||||
$taskstatic->planned_workload= $objp->planned_workload;
|
||||
$taskstatic->duration_effective= $objp->duration_effective;
|
||||
$taskstatic->planned_workload = $objp->planned_workload;
|
||||
$taskstatic->duration_effective = $objp->duration_effective;
|
||||
|
||||
$projectstatic->id = $objp->project_id;
|
||||
$projectstatic->ref = $objp->project_ref;
|
||||
|
||||
@@ -78,6 +78,7 @@ class CMailFile
|
||||
//! Defined background directly in body tag
|
||||
public $bodyCSS;
|
||||
|
||||
public $msgid;
|
||||
public $headers;
|
||||
public $message;
|
||||
/**
|
||||
@@ -263,7 +264,8 @@ class CMailFile
|
||||
// Add autocopy to (Note: Adding bcc for specific modules are also done from pages)
|
||||
if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) $addr_bcc .= ($addr_bcc ? ', ' : '').$conf->global->MAIN_MAIL_AUTOCOPY_TO;
|
||||
|
||||
// Action according to choosed sending method
|
||||
// We set all data according to choosed sending method.
|
||||
// We also set a value for ->msgid
|
||||
if ($this->sendmode == 'mail')
|
||||
{
|
||||
// Use mail php function (default PHP method)
|
||||
@@ -274,7 +276,7 @@ class CMailFile
|
||||
$text_body = "";
|
||||
$files_encoded = "";
|
||||
|
||||
// Define smtp_headers
|
||||
// Define smtp_headers (this also set ->msgid)
|
||||
$smtp_headers = $this->write_smtpheaders();
|
||||
if (!empty($moreinheader)) $smtp_headers .= $moreinheader; // $moreinheader contains the \r\n
|
||||
|
||||
@@ -365,6 +367,9 @@ class CMailFile
|
||||
$smtps->setErrorsTo($errors_to);
|
||||
$smtps->setDeliveryReceipt($deliveryreceipt);
|
||||
|
||||
$host=dol_getprefix('email');
|
||||
$this->msgid = time() . '.SMTPs-dolibarr-'.$trackid.'@' . $host;
|
||||
|
||||
$this->smtps = $smtps;
|
||||
}
|
||||
elseif ($this->sendmode == 'swiftmailer')
|
||||
@@ -386,7 +391,8 @@ class CMailFile
|
||||
// Adding a trackid header to a message
|
||||
$headers = $this->message->getHeaders();
|
||||
$headers->addTextHeader('X-Dolibarr-TRACKID', $trackid.'@'.$host);
|
||||
$headerID = time().'.swiftmailer-dolibarr-'.$trackid.'@'.$host;
|
||||
$this->msgid = time().'.swiftmailer-dolibarr-'.$trackid.'@'.$host;
|
||||
$headerID = $this->msgid;
|
||||
$msgid = $headers->get('Message-ID');
|
||||
$msgid->setId($headerID);
|
||||
$headers->addIdHeader('References', $headerID);
|
||||
@@ -1038,13 +1044,15 @@ class CMailFile
|
||||
if ($trackid)
|
||||
{
|
||||
// References is kept in response and Message-ID is returned into In-Reply-To:
|
||||
$out .= 'Message-ID: <'.time().'.phpmail-dolibarr-'.$trackid.'@'.$host.">".$this->eol2; // Uppercase seems replaced by phpmail
|
||||
$out .= 'References: <'.time().'.phpmail-dolibarr-'.$trackid.'@'.$host.">".$this->eol2;
|
||||
$this->msgid = time().'.phpmail-dolibarr-'.$trackid.'@'.$host;
|
||||
$out .= 'Message-ID: <'.$this->msgid.">".$this->eol2; // Uppercase seems replaced by phpmail
|
||||
$out .= 'References: <'.$this->msgid.">".$this->eol2;
|
||||
$out .= 'X-Dolibarr-TRACKID: '.$trackid.'@'.$host.$this->eol2;
|
||||
}
|
||||
else
|
||||
{
|
||||
$out .= 'Message-ID: <'.time().'.phpmail@'.$host.">".$this->eol2;
|
||||
$this->msgid = time().'.phpmail@'.$host;
|
||||
$out .= 'Message-ID: <'.$this->msgid.">".$this->eol2;
|
||||
}
|
||||
|
||||
if (!empty($_SERVER['REMOTE_ADDR'])) $out .= "X-RemoteAddr: ".$_SERVER['REMOTE_ADDR'].$this->eol2;
|
||||
|
||||
@@ -126,7 +126,7 @@ class Conf
|
||||
$this->service = new stdClass();
|
||||
$this->contrat = new stdClass();
|
||||
$this->actions = new stdClass();
|
||||
$this->agenda = new stdClass();
|
||||
$this->agenda = new stdClass();
|
||||
$this->commande = new stdClass();
|
||||
$this->propal = new stdClass();
|
||||
$this->facture = new stdClass();
|
||||
@@ -354,11 +354,11 @@ class Conf
|
||||
$this->propal->dir_output=$rootfordata."/propale";
|
||||
$this->propal->dir_temp=$rootfordata."/propale/temp";
|
||||
|
||||
// For backward compatibility
|
||||
$this->banque->multidir_output = array($this->entity => $rootfordata."/bank");
|
||||
$this->banque->multidir_temp = array($this->entity => $rootfordata."/bank/temp");
|
||||
$this->banque->dir_output=$rootfordata."/bank";
|
||||
$this->banque->dir_temp=$rootfordata."/bank/temp";
|
||||
// For bank storage
|
||||
$this->bank->multidir_output = array($this->entity => $rootfordata."/bank");
|
||||
$this->bank->multidir_temp = array($this->entity => $rootfordata."/bank/temp");
|
||||
$this->bank->dir_output = $rootfordata."/bank";
|
||||
$this->bank->dir_temp = $rootfordata."/bank/temp";
|
||||
|
||||
// For medias storage
|
||||
$this->medias->multidir_output = array($this->entity => $rootfordata."/medias");
|
||||
|
||||
@@ -174,7 +174,7 @@ class DolEditor
|
||||
//$out.= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" '.($this->readonly?' disabled':'').' rows="'.$this->rows.'"'.(preg_match('/%/',$this->cols)?' style="margin-top: 5px; width: '.$this->cols.'"':' cols="'.$this->cols.'"').' class="flat">';
|
||||
// TODO We do not put the disabled tag because on a read form, it change style with grey.
|
||||
$out.= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" rows="'.$this->rows.'"'.(preg_match('/%/', $this->cols)?' style="margin-top: 5px; width: '.$this->cols.'"':' cols="'.$this->cols.'"').' class="flat">';
|
||||
$out.= $this->content;
|
||||
$out.= htmlspecialchars($this->content);
|
||||
$out.= '</textarea>';
|
||||
|
||||
if ($this->tool == 'ckeditor' && ! empty($conf->use_javascript_ajax) && ! empty($conf->fckeditor->enabled))
|
||||
|
||||
@@ -82,8 +82,8 @@ class EmailSenderProfile extends CommonObject
|
||||
'email' => array('type'=>'varchar(255)', 'label'=>'Email', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1),
|
||||
//'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
|
||||
//'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>-1,),
|
||||
'signature' => array('type'=>'text', 'label'=>'Signature', 'visible'=>-1, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1,),
|
||||
'position' => array('type'=>'integer', 'label'=>'Position', 'visible'=>-1, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1,),
|
||||
'signature' => array('type'=>'text', 'label'=>'Signature', 'visible'=>-1, 'enabled'=>1, 'position'=>400, 'notnull'=>-1, 'index'=>1,),
|
||||
'position' => array('type'=>'integer', 'label'=>'Position', 'visible'=>1, 'enabled'=>1, 'position'=>405, 'notnull'=>-1, 'index'=>1,),
|
||||
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
|
||||
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
|
||||
'active' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1),
|
||||
|
||||
@@ -754,7 +754,7 @@ class FormOther
|
||||
} ); });
|
||||
</script>';
|
||||
}
|
||||
$out .= '<input id="colorpicker'.$prefix.'" name="'.$prefix.'" size="6" maxlength="7" class="flat'.($morecss ? ' '.$morecss : '').'" type="text" value="'.$set_color.'" />';
|
||||
$out .= '<input id="colorpicker'.$prefix.'" name="'.$prefix.'" size="6" maxlength="7" class="flat'.($morecss ? ' '.$morecss : '').'" type="text" value="'.dol_escape_htmltag($set_color).'" />';
|
||||
}
|
||||
else // In most cases, this is not used. We used instead function with no specific list of colors
|
||||
{
|
||||
|
||||
@@ -74,9 +74,9 @@ class Link extends CommonObject
|
||||
*/
|
||||
public function create($user = '')
|
||||
{
|
||||
global $langs,$conf;
|
||||
global $langs, $conf;
|
||||
|
||||
$error=0;
|
||||
$error = 0;
|
||||
$langs->load("errors");
|
||||
// Clean parameters
|
||||
if (empty($this->label)) {
|
||||
@@ -99,34 +99,34 @@ class Link extends CommonObject
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."links (entity, datea, url, label, objecttype, objectid)";
|
||||
$sql .= " VALUES ('".$conf->entity."', '".$this->db->idate($this->datea)."'";
|
||||
$sql .= ", '" . $this->db->escape($this->url) . "'";
|
||||
$sql .= ", '" . $this->db->escape($this->label) . "'";
|
||||
$sql .= ", '" . $this->db->escape($this->objecttype) . "'";
|
||||
$sql .= ", " . $this->objectid . ")";
|
||||
$sql .= ", '".$this->db->escape($this->url)."'";
|
||||
$sql .= ", '".$this->db->escape($this->label)."'";
|
||||
$sql .= ", '".$this->db->escape($this->objecttype)."'";
|
||||
$sql .= ", ".$this->objectid.")";
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "links");
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."links");
|
||||
|
||||
if ($this->id > 0) {
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('LINK_CREATE', $user);
|
||||
$result = $this->call_trigger('LINK_CREATE', $user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
} else {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
dol_syslog(get_class($this)."::Create success id=" . $this->id);
|
||||
dol_syslog(get_class($this)."::Create success id=".$this->id);
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this)."::Create echec update " . $this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this)."::Create echec update ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
@@ -135,13 +135,13 @@ class Link extends CommonObject
|
||||
{
|
||||
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$this->error=$langs->trans("ErrorCompanyNameAlreadyExists", $this->name);
|
||||
$result=-1;
|
||||
$this->error = $langs->trans("ErrorCompanyNameAlreadyExists", $this->name);
|
||||
$result = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$result=-2;
|
||||
$this->error = $this->db->lasterror();
|
||||
$result = -2;
|
||||
}
|
||||
$this->db->rollback();
|
||||
return $result;
|
||||
@@ -157,13 +157,13 @@ class Link extends CommonObject
|
||||
*/
|
||||
public function update($user = '', $call_trigger = 1)
|
||||
{
|
||||
global $langs,$conf;
|
||||
global $langs, $conf;
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
$langs->load("errors");
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
dol_syslog(get_class($this)."::Update id = " . $this->id . " call_trigger = " . $call_trigger);
|
||||
dol_syslog(get_class($this)."::Update id = ".$this->id." call_trigger = ".$call_trigger);
|
||||
|
||||
// Check parameters
|
||||
if (empty($this->url))
|
||||
@@ -180,30 +180,30 @@ class Link extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "links SET ";
|
||||
$sql .= "entity = '" . $conf->entity ."'";
|
||||
$sql .= ", datea = '" . $this->db->idate(dol_now()) . "'";
|
||||
$sql .= ", url = '" . $this->db->escape($this->url) . "'";
|
||||
$sql .= ", label = '" . $this->db->escape($this->label) . "'";
|
||||
$sql .= ", objecttype = '" . $this->db->escape($this->objecttype) . "'";
|
||||
$sql .= ", objectid = " . $this->objectid;
|
||||
$sql .= " WHERE rowid = " . $this->id;
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."links SET ";
|
||||
$sql .= "entity = '".$conf->entity."'";
|
||||
$sql .= ", datea = '".$this->db->idate(dol_now())."'";
|
||||
$sql .= ", url = '".$this->db->escape($this->url)."'";
|
||||
$sql .= ", label = '".$this->db->escape($this->label)."'";
|
||||
$sql .= ", objecttype = '".$this->db->escape($this->objecttype)."'";
|
||||
$sql .= ", objectid = ".$this->objectid;
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update sql = " .$sql);
|
||||
dol_syslog(get_class($this)."::update sql = ".$sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($call_trigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('LINK_MODIFY', $user);
|
||||
$result = $this->call_trigger('LINK_MODIFY', $user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
dol_syslog(get_class($this) . "::Update success");
|
||||
dol_syslog(get_class($this)."::Update success");
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
} else {
|
||||
@@ -218,12 +218,12 @@ class Link extends CommonObject
|
||||
{
|
||||
// Doublon
|
||||
$this->error = $langs->trans("ErrorDuplicateField");
|
||||
$result = -1;
|
||||
$result = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = $langs->trans("Error sql = " . $sql);
|
||||
$result = -2;
|
||||
$this->error = $langs->trans("Error sql = ".$sql);
|
||||
$result = -2;
|
||||
}
|
||||
$this->db->rollback();
|
||||
return $result;
|
||||
@@ -244,14 +244,14 @@ class Link extends CommonObject
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT rowid, entity, datea, url, label, objecttype, objectid FROM " . MAIN_DB_PREFIX . "links";
|
||||
$sql .= " WHERE objecttype = '" . $objecttype . "' AND objectid = " . $objectid;
|
||||
if ($conf->entity != 0) $sql .= " AND entity = " . $conf->entity;
|
||||
$sql = "SELECT rowid, entity, datea, url, label, objecttype, objectid FROM ".MAIN_DB_PREFIX."links";
|
||||
$sql .= " WHERE objecttype = '".$objecttype."' AND objectid = ".$objectid;
|
||||
if ($conf->entity != 0) $sql .= " AND entity = ".$conf->entity;
|
||||
if ($sortfield) {
|
||||
if (empty($sortorder)) {
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
$sql .= " ORDER BY " . $sortfield . " " . $sortorder;
|
||||
$sql .= " ORDER BY ".$sortfield." ".$sortorder;
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::fetchAll", LOG_DEBUG);
|
||||
@@ -259,7 +259,7 @@ class Link extends CommonObject
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
dol_syslog(get_class($this)."::fetchAll " . $num . "records", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetchAll ".$num."records", LOG_DEBUG);
|
||||
if ($num > 0)
|
||||
{
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
@@ -295,9 +295,9 @@ class Link extends CommonObject
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT COUNT(rowid) as nb FROM " . MAIN_DB_PREFIX . "links";
|
||||
$sql .= " WHERE objecttype = '" . $objecttype . "' AND objectid = " . $objectid;
|
||||
if ($conf->entity != 0) $sql .= " AND entity = " . $conf->entity;
|
||||
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."links";
|
||||
$sql .= " WHERE objecttype = '".$objecttype."' AND objectid = ".$objectid;
|
||||
if ($conf->entity != 0) $sql .= " AND entity = ".$conf->entity;
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
@@ -322,15 +322,15 @@ class Link extends CommonObject
|
||||
$rowid = $this->id;
|
||||
}
|
||||
|
||||
$sql = "SELECT rowid, entity, datea, url, label, objecttype, objectid FROM " . MAIN_DB_PREFIX . "links";
|
||||
$sql .= " WHERE rowid = " . $rowid;
|
||||
if($conf->entity != 0) $sql .= " AND entity = " . $conf->entity;
|
||||
$sql = "SELECT rowid, entity, datea, url, label, objecttype, objectid FROM ".MAIN_DB_PREFIX."links";
|
||||
$sql .= " WHERE rowid = ".$rowid;
|
||||
if ($conf->entity != 0) $sql .= " AND entity = ".$conf->entity;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if($this->db->num_rows($resql) > 0)
|
||||
if ($this->db->num_rows($resql) > 0)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
@@ -348,7 +348,7 @@ class Link extends CommonObject
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -367,7 +367,7 @@ class Link extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('LINK_DELETE', $user);
|
||||
$result = $this->call_trigger('LINK_DELETE', $user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->db->rollback();
|
||||
@@ -376,17 +376,17 @@ class Link extends CommonObject
|
||||
// End call triggers
|
||||
|
||||
// Remove link
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "links";
|
||||
$sql.= " WHERE rowid = " . $this->id;
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."links";
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
if (! $this->db->query($sql))
|
||||
if (!$this->db->query($sql))
|
||||
{
|
||||
$error++;
|
||||
$this->error = $this->db->lasterror();
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -45,17 +45,32 @@ class Menubase
|
||||
public $errors = array();
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
public $id;
|
||||
* @var int ID
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @var string Menu handler
|
||||
*/
|
||||
public $menu_handler;
|
||||
|
||||
/**
|
||||
* @var string Module name if record is added by a module
|
||||
*/
|
||||
public $module;
|
||||
|
||||
/**
|
||||
* @var string Menu top or left
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* @var string Name family/module for top menu (home, companies, ...)
|
||||
*/
|
||||
public $mainmenu;
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
* @var int 0 or Id of mother menu line, or -1 if we use fk_mainmenu and fk_leftmenu
|
||||
*/
|
||||
public $fk_menu;
|
||||
|
||||
@@ -70,23 +85,71 @@ class Menubase
|
||||
public $fk_leftmenu;
|
||||
|
||||
/**
|
||||
* @var int position
|
||||
* @var int Sort order of entry
|
||||
*/
|
||||
public $position;
|
||||
|
||||
/**
|
||||
* @var string Relative (or absolute) url to go
|
||||
*/
|
||||
public $url;
|
||||
|
||||
/**
|
||||
* @var string Target of Url link
|
||||
*/
|
||||
public $target;
|
||||
|
||||
/**
|
||||
* @var string Key for menu translation
|
||||
* @deprecated
|
||||
* @see title
|
||||
*/
|
||||
public $titre;
|
||||
|
||||
/**
|
||||
* @var string Key for menu translation
|
||||
*/
|
||||
public $title;
|
||||
|
||||
/**
|
||||
* @var string Lang file to load for translation
|
||||
*/
|
||||
public $langs;
|
||||
|
||||
/**
|
||||
* @var string Not used
|
||||
* @deprecated
|
||||
*/
|
||||
public $level;
|
||||
public $leftmenu; //<! Not used
|
||||
|
||||
/**
|
||||
* @var string Name family/module for left menu (setup, info, ...)
|
||||
*/
|
||||
public $leftmenu;
|
||||
|
||||
/**
|
||||
* @var string Condition to show enabled or disabled
|
||||
*/
|
||||
public $perms;
|
||||
|
||||
/**
|
||||
* @var string Condition to show or hide
|
||||
*/
|
||||
public $enabled;
|
||||
|
||||
/**
|
||||
* @var int 0 if menu for all users, 1 for external only, 2 for internal only
|
||||
*/
|
||||
public $user;
|
||||
|
||||
/**
|
||||
* @var int timestamp
|
||||
*/
|
||||
public $tms;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $menu_handler Menu handler
|
||||
@@ -100,10 +163,10 @@ class Menubase
|
||||
|
||||
|
||||
/**
|
||||
* Create menu entry into database
|
||||
* Create menu entry into database
|
||||
*
|
||||
* @param User $user User that create
|
||||
* @return int <0 if KO, Id of record if OK
|
||||
* @param User $user User that create
|
||||
* @return int <0 if KO, Id of record if OK
|
||||
*/
|
||||
public function create($user = null)
|
||||
{
|
||||
@@ -125,7 +188,7 @@ class Menubase
|
||||
$this->langs=trim($this->langs);
|
||||
$this->perms=trim($this->perms);
|
||||
$this->enabled=trim($this->enabled);
|
||||
$this->user=trim($this->user);
|
||||
$this->user = (int) $this->user;
|
||||
if (empty($this->position)) $this->position=0;
|
||||
if (! $this->level) $this->level=0;
|
||||
|
||||
@@ -246,7 +309,7 @@ class Menubase
|
||||
*/
|
||||
public function update($user = null, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
//global $conf, $langs;
|
||||
|
||||
// Clean parameters
|
||||
$this->rowid=trim($this->rowid);
|
||||
@@ -265,7 +328,7 @@ class Menubase
|
||||
$this->langs=trim($this->langs);
|
||||
$this->perms=trim($this->perms);
|
||||
$this->enabled=trim($this->enabled);
|
||||
$this->user=trim($this->user);
|
||||
$this->user = (int) $this->user;
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
@@ -311,7 +374,7 @@ class Menubase
|
||||
*/
|
||||
public function fetch($id, $user = null)
|
||||
{
|
||||
global $langs;
|
||||
//global $langs;
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
@@ -385,7 +448,7 @@ class Menubase
|
||||
*/
|
||||
public function delete($user)
|
||||
{
|
||||
global $conf, $langs;
|
||||
//global $conf, $langs;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."menu";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
@@ -1304,13 +1304,6 @@ class SMTPs
|
||||
$_header .= 'Bcc: ' . $this->getBCC() . "\r\n";
|
||||
*/
|
||||
|
||||
$host=$this->getHost();
|
||||
$usetls = preg_match('@tls://@i', $host);
|
||||
|
||||
$host=preg_replace('@tcp://@i', '', $host); // Remove prefix
|
||||
$host=preg_replace('@ssl://@i', '', $host); // Remove prefix
|
||||
$host=preg_replace('@tls://@i', '', $host); // Remove prefix
|
||||
|
||||
$host=dol_getprefix('email');
|
||||
|
||||
//NOTE: Message-ID should probably contain the username of the user who sent the msg
|
||||
|
||||
@@ -4275,7 +4275,9 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '',
|
||||
}
|
||||
}
|
||||
|
||||
print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtmlright, $savlimit, $totalnboflines, $hideselectlimit); // output the div and ul for previous/last completed with page numbers into $pagelist
|
||||
if ($savlimit || $morehtmlright) {
|
||||
print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtmlright, $savlimit, $totalnboflines, $hideselectlimit); // output the div and ul for previous/last completed with page numbers into $pagelist
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
|
||||
@@ -4302,7 +4304,7 @@ function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $be
|
||||
global $conf, $langs;
|
||||
|
||||
print '<div class="pagination"><ul>';
|
||||
if ((int) $limit >= 0 && empty($hideselectlimit))
|
||||
if ((int) $limit > 0 && empty($hideselectlimit))
|
||||
{
|
||||
$pagesizechoices = '10:10,15:15,20:20,30:30,40:40,50:50,100:100,250:250,500:500,1000:1000,5000:5000';
|
||||
//$pagesizechoices.=',0:'.$langs->trans("All"); // Not yet supported
|
||||
@@ -4317,7 +4319,6 @@ function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $be
|
||||
$tmpkey = $conf->liste_limit.':'.$conf->liste_limit;
|
||||
if (!in_array($tmpkey, $tmpchoice)) $tmpchoice[] = $tmpkey;
|
||||
asort($tmpchoice, SORT_NUMERIC);
|
||||
$found = false;
|
||||
foreach ($tmpchoice as $val)
|
||||
{
|
||||
$selected = '';
|
||||
@@ -4329,7 +4330,6 @@ function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $be
|
||||
if ((int) $key == (int) $limit)
|
||||
{
|
||||
$selected = ' selected="selected"';
|
||||
$found = true;
|
||||
}
|
||||
print '<option name="'.$key.'"'.$selected.'>'.dol_escape_htmltag($val).'</option>'."\n";
|
||||
}
|
||||
@@ -5212,16 +5212,18 @@ function get_default_npr(Societe $thirdparty_seller, Societe $thirdparty_buyer,
|
||||
|
||||
if ($idprodfournprice > 0)
|
||||
{
|
||||
if (!class_exists('ProductFournisseur'))
|
||||
if (!class_exists('ProductFournisseur')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
}
|
||||
$prodprice = new ProductFournisseur($db);
|
||||
$prodprice->fetch_product_fournisseur_price($idprodfournprice);
|
||||
return $prodprice->fourn_tva_npr;
|
||||
}
|
||||
elseif ($idprod > 0)
|
||||
{
|
||||
if (!class_exists('Product'))
|
||||
if (!class_exists('Product')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
}
|
||||
$prod = new Product($db);
|
||||
$prod->fetch($idprod);
|
||||
return $prod->tva_npr;
|
||||
|
||||
@@ -1258,9 +1258,15 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
// Logo
|
||||
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
|
||||
{
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
|
||||
{
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
}
|
||||
else {
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
|
||||
}
|
||||
if (is_readable($logo))
|
||||
{
|
||||
$height=pdf_getHeightForLogo($logo);
|
||||
|
||||
@@ -1391,9 +1391,15 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
// Logo
|
||||
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
|
||||
{
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
|
||||
{
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
}
|
||||
else {
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
|
||||
}
|
||||
if (is_readable($logo))
|
||||
{
|
||||
$height=pdf_getHeightForLogo($logo);
|
||||
|
||||
@@ -118,27 +118,27 @@ class pdf_merou extends ModelePdfExpedition
|
||||
*/
|
||||
public function __construct($db = 0)
|
||||
{
|
||||
global $conf,$langs,$mysoc;
|
||||
global $conf, $langs, $mysoc;
|
||||
|
||||
$this->db = $db;
|
||||
$this->name = "merou";
|
||||
$this->description = $langs->trans("DocumentModelMerou");
|
||||
|
||||
$this->type = 'pdf';
|
||||
$formatarray=pdf_getFormat();
|
||||
$formatarray = pdf_getFormat();
|
||||
$this->page_largeur = $formatarray['width'];
|
||||
$this->page_hauteur = round($formatarray['height']/2);
|
||||
$this->format = array($this->page_largeur,$this->page_hauteur);
|
||||
$this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
|
||||
$this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
|
||||
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
|
||||
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
|
||||
$this->page_hauteur = round($formatarray['height'] / 2);
|
||||
$this->format = array($this->page_largeur, $this->page_hauteur);
|
||||
$this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10;
|
||||
$this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10;
|
||||
$this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10;
|
||||
$this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10;
|
||||
|
||||
$this->option_logo = 1; // Display logo
|
||||
$this->option_logo = 1; // Display logo
|
||||
|
||||
// Get source company
|
||||
$this->emetteur=$mysoc;
|
||||
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default if not defined
|
||||
$this->emetteur = $mysoc;
|
||||
if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined
|
||||
}
|
||||
|
||||
|
||||
@@ -157,13 +157,13 @@ class pdf_merou extends ModelePdfExpedition
|
||||
public function write_file(&$object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $user,$conf,$langs,$mysoc,$hookmanager;
|
||||
global $user, $conf, $langs, $mysoc, $hookmanager;
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
if (!is_object($outputlangs)) $outputlangs = $langs;
|
||||
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
|
||||
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
|
||||
if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1';
|
||||
|
||||
// Load traductions files required by page
|
||||
$outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch"));
|
||||
@@ -180,31 +180,31 @@ class pdf_merou extends ModelePdfExpedition
|
||||
//Create recipient
|
||||
$idcontact = $object->$origin->getIdContact('external', 'SHIPPING');
|
||||
$this->destinataire = new Contact($this->db);
|
||||
if (! empty($idcontact[0])) $this->destinataire->fetch($idcontact[0]);
|
||||
if (!empty($idcontact[0])) $this->destinataire->fetch($idcontact[0]);
|
||||
|
||||
//Create deliverer
|
||||
$idcontact = $object->$origin->getIdContact('internal', 'LIVREUR');
|
||||
$this->livreur = new User($this->db);
|
||||
if (! empty($idcontact[0])) $this->livreur->fetch($idcontact[0]);
|
||||
if (!empty($idcontact[0])) $this->livreur->fetch($idcontact[0]);
|
||||
|
||||
// Definition of $dir and $file
|
||||
if ($object->specimen)
|
||||
{
|
||||
$dir = $conf->expedition->dir_output."/sending";
|
||||
$file = $dir . "/SPECIMEN.pdf";
|
||||
$file = $dir."/SPECIMEN.pdf";
|
||||
}
|
||||
else
|
||||
{
|
||||
$expref = dol_sanitizeFileName($object->ref);
|
||||
$dir = $conf->expedition->dir_output . "/sending/" . $expref;
|
||||
$file = $dir . "/" . $expref . ".pdf";
|
||||
$dir = $conf->expedition->dir_output."/sending/".$expref;
|
||||
$file = $dir."/".$expref.".pdf";
|
||||
}
|
||||
|
||||
if (! file_exists($dir))
|
||||
if (!file_exists($dir))
|
||||
{
|
||||
if (dol_mkdir($dir) < 0)
|
||||
{
|
||||
$this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir);
|
||||
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -212,24 +212,24 @@ class pdf_merou extends ModelePdfExpedition
|
||||
if (file_exists($dir))
|
||||
{
|
||||
// Add pdfgeneration hook
|
||||
if (! is_object($hookmanager))
|
||||
if (!is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
$hookmanager = new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('pdfgeneration'));
|
||||
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
|
||||
$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
|
||||
global $action;
|
||||
$reshook=$hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
$nblines = count($object->lines);
|
||||
|
||||
$pdf=pdf_getInstance($this->format, 'mm', 'l');
|
||||
$pdf = pdf_getInstance($this->format, 'mm', 'l');
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
$heightforinfotot = 0; // Height reserved to output the info and total part
|
||||
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
|
||||
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
|
||||
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6;
|
||||
$heightforinfotot = 0; // Height reserved to output the info and total part
|
||||
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
|
||||
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
|
||||
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
|
||||
$pdf->SetAutoPageBreak(1, 0);
|
||||
|
||||
if (class_exists('TCPDF'))
|
||||
@@ -239,14 +239,14 @@ class pdf_merou extends ModelePdfExpedition
|
||||
}
|
||||
$pdf->SetFont(pdf_getPDFFont($outputlangs));
|
||||
// Set path to the background PDF File
|
||||
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
|
||||
if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
|
||||
{
|
||||
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
|
||||
$tplidx = $pdf->importPage(1);
|
||||
}
|
||||
|
||||
$pdf->Open();
|
||||
$pagenb=0;
|
||||
$pagenb = 0;
|
||||
$pdf->SetDrawColor(128, 128, 128);
|
||||
|
||||
if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
|
||||
@@ -256,41 +256,41 @@ class pdf_merou extends ModelePdfExpedition
|
||||
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
|
||||
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
|
||||
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Shipment"));
|
||||
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
|
||||
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
|
||||
|
||||
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
|
||||
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
|
||||
|
||||
// New page
|
||||
$pdf->AddPage();
|
||||
$pagenb++;
|
||||
$this->_pagehead($pdf, $object, 1, $outputlangs);
|
||||
$pdf->SetFont('', '', $default_font_size - 3);
|
||||
$pdf->MultiCell(0, 3, ''); // Set interline to 3
|
||||
$pdf->MultiCell(0, 3, ''); // Set interline to 3
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
|
||||
$tab_top = 52;
|
||||
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
|
||||
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10);
|
||||
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter;
|
||||
$tab_height_newpage = $this->page_hauteur - $tab_top_newpage - $heightforfooter;
|
||||
|
||||
// Display notes
|
||||
if (! empty($object->note_public))
|
||||
if (!empty($object->note_public))
|
||||
{
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
$pdf->writeHTMLCell(190, 3, $this->marge_gauche, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1);
|
||||
$nexY = $pdf->GetY();
|
||||
$height_note=$nexY-$tab_top;
|
||||
$height_note = $nexY - $tab_top;
|
||||
|
||||
// Rect takes a length in 3rd parameter
|
||||
$pdf->SetDrawColor(192, 192, 192);
|
||||
$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
|
||||
$pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
|
||||
|
||||
$tab_height = $tab_height - $height_note;
|
||||
$tab_top = $nexY+6;
|
||||
$tab_top = $nexY + 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
$height_note=0;
|
||||
$height_note = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -302,7 +302,7 @@ class pdf_merou extends ModelePdfExpedition
|
||||
$curY = $tab_top + 7;
|
||||
$nexY = $tab_top + 7;
|
||||
|
||||
$num=count($object->lines);
|
||||
$num = count($object->lines);
|
||||
// Loop on each lines
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
@@ -311,17 +311,17 @@ class pdf_merou extends ModelePdfExpedition
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
|
||||
$pdf->setTopMargin($tab_top_newpage);
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||
$pageposbefore=$pdf->getPage();
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||
$pageposbefore = $pdf->getPage();
|
||||
|
||||
// Description of product line
|
||||
$libelleproduitservice = pdf_writelinedesc($pdf, $object, $i, $outputlangs, 90, 3, 50, $curY, 0, 1);
|
||||
|
||||
$nexY = $pdf->GetY();
|
||||
$pageposafter=$pdf->getPage();
|
||||
$pageposafter = $pdf->getPage();
|
||||
$pdf->setPage($pageposbefore);
|
||||
$pdf->setTopMargin($this->marge_haute);
|
||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||
|
||||
// We suppose that a too long description is moved completely on next page
|
||||
if ($pageposafter > $pageposbefore) {
|
||||
@@ -332,8 +332,8 @@ class pdf_merou extends ModelePdfExpedition
|
||||
|
||||
// Check boxes
|
||||
$pdf->SetDrawColor(120, 120, 120);
|
||||
$pdf->Rect(10+3, $curY, 3, 3);
|
||||
$pdf->Rect(20+3, $curY, 3, 3);
|
||||
$pdf->Rect(10 + 3, $curY, 3, 3);
|
||||
$pdf->Rect(20 + 3, $curY, 3, 3);
|
||||
|
||||
//Inserting the product reference
|
||||
$pdf->SetXY(30, $curY);
|
||||
@@ -347,16 +347,16 @@ class pdf_merou extends ModelePdfExpedition
|
||||
$pdf->MultiCell(30, 3, $object->lines[$i]->qty_shipped, 0, 'C', 0);
|
||||
|
||||
// Add line
|
||||
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
|
||||
if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
|
||||
{
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
|
||||
$pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
|
||||
$pdf->SetLineStyle(array('dash'=>0));
|
||||
}
|
||||
|
||||
$nexY+=2; // Add space between lines
|
||||
$nexY += 2; // Add space between lines
|
||||
|
||||
// Detect if some page were added automatically and output _tableau for past pages
|
||||
while ($pagenb < $pageposafter)
|
||||
@@ -373,9 +373,9 @@ class pdf_merou extends ModelePdfExpedition
|
||||
$this->_pagefoot($pdf, $object, $outputlangs, 1);
|
||||
$pagenb++;
|
||||
$pdf->setPage($pagenb);
|
||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||
}
|
||||
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
|
||||
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak)
|
||||
{
|
||||
if ($pagenb == 1)
|
||||
{
|
||||
@@ -396,12 +396,12 @@ class pdf_merou extends ModelePdfExpedition
|
||||
if ($pagenb == 1)
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
|
||||
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
||||
$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top_newpage - 1, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
|
||||
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
||||
$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
||||
}
|
||||
|
||||
// Pagefoot
|
||||
@@ -413,22 +413,22 @@ class pdf_merou extends ModelePdfExpedition
|
||||
$pdf->Output($file, 'F');
|
||||
|
||||
// Add pdfgeneration hook
|
||||
if (! is_object($hookmanager))
|
||||
if (!is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
$hookmanager = new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('pdfgeneration'));
|
||||
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
|
||||
$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
|
||||
global $action;
|
||||
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0)
|
||||
{
|
||||
$this->error = $hookmanager->error;
|
||||
$this->errors = $hookmanager->errors;
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
if (!empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
@@ -437,13 +437,13 @@ class pdf_merou extends ModelePdfExpedition
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$outputlangs->transnoentities("ErrorCanNotCreateDir", $dir);
|
||||
$this->error = $outputlangs->transnoentities("ErrorCanNotCreateDir", $dir);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$outputlangs->transnoentities("ErrorConstantNotDefined", "EXP_OUTPUTDIR");
|
||||
$this->error = $outputlangs->transnoentities("ErrorConstantNotDefined", "EXP_OUTPUTDIR");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -531,20 +531,20 @@ class pdf_merou extends ModelePdfExpedition
|
||||
*/
|
||||
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
|
||||
{
|
||||
global $conf, $langs,$hookmanager;
|
||||
global $conf, $langs, $hookmanager;
|
||||
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
|
||||
|
||||
//Affiche le filigrane brouillon - Print Draft Watermark
|
||||
if($object->statut==0 && (! empty($conf->global->SENDING_DRAFT_WATERMARK)) )
|
||||
if ($object->statut == 0 && (!empty($conf->global->SENDING_DRAFT_WATERMARK)))
|
||||
{
|
||||
pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->SENDING_DRAFT_WATERMARK);
|
||||
}
|
||||
|
||||
$posy=$this->marge_haute;
|
||||
$posx=$this->page_largeur-$this->marge_droite-100;
|
||||
$posy = $this->marge_haute;
|
||||
$posx = $this->page_largeur - $this->marge_droite - 100;
|
||||
|
||||
$Xoff = 90;
|
||||
$Yoff = 0;
|
||||
@@ -556,13 +556,13 @@ class pdf_merou extends ModelePdfExpedition
|
||||
|
||||
//*********************LOGO****************************
|
||||
$pdf->SetXY(11, 7);
|
||||
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
$logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
if (is_readable($logo))
|
||||
{
|
||||
$height=pdf_getHeightForLogo($logo);
|
||||
$pdf->Image($logo, 10, 5, 0, $height); // width=0 (auto)
|
||||
$height = pdf_getHeightForLogo($logo);
|
||||
$pdf->Image($logo, 10, 5, 0, $height); // width=0 (auto)
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -574,7 +574,7 @@ class pdf_merou extends ModelePdfExpedition
|
||||
}
|
||||
else
|
||||
{
|
||||
$text=$this->emetteur->name;
|
||||
$text = $this->emetteur->name;
|
||||
$pdf->MultiCell(70, 3, $outputlangs->convToOutputCharset($text), 0, 'L');
|
||||
}
|
||||
|
||||
@@ -583,9 +583,9 @@ class pdf_merou extends ModelePdfExpedition
|
||||
$pdf->SetXY($Xoff, 7);
|
||||
$pdf->SetFont('', 'B', $default_font_size + 2);
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
$pdf->MultiCell(0, 3, $outputlangs->transnoentities("SendingSheet"), '', 'L'); // Sending sheet
|
||||
$pdf->MultiCell(0, 3, $outputlangs->transnoentities("SendingSheet"), '', 'L'); // Sending sheet
|
||||
//Num Expedition
|
||||
$Yoff = $Yoff+7;
|
||||
$Yoff = $Yoff + 7;
|
||||
$Xoff = 142;
|
||||
//$pdf->Rect($Xoff, $Yoff, 85, 8);
|
||||
$pdf->SetXY($Xoff, $Yoff);
|
||||
@@ -594,8 +594,8 @@ class pdf_merou extends ModelePdfExpedition
|
||||
$pdf->MultiCell(0, 3, $outputlangs->transnoentities("RefSending").': '.$outputlangs->convToOutputCharset($object->ref), '', 'R');
|
||||
//$this->Code39($Xoff+43, $Yoff+1, $object->ref,$ext = true, $cks = false, $w = 0.4, $h = 4, $wide = true);
|
||||
|
||||
$origin = $object->origin;
|
||||
$origin_id = $object->origin_id;
|
||||
$origin = $object->origin;
|
||||
$origin_id = $object->origin_id;
|
||||
|
||||
// Add list of linked elements
|
||||
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size - 1, $hookmanager);
|
||||
@@ -603,15 +603,15 @@ class pdf_merou extends ModelePdfExpedition
|
||||
//$this->Code39($Xoff+43, $Yoff+1, $object->commande->ref,$ext = true, $cks = false, $w = 0.4, $h = 4, $wide = true);
|
||||
//Definition Location of the Company block
|
||||
$Xoff = 110;
|
||||
$blSocX=90;
|
||||
$blSocY=24;
|
||||
$blSocW=50;
|
||||
$blSocX2=$blSocW+$blSocX;
|
||||
$blSocX = 90;
|
||||
$blSocY = 24;
|
||||
$blSocW = 50;
|
||||
$blSocX2 = $blSocW + $blSocX;
|
||||
|
||||
// Sender name
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
$pdf->SetFont('', 'B', $default_font_size - 3);
|
||||
$pdf->SetXY($blSocX, $blSocY+1);
|
||||
$pdf->SetXY($blSocX, $blSocY + 1);
|
||||
$pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
|
||||
@@ -619,54 +619,54 @@ class pdf_merou extends ModelePdfExpedition
|
||||
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
|
||||
|
||||
$pdf->SetFont('', '', $default_font_size - 3);
|
||||
$pdf->SetXY($blSocX, $blSocY+4);
|
||||
$pdf->SetXY($blSocX, $blSocY + 4);
|
||||
$pdf->MultiCell(80, 2, $carac_emetteur, 0, 'L');
|
||||
|
||||
|
||||
if ($object->thirdparty->code_client)
|
||||
{
|
||||
$Yoff+=3;
|
||||
$posy=$Yoff;
|
||||
$Yoff += 3;
|
||||
$posy = $Yoff;
|
||||
$pdf->SetXY(100, $posy);
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
|
||||
}
|
||||
|
||||
// Date delivery
|
||||
$Yoff = $Yoff+7;
|
||||
$pdf->SetXY($blSocX-80, $blSocY+17);
|
||||
$Yoff = $Yoff + 7;
|
||||
$pdf->SetXY($blSocX - 80, $blSocY + 17);
|
||||
|
||||
$pdf->SetFont('', 'B', $default_font_size - 3);
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
$pdf->MultiCell(50, 8, $outputlangs->transnoentities("DateDeliveryPlanned")." : " . dol_print_date($object->date_delivery, 'day', false, $outputlangs, true), '', 'L');
|
||||
$pdf->MultiCell(50, 8, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery, 'day', false, $outputlangs, true), '', 'L');
|
||||
|
||||
$pdf->SetXY($blSocX-80, $blSocY+20);
|
||||
$pdf->SetXY($blSocX - 80, $blSocY + 20);
|
||||
$pdf->SetFont('', 'B', $default_font_size - 3);
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
$pdf->MultiCell(50, 8, $outputlangs->transnoentities("TrackingNumber")." : " . $object->tracking_number, '', 'L');
|
||||
$pdf->MultiCell(50, 8, $outputlangs->transnoentities("TrackingNumber")." : ".$object->tracking_number, '', 'L');
|
||||
|
||||
// Deliverer
|
||||
$pdf->SetXY($blSocX-80, $blSocY+23);
|
||||
$pdf->SetXY($blSocX - 80, $blSocY + 23);
|
||||
$pdf->SetFont('', '', $default_font_size - 3);
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
|
||||
if (! empty($object->tracking_number))
|
||||
if (!empty($object->tracking_number))
|
||||
{
|
||||
$object->getUrlTrackingStatus($object->tracking_number);
|
||||
if (! empty($object->tracking_url))
|
||||
if (!empty($object->tracking_url))
|
||||
{
|
||||
if ($object->shipping_method_id > 0)
|
||||
{
|
||||
// Get code using getLabelFromKey
|
||||
$code=$outputlangs->getLabelFromKey($this->db, $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code');
|
||||
$code = $outputlangs->getLabelFromKey($this->db, $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code');
|
||||
|
||||
$label='';
|
||||
$label.=$outputlangs->trans("SendingMethod").": ".$outputlangs->trans("SendingMethod".strtoupper($code));
|
||||
$label = '';
|
||||
$label .= $outputlangs->trans("SendingMethod").": ".$outputlangs->trans("SendingMethod".strtoupper($code));
|
||||
//var_dump($object->tracking_url != $object->tracking_number);exit;
|
||||
if ($object->tracking_url != $object->tracking_number)
|
||||
{
|
||||
$label.=" : ";
|
||||
$label.=$object->tracking_url;
|
||||
$label .= " : ";
|
||||
$label .= $object->tracking_url;
|
||||
}
|
||||
$pdf->SetFont('', 'B', $default_font_size - 3);
|
||||
$pdf->writeHTMLCell(50, 8, '', '', $label, '', 'L');
|
||||
@@ -681,20 +681,20 @@ class pdf_merou extends ModelePdfExpedition
|
||||
|
||||
// Shipping company (My Company)
|
||||
$Yoff = $blSocY;
|
||||
$blExpX=$Xoff-20;
|
||||
$blW=52;
|
||||
$blExpX = $Xoff - 20;
|
||||
$blW = 52;
|
||||
$Ydef = $Yoff;
|
||||
$pdf->Rect($blExpX, $Yoff, $blW, 26);
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
// If SHIPPING contact defined on order, we use it
|
||||
$usecontact=false;
|
||||
$arrayidcontact=$object->$origin->getIdContact('external', 'SHIPPING');
|
||||
$usecontact = false;
|
||||
$arrayidcontact = $object->$origin->getIdContact('external', 'SHIPPING');
|
||||
if (count($arrayidcontact) > 0)
|
||||
{
|
||||
$usecontact=true;
|
||||
$result=$object->fetch_contact($arrayidcontact[0]);
|
||||
$usecontact = true;
|
||||
$result = $object->fetch_contact($arrayidcontact[0]);
|
||||
}
|
||||
|
||||
// Recipient name
|
||||
@@ -705,19 +705,19 @@ class pdf_merou extends ModelePdfExpedition
|
||||
$thirdparty = $object->thirdparty;
|
||||
}
|
||||
|
||||
$carac_client_name=pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ((!empty($object->contact))?$object->contact:null), $usecontact, 'targetwithdetails', $object);
|
||||
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ((!empty($object->contact)) ? $object->contact : null), $usecontact, 'targetwithdetails', $object);
|
||||
|
||||
$blDestX=$blExpX+55;
|
||||
$blW=54;
|
||||
$Yoff = $Ydef +1;
|
||||
$blDestX = $blExpX + 55;
|
||||
$blW = 54;
|
||||
$Yoff = $Ydef + 1;
|
||||
|
||||
// Show Recipient frame
|
||||
$pdf->SetFont('', 'B', $default_font_size - 3);
|
||||
$pdf->SetXY($blDestX, $Yoff-4);
|
||||
$pdf->SetXY($blDestX, $Yoff - 4);
|
||||
$pdf->MultiCell($blW, 3, $outputlangs->transnoentities("Recipient"), 0, 'L');
|
||||
$pdf->Rect($blDestX, $Yoff-1, $blW, 26);
|
||||
$pdf->Rect($blDestX, $Yoff - 1, $blW, 26);
|
||||
|
||||
// Show recipient name
|
||||
$pdf->SetFont('', 'B', $default_font_size - 3);
|
||||
|
||||
@@ -1616,9 +1616,15 @@ class pdf_crabe extends ModelePDFFactures
|
||||
// Logo
|
||||
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
|
||||
{
|
||||
$logo = $conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
|
||||
{
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
}
|
||||
else {
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
|
||||
}
|
||||
if (is_readable($logo))
|
||||
{
|
||||
$height = pdf_getHeightForLogo($logo);
|
||||
|
||||
@@ -1832,9 +1832,15 @@ class pdf_sponge extends ModelePDFFactures
|
||||
// Logo
|
||||
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
|
||||
{
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
|
||||
{
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
}
|
||||
else {
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
|
||||
}
|
||||
if (is_readable($logo))
|
||||
{
|
||||
$height=pdf_getHeightForLogo($logo);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1501,9 +1501,15 @@ class pdf_cyan extends ModelePDFPropales
|
||||
// Logo
|
||||
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
|
||||
{
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
|
||||
{
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
}
|
||||
else {
|
||||
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
|
||||
}
|
||||
if (is_readable($logo))
|
||||
{
|
||||
$height=pdf_getHeightForLogo($logo);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -22,7 +22,7 @@
|
||||
* \brief File to manage password generation according to standard rule
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/modules/security/generate/modules_genpassword.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/security/generate/modules_genpassword.php';
|
||||
|
||||
|
||||
/**
|
||||
@@ -61,10 +61,10 @@ class modGeneratePassStandard extends ModeleGenPassword
|
||||
$this->id = "standard";
|
||||
$this->length = 8;
|
||||
|
||||
$this->db=$db;
|
||||
$this->conf=$conf;
|
||||
$this->langs=$langs;
|
||||
$this->user=$user;
|
||||
$this->db = $db;
|
||||
$this->conf = $conf;
|
||||
$this->langs = $langs;
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -108,7 +108,7 @@ class modGeneratePassStandard extends ModeleGenPassword
|
||||
while ($i < $this->length)
|
||||
{
|
||||
// pick a random character from the possible ones
|
||||
$char = substr($possible, mt_rand(0, dol_strlen($possible)-1), 1);
|
||||
$char = substr($possible, mt_rand(0, dol_strlen($possible) - 1), 1);
|
||||
|
||||
// we don't want this character if it's already in the password
|
||||
if (!strstr($password, $char))
|
||||
|
||||
@@ -218,7 +218,7 @@ elseif ($modulepart == 'bank')
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
if ($result <= 0) dol_print_error($db, 'Failed to load object');
|
||||
$dir=$conf->banque->dir_output; // By default
|
||||
$dir=$conf->bank->dir_output; // By default
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -37,11 +37,11 @@ if ($user->socid > 0) $socid=$user->socid;
|
||||
* View
|
||||
*/
|
||||
|
||||
$socstatic=new Societe($db);
|
||||
$socstatic = new Societe($db);
|
||||
|
||||
llxHeader("", $langs->trans("Tools"), "");
|
||||
|
||||
$text=$langs->trans("Tools");
|
||||
$text = $langs->trans("Tools");
|
||||
|
||||
print load_fiche_titre($text, '', 'wrench');
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($object) || ! is_object($object))
|
||||
if (empty($object) || !is_object($object))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
@@ -35,28 +35,28 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
$module = $object->element;
|
||||
|
||||
// Special cases
|
||||
if ($module == 'propal') { $permission=$user->rights->propale->creer; }
|
||||
elseif ($module == 'fichinter') { $permission=$user->rights->ficheinter->creer; }
|
||||
elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->commande->creer; }
|
||||
elseif ($module == 'invoice_supplier') { $permission=$user->rights->fournisseur->facture->creer; }
|
||||
elseif ($module == 'project') { $permission=$user->rights->projet->creer; }
|
||||
elseif ($module == 'action') { $permission=$user->rights->agenda->myactions->create; }
|
||||
elseif ($module == 'shipping') { $permission=$user->rights->expedition->creer; }
|
||||
elseif ($module == 'reception') { $permission=$user->rights->reception->creer; }
|
||||
elseif ($module == 'project_task') { $permission=$user->rights->projet->creer; }
|
||||
elseif (! isset($permission) && isset($user->rights->$module->creer))
|
||||
if ($module == 'propal') { $permission = $user->rights->propale->creer; }
|
||||
elseif ($module == 'fichinter') { $permission = $user->rights->ficheinter->creer; }
|
||||
elseif ($module == 'order_supplier') { $permission = $user->rights->fournisseur->commande->creer; }
|
||||
elseif ($module == 'invoice_supplier') { $permission = $user->rights->fournisseur->facture->creer; }
|
||||
elseif ($module == 'project') { $permission = $user->rights->projet->creer; }
|
||||
elseif ($module == 'action') { $permission = $user->rights->agenda->myactions->create; }
|
||||
elseif ($module == 'shipping') { $permission = $user->rights->expedition->creer; }
|
||||
elseif ($module == 'reception') { $permission = $user->rights->reception->creer; }
|
||||
elseif ($module == 'project_task') { $permission = $user->rights->projet->creer; }
|
||||
elseif (!isset($permission) && isset($user->rights->$module->creer))
|
||||
{
|
||||
$permission=$user->rights->$module->creer;
|
||||
$permission = $user->rights->$module->creer;
|
||||
}
|
||||
elseif (! isset($permission) && isset($user->rights->$module->write))
|
||||
elseif (!isset($permission) && isset($user->rights->$module->write))
|
||||
{
|
||||
$permission=$user->rights->$module->write;
|
||||
$permission = $user->rights->$module->write;
|
||||
}
|
||||
|
||||
$formcompany= new FormCompany($db);
|
||||
$companystatic=new Societe($db);
|
||||
$contactstatic=new Contact($db);
|
||||
$userstatic=new User($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
$companystatic = new Societe($db);
|
||||
$contactstatic = new Contact($db);
|
||||
$userstatic = new User($db);
|
||||
|
||||
?>
|
||||
|
||||
@@ -90,11 +90,11 @@ if ($permission) {
|
||||
<?php if ($withproject) print '<input type="hidden" name="withproject" value="'.$withproject.'">'; ?>
|
||||
<div class="nowrap tagtd"><?php echo img_object('', 'user').' '.$langs->trans("Users"); ?></div>
|
||||
<div class="tagtd"><?php echo $conf->global->MAIN_INFO_SOCIETE_NOM; ?></div>
|
||||
<div class="tagtd maxwidthonsmartphone"><?php echo $form->select_dolusers($user->id, 'userid', 0, (! empty($userAlreadySelected)?$userAlreadySelected:null), 0, null, null, 0, 56, '', 0, '', 'minwidth200imp'); ?></div>
|
||||
<div class="tagtd maxwidthonsmartphone"><?php echo $form->select_dolusers($user->id, 'userid', 0, (!empty($userAlreadySelected) ? $userAlreadySelected : null), 0, null, null, 0, 56, '', 0, '', 'minwidth200imp'); ?></div>
|
||||
<div class="tagtd maxwidthonsmartphone">
|
||||
<?php
|
||||
$tmpobject=$object;
|
||||
if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc;
|
||||
$tmpobject = $object;
|
||||
if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) $tmpobject = $objectsrc;
|
||||
echo $formcompany->selectTypeContact($tmpobject, '', 'type', 'internal');
|
||||
?></div>
|
||||
<div class="tagtd"> </div>
|
||||
@@ -116,7 +116,7 @@ if ($permission) {
|
||||
<?php if ($withproject) print '<input type="hidden" name="withproject" value="'.$withproject.'">'; ?>
|
||||
<div class="tagtd nowrap noborderbottom"><?php echo img_object('', 'contact').' '.$langs->trans("ThirdPartyContacts"); ?></div>
|
||||
<div class="tagtd nowrap maxwidthonsmartphone noborderbottom">
|
||||
<?php $selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$object->socid; ?>
|
||||
<?php $selectedCompany = isset($_GET["newcompany"]) ? $_GET["newcompany"] : $object->socid; ?>
|
||||
<?php
|
||||
// add company icon before select list
|
||||
if ($selectedCompany)
|
||||
|
||||
@@ -29,77 +29,77 @@ $isInvoice = in_array($object->element, array('facture', 'invoice', 'facture_fou
|
||||
$isNewObject = empty($object->id) && empty($object->rowid);
|
||||
|
||||
// Relative and absolute discounts
|
||||
$addrelativediscount = '<a href="' . DOL_URL_ROOT . '/comm/remise.php?id=' . $thirdparty->id . '&backtopage=' . $backtopage . '">' . $langs->trans("EditRelativeDiscount") . '</a>';
|
||||
$addabsolutediscount = '<a href="' . DOL_URL_ROOT . '/comm/remx.php?id=' . $thirdparty->id . '&backtopage=' . $backtopage . '">' . $langs->trans("EditGlobalDiscounts") . '</a>';
|
||||
$viewabsolutediscount = '<a href="' . DOL_URL_ROOT . '/comm/remx.php?id=' . $thirdparty->id . '&backtopage=' . $backtopage . '">' . $langs->trans("ViewAvailableGlobalDiscounts") . '</a>';
|
||||
$addrelativediscount = '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$thirdparty->id.'&backtopage='.$backtopage.'">'.$langs->trans("EditRelativeDiscount").'</a>';
|
||||
$addabsolutediscount = '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$thirdparty->id.'&backtopage='.$backtopage.'">'.$langs->trans("EditGlobalDiscounts").'</a>';
|
||||
$viewabsolutediscount = '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$thirdparty->id.'&backtopage='.$backtopage.'">'.$langs->trans("ViewAvailableGlobalDiscounts").'</a>';
|
||||
|
||||
$fixedDiscount = $thirdparty->remise_percent;
|
||||
if(! empty($discount_type)) {
|
||||
if (!empty($discount_type)) {
|
||||
$fixedDiscount = $thirdparty->remise_supplier_percent;
|
||||
}
|
||||
|
||||
if ($fixedDiscount > 0)
|
||||
{
|
||||
$translationKey = (! empty($discount_type)) ? 'HasRelativeDiscountFromSupplier' : 'CompanyHasRelativeDiscount';
|
||||
$translationKey = (!empty($discount_type)) ? 'HasRelativeDiscountFromSupplier' : 'CompanyHasRelativeDiscount';
|
||||
print $langs->trans($translationKey, $fixedDiscount).'.';
|
||||
}
|
||||
else
|
||||
{
|
||||
$translationKey = (! empty($discount_type)) ? 'HasNoRelativeDiscountFromSupplier' : 'CompanyHasNoRelativeDiscount';
|
||||
$translationKey = (!empty($discount_type)) ? 'HasNoRelativeDiscountFromSupplier' : 'CompanyHasNoRelativeDiscount';
|
||||
print $langs->trans($translationKey).'.';
|
||||
}
|
||||
if($isNewObject) print ' ('.$addrelativediscount.')';
|
||||
if ($isNewObject) print ' ('.$addrelativediscount.')';
|
||||
|
||||
// Is there is commercial discount or down payment available ?
|
||||
if ($absolute_discount > 0) {
|
||||
if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut > $objclassname::STATUS_DRAFT || $object->type == $objclassname::TYPE_CREDIT_NOTE || $object->type == $objclassname::TYPE_DEPOSIT) {
|
||||
$translationKey = ! empty($discount_type) ? 'HasAbsoluteDiscountFromSupplier' : 'CompanyHasAbsoluteDiscount';
|
||||
$text = $langs->trans($translationKey, price($absolute_discount), $langs->transnoentities("Currency" . $conf->currency)).'.';
|
||||
if ($cannotApplyDiscount || !$isInvoice || $isNewObject || $object->statut > $objclassname::STATUS_DRAFT || $object->type == $objclassname::TYPE_CREDIT_NOTE || $object->type == $objclassname::TYPE_DEPOSIT) {
|
||||
$translationKey = !empty($discount_type) ? 'HasAbsoluteDiscountFromSupplier' : 'CompanyHasAbsoluteDiscount';
|
||||
$text = $langs->trans($translationKey, price($absolute_discount), $langs->transnoentities("Currency".$conf->currency)).'.';
|
||||
|
||||
if ($isInvoice && ! $isNewObject && $object->statut > $objclassname::STATUS_DRAFT && $object->type != $objclassname::TYPE_CREDIT_NOTE && $object->type != $objclassname::TYPE_DEPOSIT) {
|
||||
if ($isInvoice && !$isNewObject && $object->statut > $objclassname::STATUS_DRAFT && $object->type != $objclassname::TYPE_CREDIT_NOTE && $object->type != $objclassname::TYPE_DEPOSIT) {
|
||||
$text = $form->textwithpicto($text, $langs->trans('AbsoluteDiscountUse'));
|
||||
}
|
||||
|
||||
if ($isNewObject) {
|
||||
$text.= ' ('.$addabsolutediscount.')';
|
||||
$text .= ' ('.$addabsolutediscount.')';
|
||||
}
|
||||
|
||||
print '<br>'.$text;
|
||||
} else {
|
||||
// Discount available of type fixed amount (not credit note)
|
||||
$more = '(' . $addabsolutediscount . ')';
|
||||
$form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, GETPOST('discountid'), 'remise_id', $thirdparty->id, $absolute_discount, $filterabsolutediscount, $resteapayer, $more, 0, $discount_type);
|
||||
$more = '('.$addabsolutediscount.')';
|
||||
$form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, GETPOST('discountid'), 'remise_id', $thirdparty->id, $absolute_discount, $filterabsolutediscount, $resteapayer, $more, 0, $discount_type);
|
||||
}
|
||||
}
|
||||
|
||||
// Is there credit notes availables ?
|
||||
if ($absolute_creditnote > 0) {
|
||||
// If validated, we show link "add credit note to payment"
|
||||
if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut != $objclassname::STATUS_VALIDATED || $object->type == $objclassname::TYPE_CREDIT_NOTE) {
|
||||
$translationKey = ! empty($discount_type) ? 'HasCreditNoteFromSupplier' : 'CompanyHasCreditNote';
|
||||
$text = $langs->trans($translationKey, price($absolute_creditnote), $langs->transnoentities("Currency" . $conf->currency)) . '.';
|
||||
if ($cannotApplyDiscount || !$isInvoice || $isNewObject || $object->statut != $objclassname::STATUS_VALIDATED || $object->type == $objclassname::TYPE_CREDIT_NOTE) {
|
||||
$translationKey = !empty($discount_type) ? 'HasCreditNoteFromSupplier' : 'CompanyHasCreditNote';
|
||||
$text = $langs->trans($translationKey, price($absolute_creditnote), $langs->transnoentities("Currency".$conf->currency)).'.';
|
||||
|
||||
if ($isInvoice && ! $isNewObject && $object->statut == $objclassname::STATUS_DRAFT && $object->type != $objclassname::TYPE_DEPOSIT) {
|
||||
if ($isInvoice && !$isNewObject && $object->statut == $objclassname::STATUS_DRAFT && $object->type != $objclassname::TYPE_DEPOSIT) {
|
||||
$text = $form->textwithpicto($text, $langs->trans('CreditNoteDepositUse'));
|
||||
}
|
||||
|
||||
if ($absolute_discount <= 0 || $isNewObject) {
|
||||
$text.= '('.$addabsolutediscount.')';
|
||||
$text .= '('.$addabsolutediscount.')';
|
||||
}
|
||||
|
||||
print '<br>'.$text;
|
||||
} else { // We can add a credit note on a down payment or standard invoice or situation invoice
|
||||
// There is credit notes discounts available
|
||||
$more = $isInvoice && ! $isNewObject ? ' (' . $viewabsolutediscount . ')' : '';
|
||||
$form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $thirdparty->id, $absolute_creditnote, $filtercreditnote, 0, $more, 0, $discount_type); // We allow credit note even if amount is higher
|
||||
$more = $isInvoice && !$isNewObject ? ' ('.$viewabsolutediscount.')' : '';
|
||||
$form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $thirdparty->id, $absolute_creditnote, $filtercreditnote, 0, $more, 0, $discount_type); // We allow credit note even if amount is higher
|
||||
}
|
||||
}
|
||||
|
||||
if($absolute_discount <= 0 && $absolute_creditnote <= 0) {
|
||||
$translationKey = ! empty($discount_type) ? 'HasNoAbsoluteDiscountFromSupplier' : 'CompanyHasNoAbsoluteDiscount';
|
||||
if ($absolute_discount <= 0 && $absolute_creditnote <= 0) {
|
||||
$translationKey = !empty($discount_type) ? 'HasNoAbsoluteDiscountFromSupplier' : 'CompanyHasNoAbsoluteDiscount';
|
||||
print '<br>'.$langs->trans($translationKey).'.';
|
||||
|
||||
if ($isInvoice && $object->statut == $objclassname::STATUS_DRAFT && $object->type != $objclassname::TYPE_CREDIT_NOTE && $object->type != $objclassname::TYPE_DEPOSIT) {
|
||||
print ' (' . $addabsolutediscount . ')';
|
||||
print ' ('.$addabsolutediscount.')';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,59 +33,59 @@
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($object) || ! is_object($object)) {
|
||||
if (empty($object) || !is_object($object)) {
|
||||
print "Error: this template page cannot be called directly as an URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
$usemargins=0;
|
||||
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element, array('facture','facturerec','propal','commande')))
|
||||
$usemargins = 0;
|
||||
if (!empty($conf->margin->enabled) && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande')))
|
||||
{
|
||||
$usemargins=1;
|
||||
$usemargins = 1;
|
||||
}
|
||||
|
||||
if (! isset($dateSelector)) global $dateSelector; // Take global var only if not already defined into function calling (for example formAddObjectLine)
|
||||
if (!isset($dateSelector)) global $dateSelector; // Take global var only if not already defined into function calling (for example formAddObjectLine)
|
||||
global $forceall, $forcetoshowtitlelines, $senderissupplier, $inputalsopricewithtax;
|
||||
|
||||
if (! isset($dateSelector)) $dateSelector=1; // For backward compatibility
|
||||
elseif (empty($dateSelector)) $dateSelector=0;
|
||||
if (empty($forceall)) $forceall=0;
|
||||
if (empty($senderissupplier)) $senderissupplier=0;
|
||||
if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
|
||||
if (!isset($dateSelector)) $dateSelector = 1; // For backward compatibility
|
||||
elseif (empty($dateSelector)) $dateSelector = 0;
|
||||
if (empty($forceall)) $forceall = 0;
|
||||
if (empty($senderissupplier)) $senderissupplier = 0;
|
||||
if (empty($inputalsopricewithtax)) $inputalsopricewithtax = 0;
|
||||
|
||||
|
||||
// Define colspan for the button 'Add'
|
||||
$colspan = 3; // Columns: total ht + col edit + col delete
|
||||
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan++;//Add column for Total (currency) if required
|
||||
if (in_array($object->element, array('propal','commande','order','facture','facturerec','invoice','supplier_proposal','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button
|
||||
$colspan = 3; // Columns: total ht + col edit + col delete
|
||||
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan++; //Add column for Total (currency) if required
|
||||
if (in_array($object->element, array('propal', 'commande', 'order', 'facture', 'facturerec', 'invoice', 'supplier_proposal', 'order_supplier', 'invoice_supplier'))) $colspan++; // With this, there is a column move button
|
||||
//print $object->element;
|
||||
|
||||
// Lines for extrafield
|
||||
$objectline = null;
|
||||
if (!empty($extrafields))
|
||||
{
|
||||
if ($this->table_element_line=='commandedet') {
|
||||
if ($this->table_element_line == 'commandedet') {
|
||||
$objectline = new OrderLine($this->db);
|
||||
}
|
||||
elseif ($this->table_element_line=='propaldet') {
|
||||
elseif ($this->table_element_line == 'propaldet') {
|
||||
$objectline = new PropaleLigne($this->db);
|
||||
}
|
||||
elseif ($this->table_element_line=='supplier_proposaldet') {
|
||||
elseif ($this->table_element_line == 'supplier_proposaldet') {
|
||||
$objectline = new SupplierProposalLine($this->db);
|
||||
}
|
||||
elseif ($this->table_element_line=='facturedet') {
|
||||
elseif ($this->table_element_line == 'facturedet') {
|
||||
$objectline = new FactureLigne($this->db);
|
||||
}
|
||||
elseif ($this->table_element_line=='contratdet') {
|
||||
elseif ($this->table_element_line == 'contratdet') {
|
||||
$objectline = new ContratLigne($this->db);
|
||||
}
|
||||
elseif ($this->table_element_line=='commande_fournisseurdet') {
|
||||
elseif ($this->table_element_line == 'commande_fournisseurdet') {
|
||||
$objectline = new CommandeFournisseurLigne($this->db);
|
||||
}
|
||||
elseif ($this->table_element_line=='facture_fourn_det') {
|
||||
elseif ($this->table_element_line == 'facture_fourn_det') {
|
||||
$objectline = new SupplierInvoiceLine($this->db);
|
||||
}
|
||||
elseif ($this->table_element_line=='facturedet_rec') {
|
||||
elseif ($this->table_element_line == 'facturedet_rec') {
|
||||
$objectline = new FactureLigneRec($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,9 +44,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
if (!empty($conf->productbatch->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php';
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
@@ -87,12 +87,13 @@ $hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empt
|
||||
$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
|
||||
|
||||
$object = new Expedition($db);
|
||||
$objectorder = new Commande($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$extrafields->fetch_name_optionals_label($object->table_element_line);
|
||||
$extrafields->fetch_name_optionals_label(OrderLine::$table_element);
|
||||
$extrafields->fetch_name_optionals_label($objectorder->table_element_line);
|
||||
|
||||
// Load object. Make an object->fetch
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
if (empty($conf) || !is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
|
||||
@@ -46,9 +46,9 @@ class ProductFournisseur extends Product
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error='';
|
||||
public $error = '';
|
||||
|
||||
public $product_fourn_price_id; // id of ligne product-supplier
|
||||
public $product_fourn_price_id; // id of ligne product-supplier
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
@@ -61,18 +61,18 @@ class ProductFournisseur extends Product
|
||||
*/
|
||||
public $fourn_ref;
|
||||
public $delivery_time_days;
|
||||
public $ref_supplier; // ref supplier (can be set by get_buyprice)
|
||||
public $ref_supplier; // ref supplier (can be set by get_buyprice)
|
||||
public $desc_supplier;
|
||||
public $vatrate_supplier; // default vat rate for this supplier/qty/product (can be set by get_buyprice)
|
||||
public $vatrate_supplier; // default vat rate for this supplier/qty/product (can be set by get_buyprice)
|
||||
|
||||
public $fourn_id; //supplier id
|
||||
public $fourn_qty; // quantity for price (can be set by get_buyprice)
|
||||
public $fourn_pu; // unit price for quantity (can be set by get_buyprice)
|
||||
public $fourn_id; //supplier id
|
||||
public $fourn_qty; // quantity for price (can be set by get_buyprice)
|
||||
public $fourn_pu; // unit price for quantity (can be set by get_buyprice)
|
||||
|
||||
public $fourn_price; // price for quantity
|
||||
public $fourn_remise_percent; // discount for quantity (percent)
|
||||
public $fourn_remise; // discount for quantity (amount)
|
||||
public $product_fourn_id; // product-supplier id
|
||||
public $fourn_price; // price for quantity
|
||||
public $fourn_remise_percent; // discount for quantity (percent)
|
||||
public $fourn_remise; // discount for quantity (amount)
|
||||
public $product_fourn_id; // product-supplier id
|
||||
|
||||
/**
|
||||
* @var int ID user_id - user who created/updated supplier price
|
||||
@@ -93,8 +93,8 @@ class ProductFournisseur extends Product
|
||||
*/
|
||||
public $fk_supplier_price_expression;
|
||||
|
||||
public $supplier_reputation; // reputation of supplier
|
||||
public $reputations=array(); // list of available supplier reputations
|
||||
public $supplier_reputation; // reputation of supplier
|
||||
public $reputations = array(); // list of available supplier reputations
|
||||
|
||||
// Multicurreny
|
||||
public $fourn_multicurrency_id;
|
||||
@@ -114,7 +114,7 @@ class ProductFournisseur extends Product
|
||||
|
||||
$this->db = $db;
|
||||
$langs->load("suppliers");
|
||||
$this->reputations= array('-1'=>'', 'FAVORITE'=>$langs->trans('Favorite'),'NOTTHGOOD'=>$langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER'=>$langs->trans('DoNotOrderThisProductToThisSupplier'));
|
||||
$this->reputations = array('-1'=>'', 'FAVORITE'=>$langs->trans('Favorite'), 'NOTTHGOOD'=>$langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER'=>$langs->trans('DoNotOrderThisProductToThisSupplier'));
|
||||
}
|
||||
|
||||
|
||||
@@ -129,19 +129,19 @@ class ProductFournisseur extends Product
|
||||
public function remove_fournisseur($id_fourn)
|
||||
{
|
||||
// phpcs:enable
|
||||
$ok=1;
|
||||
$ok = 1;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price";
|
||||
$sql.= " WHERE fk_product = ".$this->id." AND fk_soc = ".$id_fourn;
|
||||
$sql .= " WHERE fk_product = ".$this->id." AND fk_soc = ".$id_fourn;
|
||||
|
||||
dol_syslog(get_class($this)."::remove_fournisseur", LOG_DEBUG);
|
||||
$resql2=$this->db->query($sql);
|
||||
if (! $resql2)
|
||||
$resql2 = $this->db->query($sql);
|
||||
if (!$resql2)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$ok=0;
|
||||
$this->error = $this->db->lasterror();
|
||||
$ok = 0;
|
||||
}
|
||||
|
||||
if ($ok)
|
||||
@@ -169,25 +169,25 @@ class ProductFournisseur extends Product
|
||||
// phpcs:enable
|
||||
global $conf, $user;
|
||||
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('SUPPLIER_PRODUCT_BUYPRICE_DELETE', $user);
|
||||
$result = $this->call_trigger('SUPPLIER_PRODUCT_BUYPRICE_DELETE', $user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
|
||||
if (empty($error))
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price";
|
||||
$sql.= " WHERE rowid = ".$rowid;
|
||||
$sql .= " WHERE rowid = ".$rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::remove_product_fournisseur_price", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->error = $this->db->lasterror();
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@@ -238,66 +238,66 @@ class ProductFournisseur extends Product
|
||||
//global $mysoc;
|
||||
|
||||
// Clean parameter
|
||||
if (empty($qty)) $qty=0;
|
||||
if (empty($buyprice)) $buyprice=0;
|
||||
if (empty($charges)) $charges=0;
|
||||
if (empty($availability)) $availability=0;
|
||||
if (empty($remise_percent)) $remise_percent=0;
|
||||
if (empty($supplier_reputation) || $supplier_reputation == -1) $supplier_reputation='';
|
||||
if ($delivery_time_days != '' && ! is_numeric($delivery_time_days)) $delivery_time_days = '';
|
||||
if (empty($qty)) $qty = 0;
|
||||
if (empty($buyprice)) $buyprice = 0;
|
||||
if (empty($charges)) $charges = 0;
|
||||
if (empty($availability)) $availability = 0;
|
||||
if (empty($remise_percent)) $remise_percent = 0;
|
||||
if (empty($supplier_reputation) || $supplier_reputation == -1) $supplier_reputation = '';
|
||||
if ($delivery_time_days != '' && !is_numeric($delivery_time_days)) $delivery_time_days = '';
|
||||
if ($price_base_type == 'TTC')
|
||||
{
|
||||
$ttx = $tva_tx;
|
||||
$buyprice = $buyprice/(1+($ttx/100));
|
||||
$buyprice = $buyprice / (1 + ($ttx / 100));
|
||||
}
|
||||
|
||||
// Multicurrency
|
||||
if ($conf->multicurrency->enabled) {
|
||||
if (empty($multicurrency_tx)) $multicurrency_tx=1;
|
||||
if (empty($multicurrency_buyprice)) $multicurrency_buyprice=0;
|
||||
if (empty($multicurrency_tx)) $multicurrency_tx = 1;
|
||||
if (empty($multicurrency_buyprice)) $multicurrency_buyprice = 0;
|
||||
|
||||
if (empty($multicurrency_buyprice)) $multicurrency_buyprice=0;
|
||||
if (empty($multicurrency_buyprice)) $multicurrency_buyprice = 0;
|
||||
if ($multicurrency_price_base_type == 'TTC')
|
||||
{
|
||||
$ttx = $tva_tx;
|
||||
$multicurrency_buyprice = $multicurrency_buyprice/(1+($ttx/100));
|
||||
$multicurrency_buyprice = $multicurrency_buyprice / (1 + ($ttx / 100));
|
||||
}
|
||||
$multicurrency_buyprice=price2num($multicurrency_buyprice, 'MU');
|
||||
$multicurrency_unitBuyPrice=price2num($multicurrency_buyprice/$qty, 'MU');
|
||||
$multicurrency_buyprice = price2num($multicurrency_buyprice, 'MU');
|
||||
$multicurrency_unitBuyPrice = price2num($multicurrency_buyprice / $qty, 'MU');
|
||||
|
||||
$buyprice=$multicurrency_buyprice/$multicurrency_tx;
|
||||
$buyprice = $multicurrency_buyprice / $multicurrency_tx;
|
||||
$fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $multicurrency_code);
|
||||
}
|
||||
|
||||
$buyprice=price2num($buyprice, 'MU');
|
||||
$charges=price2num($charges, 'MU');
|
||||
$qty=price2num($qty, 'MS');
|
||||
$unitBuyPrice = price2num($buyprice/$qty, 'MU');
|
||||
$buyprice = price2num($buyprice, 'MU');
|
||||
$charges = price2num($charges, 'MU');
|
||||
$qty = price2num($qty, 'MS');
|
||||
$unitBuyPrice = price2num($buyprice / $qty, 'MU');
|
||||
|
||||
$error=0;
|
||||
$now=dol_now();
|
||||
$error = 0;
|
||||
$now = dol_now();
|
||||
|
||||
$newvat = $tva_tx;
|
||||
|
||||
if (count($localtaxes_array) > 0)
|
||||
{
|
||||
$localtaxtype1=$localtaxes_array['0'];
|
||||
$localtax1=$localtaxes_array['1'];
|
||||
$localtaxtype2=$localtaxes_array['2'];
|
||||
$localtax2=$localtaxes_array['3'];
|
||||
$localtaxtype1 = $localtaxes_array['0'];
|
||||
$localtax1 = $localtaxes_array['1'];
|
||||
$localtaxtype2 = $localtaxes_array['2'];
|
||||
$localtax2 = $localtaxes_array['3'];
|
||||
}
|
||||
else // old method. deprecated because ot can't retreive type
|
||||
{
|
||||
$localtaxtype1='0';
|
||||
$localtax1=get_localtax($newvat, 1);
|
||||
$localtaxtype2='0';
|
||||
$localtax2=get_localtax($newvat, 2);
|
||||
$localtaxtype1 = '0';
|
||||
$localtax1 = get_localtax($newvat, 1);
|
||||
$localtaxtype2 = '0';
|
||||
$localtax2 = get_localtax($newvat, 2);
|
||||
}
|
||||
if (empty($localtax1)) $localtax1=0; // If = '' then = 0
|
||||
if (empty($localtax2)) $localtax2=0; // If = '' then = 0
|
||||
if (empty($localtax1)) $localtax1 = 0; // If = '' then = 0
|
||||
if (empty($localtax2)) $localtax2 = 0; // If = '' then = 0
|
||||
|
||||
// Check parameters
|
||||
if ($buyprice != '' && ! is_numeric($buyprice))
|
||||
if ($buyprice != '' && !is_numeric($buyprice))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ class ProductFournisseur extends Product
|
||||
if (is_array($logPrices) && count($logPrices) == 0)
|
||||
{
|
||||
$currentPfp = new self($this->db);
|
||||
$result = $currentPfp->fetch_product_fournisseur_price($this->product_fourn_price_id);
|
||||
$result = $currentPfp->fetch_product_fournisseur_price($this->product_fourn_price_id);
|
||||
if ($result > 0 && $currentPfp->fourn_price != 0)
|
||||
{
|
||||
$currentPfpUser = new User($this->db);
|
||||
@@ -331,35 +331,35 @@ class ProductFournisseur extends Product
|
||||
}
|
||||
}
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price";
|
||||
$sql.= " SET fk_user = " . $user->id." ,";
|
||||
$sql.= " ref_fourn = '" . $this->db->escape($ref_fourn) . "',";
|
||||
$sql.= " desc_fourn = '" . $this->db->escape($desc_fourn) . "',";
|
||||
$sql.= " price = ".$buyprice.",";
|
||||
$sql.= " quantity = ".$qty.",";
|
||||
$sql.= " remise_percent = ".$remise_percent.",";
|
||||
$sql.= " remise = ".$remise.",";
|
||||
$sql.= " unitprice = ".$unitBuyPrice.",";
|
||||
$sql.= " fk_availability = ".$availability.",";
|
||||
$sql.= " multicurrency_price = ".(isset($multicurrency_buyprice)?"'".$this->db->escape(price2num($multicurrency_buyprice))."'":'null').",";
|
||||
$sql.= " multicurrency_unitprice = ".(isset($multicurrency_unitBuyPrice)?"'".$this->db->escape(price2num($multicurrency_unitBuyPrice))."'":'null').",";
|
||||
$sql.= " multicurrency_tx = ".(isset($multicurrency_tx)?"'".$this->db->escape($multicurrency_tx)."'":'1').",";
|
||||
$sql.= " fk_multicurrency = ".(isset($fk_multicurrency)?"'".$this->db->escape($fk_multicurrency)."'":'null').",";
|
||||
$sql.= " multicurrency_code = ".(isset($multicurrency_code)?"'".$this->db->escape($multicurrency_code)."'":'null').",";
|
||||
$sql.= " entity = ".$conf->entity.",";
|
||||
$sql.= " tva_tx = ".price2num($tva_tx).",";
|
||||
$sql .= " SET fk_user = ".$user->id." ,";
|
||||
$sql .= " ref_fourn = '".$this->db->escape($ref_fourn)."',";
|
||||
$sql .= " desc_fourn = '".$this->db->escape($desc_fourn)."',";
|
||||
$sql .= " price = ".$buyprice.",";
|
||||
$sql .= " quantity = ".$qty.",";
|
||||
$sql .= " remise_percent = ".$remise_percent.",";
|
||||
$sql .= " remise = ".$remise.",";
|
||||
$sql .= " unitprice = ".$unitBuyPrice.",";
|
||||
$sql .= " fk_availability = ".$availability.",";
|
||||
$sql .= " multicurrency_price = ".(isset($multicurrency_buyprice) ? "'".$this->db->escape(price2num($multicurrency_buyprice))."'" : 'null').",";
|
||||
$sql .= " multicurrency_unitprice = ".(isset($multicurrency_unitBuyPrice) ? "'".$this->db->escape(price2num($multicurrency_unitBuyPrice))."'" : 'null').",";
|
||||
$sql .= " multicurrency_tx = ".(isset($multicurrency_tx) ? "'".$this->db->escape($multicurrency_tx)."'" : '1').",";
|
||||
$sql .= " fk_multicurrency = ".(isset($fk_multicurrency) ? "'".$this->db->escape($fk_multicurrency)."'" : 'null').",";
|
||||
$sql .= " multicurrency_code = ".(isset($multicurrency_code) ? "'".$this->db->escape($multicurrency_code)."'" : 'null').",";
|
||||
$sql .= " entity = ".$conf->entity.",";
|
||||
$sql .= " tva_tx = ".price2num($tva_tx).",";
|
||||
// TODO Add localtax1 and localtax2
|
||||
//$sql.= " localtax1_tx=".($localtax1>=0?$localtax1:'NULL').",";
|
||||
//$sql.= " localtax2_tx=".($localtax2>=0?$localtax2:'NULL').",";
|
||||
//$sql.= " localtax1_type=".($localtaxtype1!=''?"'".$localtaxtype1."'":"'0'").",";
|
||||
//$sql.= " localtax2_type=".($localtaxtype2!=''?"'".$localtaxtype2."'":"'0'").",";
|
||||
$sql.= " default_vat_code=".($newdefaultvatcode?"'".$this->db->escape($newdefaultvatcode)."'":"null").",";
|
||||
$sql.= " info_bits = ".$newnpr.",";
|
||||
$sql.= " charges = ".$charges.","; // deprecated
|
||||
$sql.= " delivery_time_days = ".($delivery_time_days != '' ? $delivery_time_days : 'null').",";
|
||||
$sql.= " supplier_reputation = ".(empty($supplier_reputation) ? 'NULL' : "'".$this->db->escape($supplier_reputation)."'").",";
|
||||
$sql.= " barcode = ".(empty($barcode) ? 'NULL' : "'".$this->db->escape($barcode)."'").",";
|
||||
$sql.= " fk_barcode_type = ".(empty($fk_barcode_type) ? 'NULL' : "'".$this->db->escape($fk_barcode_type)."'");
|
||||
$sql.= " WHERE rowid = ".$this->product_fourn_price_id;
|
||||
$sql .= " default_vat_code=".($newdefaultvatcode ? "'".$this->db->escape($newdefaultvatcode)."'" : "null").",";
|
||||
$sql .= " info_bits = ".$newnpr.",";
|
||||
$sql .= " charges = ".$charges.","; // deprecated
|
||||
$sql .= " delivery_time_days = ".($delivery_time_days != '' ? $delivery_time_days : 'null').",";
|
||||
$sql .= " supplier_reputation = ".(empty($supplier_reputation) ? 'NULL' : "'".$this->db->escape($supplier_reputation)."'").",";
|
||||
$sql .= " barcode = ".(empty($barcode) ? 'NULL' : "'".$this->db->escape($barcode)."'").",";
|
||||
$sql .= " fk_barcode_type = ".(empty($fk_barcode_type) ? 'NULL' : "'".$this->db->escape($fk_barcode_type)."'");
|
||||
$sql .= " WHERE rowid = ".$this->product_fourn_price_id;
|
||||
// TODO Add price_base_type and price_ttc
|
||||
|
||||
dol_syslog(get_class($this).'::update_buyprice update knowing id of line = product_fourn_price_id = '.$this->product_fourn_price_id, LOG_DEBUG);
|
||||
@@ -367,10 +367,10 @@ class ProductFournisseur extends Product
|
||||
if ($resql)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('SUPPLIER_PRODUCT_BUYPRICE_UPDATE', $user);
|
||||
$result = $this->call_trigger('SUPPLIER_PRODUCT_BUYPRICE_UPDATE', $user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
if (! $error && empty($conf->global->PRODUCT_PRICE_SUPPLIER_NO_LOG))
|
||||
if (!$error && empty($conf->global->PRODUCT_PRICE_SUPPLIER_NO_LOG))
|
||||
{
|
||||
$result = $this->logPrice($user, $now, $buyprice, $qty, $multicurrency_buyprice, $multicurrency_unitBuyPrice, $multicurrency_tx, $fk_multicurrency, $multicurrency_code);
|
||||
if ($result < 0) {
|
||||
@@ -390,7 +390,7 @@ class ProductFournisseur extends Product
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error()." sql=".$sql;
|
||||
$this->error = $this->db->error()." sql=".$sql;
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
@@ -398,57 +398,57 @@ class ProductFournisseur extends Product
|
||||
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this) . '::update_buyprice without knowing id of line, so we delete from company, quantity and supplier_ref and insert again', LOG_DEBUG);
|
||||
dol_syslog(get_class($this).'::update_buyprice without knowing id of line, so we delete from company, quantity and supplier_ref and insert again', LOG_DEBUG);
|
||||
|
||||
// Delete price for this quantity
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "product_fournisseur_price";
|
||||
$sql .= " WHERE fk_soc = " . $fourn->id . " AND ref_fourn = '" . $this->db->escape($ref_fourn) . "' AND quantity = " . $qty . " AND entity = " . $conf->entity;
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price";
|
||||
$sql .= " WHERE fk_soc = ".$fourn->id." AND ref_fourn = '".$this->db->escape($ref_fourn)."' AND quantity = ".$qty." AND entity = ".$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
// Add price for this quantity to supplier
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_fournisseur_price(";
|
||||
$sql.= " multicurrency_price, multicurrency_unitprice, multicurrency_tx, fk_multicurrency, multicurrency_code,";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price(";
|
||||
$sql .= " multicurrency_price, multicurrency_unitprice, multicurrency_tx, fk_multicurrency, multicurrency_code,";
|
||||
$sql .= "datec, fk_product, fk_soc, ref_fourn, desc_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, fk_availability, default_vat_code, info_bits, entity, delivery_time_days, supplier_reputation, barcode, fk_barcode_type)";
|
||||
$sql .= " values(";
|
||||
$sql.= (isset($multicurrency_buyprice)?"'".$this->db->escape(price2num($multicurrency_buyprice))."'":'null').",";
|
||||
$sql.= (isset($multicurrency_unitBuyPrice)?"'".$this->db->escape(price2num($multicurrency_unitBuyPrice))."'":'null').",";
|
||||
$sql.= (isset($multicurrency_tx)?"'".$this->db->escape($multicurrency_tx)."'":'1').",";
|
||||
$sql.= (isset($fk_multicurrency)?"'".$this->db->escape($fk_multicurrency)."'":'null').",";
|
||||
$sql.= (isset($multicurrency_code)?"'".$this->db->escape($multicurrency_code)."'":'null').",";
|
||||
$sql .= " '" . $this->db->idate($now) . "',";
|
||||
$sql .= " " . $this->id . ",";
|
||||
$sql .= " " . $fourn->id . ",";
|
||||
$sql .= " '" . $this->db->escape($ref_fourn) . "',";
|
||||
$sql .= " '" . $this->db->escape($desc_fourn) . "',";
|
||||
$sql .= " " . $user->id . ",";
|
||||
$sql .= " " . $buyprice . ",";
|
||||
$sql .= " " . $qty . ",";
|
||||
$sql .= " " . $remise_percent . ",";
|
||||
$sql .= " " . $remise . ",";
|
||||
$sql .= " " . $unitBuyPrice . ",";
|
||||
$sql .= " " . $tva_tx . ",";
|
||||
$sql .= " " . $charges . ",";
|
||||
$sql .= " " . $availability . ",";
|
||||
$sql .= " ".($newdefaultvatcode?"'".$this->db->escape($newdefaultvatcode)."'":"null").",";
|
||||
$sql .= " " . $newnpr . ",";
|
||||
$sql .= $conf->entity . ",";
|
||||
$sql .= $delivery_time_days . ",";
|
||||
$sql .= (empty($supplier_reputation) ? 'NULL' : "'" . $this->db->escape($supplier_reputation) . "'") . ",";
|
||||
$sql .= (empty($barcode) ? 'NULL' : "'" . $this->db->escape($barcode) . "'") . ",";
|
||||
$sql .= (empty($fk_barcode_type) ? 'NULL' : "'" . $this->db->escape($fk_barcode_type) . "'");
|
||||
$sql .= (isset($multicurrency_buyprice) ? "'".$this->db->escape(price2num($multicurrency_buyprice))."'" : 'null').",";
|
||||
$sql .= (isset($multicurrency_unitBuyPrice) ? "'".$this->db->escape(price2num($multicurrency_unitBuyPrice))."'" : 'null').",";
|
||||
$sql .= (isset($multicurrency_tx) ? "'".$this->db->escape($multicurrency_tx)."'" : '1').",";
|
||||
$sql .= (isset($fk_multicurrency) ? "'".$this->db->escape($fk_multicurrency)."'" : 'null').",";
|
||||
$sql .= (isset($multicurrency_code) ? "'".$this->db->escape($multicurrency_code)."'" : 'null').",";
|
||||
$sql .= " '".$this->db->idate($now)."',";
|
||||
$sql .= " ".$this->id.",";
|
||||
$sql .= " ".$fourn->id.",";
|
||||
$sql .= " '".$this->db->escape($ref_fourn)."',";
|
||||
$sql .= " '".$this->db->escape($desc_fourn)."',";
|
||||
$sql .= " ".$user->id.",";
|
||||
$sql .= " ".$buyprice.",";
|
||||
$sql .= " ".$qty.",";
|
||||
$sql .= " ".$remise_percent.",";
|
||||
$sql .= " ".$remise.",";
|
||||
$sql .= " ".$unitBuyPrice.",";
|
||||
$sql .= " ".$tva_tx.",";
|
||||
$sql .= " ".$charges.",";
|
||||
$sql .= " ".$availability.",";
|
||||
$sql .= " ".($newdefaultvatcode ? "'".$this->db->escape($newdefaultvatcode)."'" : "null").",";
|
||||
$sql .= " ".$newnpr.",";
|
||||
$sql .= $conf->entity.",";
|
||||
$sql .= $delivery_time_days.",";
|
||||
$sql .= (empty($supplier_reputation) ? 'NULL' : "'".$this->db->escape($supplier_reputation)."'").",";
|
||||
$sql .= (empty($barcode) ? 'NULL' : "'".$this->db->escape($barcode)."'").",";
|
||||
$sql .= (empty($fk_barcode_type) ? 'NULL' : "'".$this->db->escape($fk_barcode_type)."'");
|
||||
$sql .= ")";
|
||||
|
||||
$idinserted = 0;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$idinserted = $this->db->last_insert_id(MAIN_DB_PREFIX . "product_fournisseur_price");
|
||||
$idinserted = $this->db->last_insert_id(MAIN_DB_PREFIX."product_fournisseur_price");
|
||||
}
|
||||
else {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error && empty($conf->global->PRODUCT_PRICE_SUPPLIER_NO_LOG)) {
|
||||
if (!$error && empty($conf->global->PRODUCT_PRICE_SUPPLIER_NO_LOG)) {
|
||||
// Add record into log table
|
||||
$result = $this->logPrice($user, $now, $buyprice, $qty, $multicurrency_buyprice, $multicurrency_unitBuyPrice, $multicurrency_tx, $fk_multicurrenc, $multicurrency_code);
|
||||
if ($result < 0) {
|
||||
@@ -456,7 +456,7 @@ class ProductFournisseur extends Product
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
if (!$error) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('SUPPLIER_PRODUCT_BUYPRICE_CREATE', $user);
|
||||
if ($result < 0)
|
||||
@@ -472,14 +472,14 @@ class ProductFournisseur extends Product
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
$this->error = $this->db->lasterror() . " sql=" . $sql;
|
||||
$this->error = $this->db->lasterror()." sql=".$sql;
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
} else {
|
||||
$this->error = $this->db->lasterror() . " sql=" . $sql;
|
||||
$this->error = $this->db->lasterror()." sql=".$sql;
|
||||
$this->db->rollback();
|
||||
return - 1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -498,12 +498,12 @@ class ProductFournisseur extends Product
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT pfp.rowid, pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.default_vat_code, pfp.info_bits as fourn_tva_npr, pfp.fk_availability,";
|
||||
$sql.= " pfp.fk_soc, pfp.ref_fourn, pfp.desc_fourn, pfp.fk_product, pfp.charges, pfp.fk_supplier_price_expression, pfp.delivery_time_days,";
|
||||
$sql.= " pfp.supplier_reputation, pfp.fk_user, pfp.datec,";
|
||||
$sql.= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code,";
|
||||
$sql.=" pfp.barcode, pfp.fk_barcode_type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||
$sql.= " WHERE pfp.rowid = ".$rowid;
|
||||
$sql .= " pfp.fk_soc, pfp.ref_fourn, pfp.desc_fourn, pfp.fk_product, pfp.charges, pfp.fk_supplier_price_expression, pfp.delivery_time_days,";
|
||||
$sql .= " pfp.supplier_reputation, pfp.fk_user, pfp.datec,";
|
||||
$sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code,";
|
||||
$sql .= " pfp.barcode, pfp.fk_barcode_type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||
$sql .= " WHERE pfp.rowid = ".(int) $rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch_product_fournisseur_price", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@@ -512,16 +512,16 @@ class ProductFournisseur extends Product
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$this->product_fourn_price_id = $rowid;
|
||||
$this->id = $obj->fk_product;
|
||||
$this->product_fourn_price_id = $rowid;
|
||||
$this->id = $obj->fk_product;
|
||||
$this->fk_product = $obj->fk_product;
|
||||
$this->product_id = $obj->fk_product; // deprecated
|
||||
$this->product_id = $obj->fk_product; // deprecated
|
||||
$this->fourn_id = $obj->fk_soc;
|
||||
$this->fourn_ref = $obj->ref_fourn; // deprecated
|
||||
$this->ref_supplier = $obj->ref_fourn;
|
||||
$this->desc_supplier = $obj->desc_fourn;
|
||||
$this->fourn_price = $obj->price;
|
||||
$this->fourn_charges = $obj->charges; // deprecated
|
||||
$this->fourn_price = $obj->price;
|
||||
$this->fourn_charges = $obj->charges; // deprecated
|
||||
$this->fourn_qty = $obj->quantity;
|
||||
$this->fourn_remise_percent = $obj->remise_percent;
|
||||
$this->fourn_remise = $obj->remise;
|
||||
@@ -529,9 +529,9 @@ class ProductFournisseur extends Product
|
||||
$this->fourn_tva_tx = $obj->tva_tx;
|
||||
$this->fourn_tva_npr = $obj->fourn_tva_npr;
|
||||
// Add also localtaxes
|
||||
$this->fk_availability = $obj->fk_availability;
|
||||
$this->delivery_time_days = $obj->delivery_time_days;
|
||||
$this->fk_supplier_price_expression = $obj->fk_supplier_price_expression;
|
||||
$this->fk_availability = $obj->fk_availability;
|
||||
$this->delivery_time_days = $obj->delivery_time_days;
|
||||
$this->fk_supplier_price_expression = $obj->fk_supplier_price_expression;
|
||||
$this->supplier_reputation = $obj->supplier_reputation;
|
||||
$this->default_vat_code = $obj->default_vat_code;
|
||||
$this->user_id = $obj->fk_user;
|
||||
@@ -541,7 +541,7 @@ class ProductFournisseur extends Product
|
||||
$this->fourn_multicurrency_tx = $obj->multicurrency_tx;
|
||||
$this->fourn_multicurrency_id = $obj->fk_multicurrency;
|
||||
$this->fourn_multicurrency_code = $obj->multicurrency_code;
|
||||
if($conf->barcode->enabled) {
|
||||
if ($conf->barcode->enabled) {
|
||||
$this->fourn_barcode = $obj->barcode;
|
||||
$this->fourn_fk_barcode_type = $obj->fk_barcode_type;
|
||||
}
|
||||
@@ -552,13 +552,13 @@ class ProductFournisseur extends Product
|
||||
if ($price_result >= 0) {
|
||||
$this->fourn_price = $price_result;
|
||||
//recalculation of unitprice, as probably the price changed...
|
||||
if ($this->fourn_qty!=0)
|
||||
if ($this->fourn_qty != 0)
|
||||
{
|
||||
$this->fourn_unitprice = price2num($this->fourn_price/$this->fourn_qty, 'MU');
|
||||
$this->fourn_unitprice = price2num($this->fourn_price / $this->fourn_qty, 'MU');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->fourn_unitprice="";
|
||||
$this->fourn_unitprice = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -572,7 +572,7 @@ class ProductFournisseur extends Product
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error = $this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -595,18 +595,18 @@ class ProductFournisseur extends Product
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,";
|
||||
$sql.= " pfp.rowid as product_fourn_pri_id, pfp.ref_fourn, pfp.desc_fourn, pfp.fk_product as product_fourn_id, pfp.fk_supplier_price_expression,";
|
||||
$sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.info_bits, pfp.delivery_time_days, pfp.supplier_reputation,";
|
||||
$sql.= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code, pfp.datec, pfp.tms,";
|
||||
$sql.= " pfp.barcode, pfp.fk_barcode_type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp, ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")";
|
||||
$sql.= " AND pfp.fk_soc = s.rowid";
|
||||
$sql.= " AND s.status=1"; // only enabled company selected
|
||||
$sql.= " AND pfp.fk_product = ".$prodid;
|
||||
if (empty($sortfield)) $sql.= " ORDER BY s.nom, pfp.quantity, pfp.price";
|
||||
else $sql.= $this->db->order($sortfield, $sortorder);
|
||||
$sql.=$this->db->plimit($limit, $offset);
|
||||
$sql .= " pfp.rowid as product_fourn_pri_id, pfp.ref_fourn, pfp.desc_fourn, pfp.fk_product as product_fourn_id, pfp.fk_supplier_price_expression,";
|
||||
$sql .= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.info_bits, pfp.delivery_time_days, pfp.supplier_reputation,";
|
||||
$sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code, pfp.datec, pfp.tms,";
|
||||
$sql .= " pfp.barcode, pfp.fk_barcode_type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp, ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")";
|
||||
$sql .= " AND pfp.fk_soc = s.rowid";
|
||||
$sql .= " AND s.status=1"; // only enabled company selected
|
||||
$sql .= " AND pfp.fk_product = ".$prodid;
|
||||
if (empty($sortfield)) $sql .= " ORDER BY s.nom, pfp.quantity, pfp.price";
|
||||
else $sql .= $this->db->order($sortfield, $sortorder);
|
||||
$sql .= $this->db->plimit($limit, $offset);
|
||||
dol_syslog(get_class($this)."::list_product_fournisseur_price", LOG_DEBUG);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@@ -619,26 +619,26 @@ class ProductFournisseur extends Product
|
||||
//define base attribute
|
||||
$prodfourn = new ProductFournisseur($this->db);
|
||||
|
||||
$prodfourn->product_fourn_price_id = $record["product_fourn_pri_id"];
|
||||
$prodfourn->product_fourn_id = $record["product_fourn_id"];
|
||||
$prodfourn->fourn_ref = $record["ref_fourn"];
|
||||
$prodfourn->product_fourn_price_id = $record["product_fourn_pri_id"];
|
||||
$prodfourn->product_fourn_id = $record["product_fourn_id"];
|
||||
$prodfourn->fourn_ref = $record["ref_fourn"];
|
||||
$prodfourn->ref_supplier = $record["ref_fourn"];
|
||||
$prodfourn->desc_supplier = $record["desc_fourn"];
|
||||
$prodfourn->desc_supplier = $record["desc_fourn"];
|
||||
$prodfourn->fourn_price = $record["price"];
|
||||
$prodfourn->fourn_qty = $record["quantity"];
|
||||
$prodfourn->fourn_remise_percent = $record["remise_percent"];
|
||||
$prodfourn->fourn_remise = $record["remise"];
|
||||
$prodfourn->fourn_unitprice = $record["unitprice"];
|
||||
$prodfourn->fourn_charges = $record["charges"]; // deprecated
|
||||
$prodfourn->fourn_tva_tx = $record["tva_tx"];
|
||||
$prodfourn->fourn_qty = $record["quantity"];
|
||||
$prodfourn->fourn_remise_percent = $record["remise_percent"];
|
||||
$prodfourn->fourn_remise = $record["remise"];
|
||||
$prodfourn->fourn_unitprice = $record["unitprice"];
|
||||
$prodfourn->fourn_charges = $record["charges"]; // deprecated
|
||||
$prodfourn->fourn_tva_tx = $record["tva_tx"];
|
||||
$prodfourn->fourn_id = $record["fourn_id"];
|
||||
$prodfourn->fourn_name = $record["supplier_name"];
|
||||
$prodfourn->fourn_name = $record["supplier_name"];
|
||||
$prodfourn->fk_availability = $record["fk_availability"];
|
||||
$prodfourn->delivery_time_days = $record["delivery_time_days"];
|
||||
$prodfourn->id = $prodid;
|
||||
$prodfourn->fourn_tva_npr = $record["info_bits"];
|
||||
$prodfourn->fk_supplier_price_expression = $record["fk_supplier_price_expression"];
|
||||
$prodfourn->supplier_reputation = $record["supplier_reputation"];
|
||||
$prodfourn->fk_supplier_price_expression = $record["fk_supplier_price_expression"];
|
||||
$prodfourn->supplier_reputation = $record["supplier_reputation"];
|
||||
$prodfourn->fourn_date_creation = $this->db->jdate($record['datec']);
|
||||
$prodfourn->fourn_date_modification = $this->db->jdate($record['tms']);
|
||||
|
||||
@@ -648,9 +648,9 @@ class ProductFournisseur extends Product
|
||||
$prodfourn->fourn_multicurrency_id = $record["fk_multicurrency"];
|
||||
$prodfourn->fourn_multicurrency_code = $record["multicurrency_code"];
|
||||
|
||||
if($conf->barcode->enabled){
|
||||
$prodfourn->barcode = $record["barcode"];
|
||||
$prodfourn->fk_barcode_type = $record["fk_barcode_type"];
|
||||
if ($conf->barcode->enabled) {
|
||||
$prodfourn->barcode = $record["barcode"];
|
||||
$prodfourn->fk_barcode_type = $record["fk_barcode_type"];
|
||||
}
|
||||
|
||||
if (!empty($conf->dynamicprices->enabled) && !empty($prodfourn->fk_supplier_price_expression)) {
|
||||
@@ -664,17 +664,17 @@ class ProductFournisseur extends Product
|
||||
|
||||
if (!isset($prodfourn->fourn_unitprice))
|
||||
{
|
||||
if ($prodfourn->fourn_qty!=0)
|
||||
if ($prodfourn->fourn_qty != 0)
|
||||
{
|
||||
$prodfourn->fourn_unitprice = price2num($prodfourn->fourn_price/$prodfourn->fourn_qty, 'MU');
|
||||
$prodfourn->fourn_unitprice = price2num($prodfourn->fourn_price / $prodfourn->fourn_qty, 'MU');
|
||||
}
|
||||
else
|
||||
{
|
||||
$prodfourn->fourn_unitprice="";
|
||||
$prodfourn->fourn_unitprice = "";
|
||||
}
|
||||
}
|
||||
|
||||
$retarray[]=$prodfourn;
|
||||
$retarray[] = $prodfourn;
|
||||
}
|
||||
|
||||
$this->db->free($resql);
|
||||
@@ -682,7 +682,7 @@ class ProductFournisseur extends Product
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error = $this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -717,7 +717,7 @@ class ProductFournisseur extends Product
|
||||
$this->fourn_unitprice = '';
|
||||
$this->fourn_id = '';
|
||||
$this->fourn_name = '';
|
||||
$this->delivery_time_days = '';
|
||||
$this->delivery_time_days = '';
|
||||
$this->id = '';
|
||||
|
||||
$this->fourn_multicurrency_price = '';
|
||||
@@ -727,18 +727,18 @@ class ProductFournisseur extends Product
|
||||
$this->fourn_multicurrency_code = '';
|
||||
|
||||
$sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,";
|
||||
$sql.= " pfp.rowid as product_fourn_price_id, pfp.ref_fourn,";
|
||||
$sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.tva_tx, pfp.charges,";
|
||||
$sql.= " pfp.remise, pfp.remise_percent, pfp.fk_supplier_price_expression, pfp.delivery_time_days";
|
||||
$sql.= " ,pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||
$sql.= " WHERE s.entity IN (".getEntity('societe').")";
|
||||
$sql.= " AND pfp.entity = ".$conf->entity; // only current entity
|
||||
$sql.= " AND pfp.fk_product = ".$prodid;
|
||||
$sql.= " AND pfp.fk_soc = s.rowid";
|
||||
$sql.= " AND s.status = 1"; // only enabled society
|
||||
if ($qty > 0) $sql.= " AND pfp.quantity <= ".$qty;
|
||||
if ($socid > 0) $sql.= ' AND pfp.fk_soc = '.$socid;
|
||||
$sql .= " pfp.rowid as product_fourn_price_id, pfp.ref_fourn,";
|
||||
$sql .= " pfp.price, pfp.quantity, pfp.unitprice, pfp.tva_tx, pfp.charges,";
|
||||
$sql .= " pfp.remise, pfp.remise_percent, pfp.fk_supplier_price_expression, pfp.delivery_time_days";
|
||||
$sql .= " ,pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||
$sql .= " WHERE s.entity IN (".getEntity('societe').")";
|
||||
$sql .= " AND pfp.entity = ".$conf->entity; // only current entity
|
||||
$sql .= " AND pfp.fk_product = ".$prodid;
|
||||
$sql .= " AND pfp.fk_soc = s.rowid";
|
||||
$sql .= " AND s.status = 1"; // only enabled society
|
||||
if ($qty > 0) $sql .= " AND pfp.quantity <= ".$qty;
|
||||
if ($socid > 0) $sql .= ' AND pfp.fk_soc = '.$socid;
|
||||
|
||||
dol_syslog(get_class($this)."::find_min_price_product_fournisseur", LOG_DEBUG);
|
||||
|
||||
@@ -750,7 +750,7 @@ class ProductFournisseur extends Product
|
||||
//Store each record to array for later search of min
|
||||
while ($record = $this->db->fetch_array($resql))
|
||||
{
|
||||
$record_array[]=$record;
|
||||
$record_array[] = $record;
|
||||
}
|
||||
|
||||
if (count($record_array) == 0)
|
||||
@@ -761,7 +761,7 @@ class ProductFournisseur extends Product
|
||||
else
|
||||
{
|
||||
$min = -1;
|
||||
foreach($record_array as $record)
|
||||
foreach ($record_array as $record)
|
||||
{
|
||||
$fourn_price = $record["price"];
|
||||
// discount calculated buy price
|
||||
@@ -779,7 +779,7 @@ class ProductFournisseur extends Product
|
||||
$fourn_price = price2num($price_result, 'MU');
|
||||
if ($record["quantity"] != 0)
|
||||
{
|
||||
$fourn_unitprice = price2num($fourn_price/$record["quantity"], 'MU');
|
||||
$fourn_unitprice = price2num($fourn_price / $record["quantity"], 'MU');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -791,19 +791,19 @@ class ProductFournisseur extends Product
|
||||
{
|
||||
$this->product_fourn_price_id = $record["product_fourn_price_id"];
|
||||
$this->ref_supplier = $record["ref_fourn"];
|
||||
$this->ref_fourn = $record["ref_fourn"]; // deprecated
|
||||
$this->fourn_ref = $record["ref_fourn"]; // deprecated
|
||||
$this->ref_fourn = $record["ref_fourn"]; // deprecated
|
||||
$this->fourn_ref = $record["ref_fourn"]; // deprecated
|
||||
$this->fourn_price = $fourn_price;
|
||||
$this->fourn_qty = $record["quantity"];
|
||||
$this->fourn_remise_percent = $record["remise_percent"];
|
||||
$this->fourn_remise = $record["remise"];
|
||||
$this->fourn_unitprice = $record["unitprice"];
|
||||
$this->fourn_charges = $record["charges"]; // deprecated
|
||||
$this->fourn_charges = $record["charges"]; // deprecated
|
||||
$this->fourn_tva_tx = $record["tva_tx"];
|
||||
$this->fourn_id = $record["fourn_id"];
|
||||
$this->fourn_name = $record["supplier_name"];
|
||||
$this->delivery_time_days = $record["delivery_time_days"];
|
||||
$this->fk_supplier_price_expression = $record["fk_supplier_price_expression"];
|
||||
$this->delivery_time_days = $record["delivery_time_days"];
|
||||
$this->fk_supplier_price_expression = $record["fk_supplier_price_expression"];
|
||||
$this->id = $prodid;
|
||||
$this->fourn_multicurrency_price = $record["multicurrency_price"];
|
||||
$this->fourn_multicurrency_unitprice = $record["multicurrency_unitprice"];
|
||||
@@ -820,7 +820,7 @@ class ProductFournisseur extends Product
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error = $this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -840,8 +840,8 @@ class ProductFournisseur extends Product
|
||||
$expression_id = $expression_id != 0 ? $expression_id : 'NULL';
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price";
|
||||
$sql.= " SET fk_supplier_price_expression = ".$expression_id;
|
||||
$sql.= " WHERE rowid = ".$this->product_fourn_price_id;
|
||||
$sql .= " SET fk_supplier_price_expression = ".$expression_id;
|
||||
$sql .= " WHERE rowid = ".$this->product_fourn_price_id;
|
||||
|
||||
dol_syslog(get_class($this)."::setSupplierPriceExpression", LOG_DEBUG);
|
||||
|
||||
@@ -853,7 +853,7 @@ class ProductFournisseur extends Product
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error()." sql=".$sql;
|
||||
$this->error = $this->db->error()." sql=".$sql;
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@@ -898,19 +898,19 @@ class ProductFournisseur extends Product
|
||||
$langs->load("suppliers");
|
||||
if (count($productFournList) > 0) {
|
||||
$out .= '<table class="nobordernopadding" width="100%">';
|
||||
$out .= '<tr><td class="liste_titre right">'.($showunitprice?$langs->trans("Price").' '.$langs->trans("HT"):'').'</td>';
|
||||
$out .= '<td class="liste_titre right">'.($showunitprice?$langs->trans("QtyMin"):'').'</td>';
|
||||
$out .= '<tr><td class="liste_titre right">'.($showunitprice ? $langs->trans("Price").' '.$langs->trans("HT") : '').'</td>';
|
||||
$out .= '<td class="liste_titre right">'.($showunitprice ? $langs->trans("QtyMin") : '').'</td>';
|
||||
$out .= '<td class="liste_titre">'.$langs->trans("Supplier").'</td>';
|
||||
$out .= '<td class="liste_titre">'.$langs->trans("SupplierRef").'</td></tr>';
|
||||
foreach ($productFournList as $productFourn) {
|
||||
$out.= '<tr><td class="right">'.($showunitprice?price($productFourn->fourn_unitprice * (1 -$productFourn->fourn_remise_percent/100) - $productFourn->fourn_remise):'').'</td>';
|
||||
$out.= '<td class="right">'.($showunitprice?$productFourn->fourn_qty:'').'</td>';
|
||||
$out.= '<td>'.$productFourn->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).'</td>';
|
||||
$out.= '<td>'.$productFourn->fourn_ref.'<td></tr>';
|
||||
$out .= '<tr><td class="right">'.($showunitprice ?price($productFourn->fourn_unitprice * (1 - $productFourn->fourn_remise_percent / 100) - $productFourn->fourn_remise) : '').'</td>';
|
||||
$out .= '<td class="right">'.($showunitprice ? $productFourn->fourn_qty : '').'</td>';
|
||||
$out .= '<td>'.$productFourn->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).'</td>';
|
||||
$out .= '<td>'.$productFourn->fourn_ref.'<td></tr>';
|
||||
}
|
||||
$out .= '</table>';
|
||||
} else {
|
||||
$out=($showunitprice?price($this->fourn_unitprice * (1 - $this->fourn_remise_percent/100) + $this->fourn_remise).' '.$langs->trans("HT").' (':'').($showsuptitle?$langs->trans("Supplier").': ':'').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.($showunitprice?')':'');
|
||||
$out = ($showunitprice ?price($this->fourn_unitprice * (1 - $this->fourn_remise_percent / 100) + $this->fourn_remise).' '.$langs->trans("HT").' (' : '').($showsuptitle ? $langs->trans("Supplier").': ' : '').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.($showunitprice ? ')' : '');
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
@@ -947,18 +947,18 @@ class ProductFournisseur extends Product
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql.= " pfpl.rowid, pfp.ref_fourn as supplier_ref, pfpl.datec, u.lastname,";
|
||||
$sql.= " pfpl.price, pfpl.quantity";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price_log as pfpl";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE pfp.entity IN (".getEntity('productprice').")";
|
||||
$sql.= " AND pfpl.fk_user = u.rowid";
|
||||
$sql.= " AND pfp.rowid = pfpl.fk_product_fournisseur";
|
||||
$sql.= " AND pfpl.fk_product_fournisseur = ".$product_fourn_price_id;
|
||||
if (empty($sortfield)) $sql.= " ORDER BY pfpl.datec";
|
||||
else $sql.= $this->db->order($sortfield, $sortorder);
|
||||
$sql.=$this->db->plimit($limit, $offset);
|
||||
$sql .= " pfpl.rowid, pfp.ref_fourn as supplier_ref, pfpl.datec, u.lastname,";
|
||||
$sql .= " pfpl.price, pfpl.quantity";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price_log as pfpl";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE pfp.entity IN (".getEntity('productprice').")";
|
||||
$sql .= " AND pfpl.fk_user = u.rowid";
|
||||
$sql .= " AND pfp.rowid = pfpl.fk_product_fournisseur";
|
||||
$sql .= " AND pfpl.fk_product_fournisseur = ".$product_fourn_price_id;
|
||||
if (empty($sortfield)) $sql .= " ORDER BY pfpl.datec";
|
||||
else $sql .= $this->db->order($sortfield, $sortorder);
|
||||
$sql .= $this->db->plimit($limit, $offset);
|
||||
dol_syslog(get_class($this)."::list_product_fournisseur_price_log", LOG_DEBUG);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@@ -968,7 +968,7 @@ class ProductFournisseur extends Product
|
||||
|
||||
while ($record = $this->db->fetch_array($resql))
|
||||
{
|
||||
$retarray[]=$record;
|
||||
$retarray[] = $record;
|
||||
}
|
||||
|
||||
$this->db->free($resql);
|
||||
@@ -976,7 +976,7 @@ class ProductFournisseur extends Product
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error = $this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -1001,10 +1001,10 @@ class ProductFournisseur extends Product
|
||||
//$out .= '<td class="liste_titre right">'.$langs->trans("QtyMin").'</td>';
|
||||
$out .= '<td class="liste_titre">'.$langs->trans("User").'</td></tr>';
|
||||
foreach ($productFournLogList as $productFournLog) {
|
||||
$out.= '<tr><td class="right">'.dol_print_date($this->db->jdate($productFournLog['datec']), 'dayhour', 'tzuser').'</td>';
|
||||
$out.= '<td class="right">'.price($productFournLog['price']).'</td>';
|
||||
$out .= '<tr><td class="right">'.dol_print_date($this->db->jdate($productFournLog['datec']), 'dayhour', 'tzuser').'</td>';
|
||||
$out .= '<td class="right">'.price($productFournLog['price']).'</td>';
|
||||
//$out.= '<td class="right">'.$productFournLog['quantity'].'</td>';
|
||||
$out.= '<td>'.$productFournLog['lastname'].'</td></tr>';
|
||||
$out .= '<td>'.$productFournLog['lastname'].'</td></tr>';
|
||||
}
|
||||
$out .= '</table>';
|
||||
}
|
||||
@@ -1027,19 +1027,19 @@ class ProductFournisseur extends Product
|
||||
{
|
||||
global $db, $conf, $langs;
|
||||
|
||||
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
|
||||
|
||||
$result = '';
|
||||
|
||||
$label = '<u>' . $langs->trans("SupplierRef") . '</u>';
|
||||
$label.= '<br>';
|
||||
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref_supplier;
|
||||
$label = '<u>'.$langs->trans("SupplierRef").'</u>';
|
||||
$label .= '<br>';
|
||||
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref_supplier;
|
||||
|
||||
$logPrices = $this->listProductFournisseurPriceLog($this->product_fourn_price_id, 'pfpl.datec', 'DESC'); // set sort order here
|
||||
if (is_array($logPrices) && count($logPrices) > 0) {
|
||||
$label.= '<br>';
|
||||
$label.= '<u>' . $langs->trans("History") . '</u>';
|
||||
$label.= $this->displayPriceProductFournisseurLog($logPrices);
|
||||
$label .= '<br>';
|
||||
$label .= '<u>'.$langs->trans("History").'</u>';
|
||||
$label .= $this->displayPriceProductFournisseurLog($logPrices);
|
||||
}
|
||||
|
||||
$url = dol_buildpath('/product/fournisseurs.php', 1).'?id='.$this->id.'&action=add_price&socid='.$this->fourn_id.'&rowid='.$this->product_fourn_price_id;
|
||||
@@ -1047,31 +1047,31 @@ class ProductFournisseur extends Product
|
||||
if ($option != 'nolink')
|
||||
{
|
||||
// Add param to save lastsearch_values or not
|
||||
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
|
||||
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
|
||||
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
|
||||
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
|
||||
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
|
||||
if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
|
||||
}
|
||||
|
||||
$linkclose='';
|
||||
$linkclose = '';
|
||||
if (empty($notooltip))
|
||||
{
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
$label=$langs->trans("SupplierRef");
|
||||
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
$label = $langs->trans("SupplierRef");
|
||||
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
|
||||
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
||||
}
|
||||
else $linkclose = ($morecss?' class="'.$morecss.'"':'');
|
||||
else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
||||
|
||||
$linkstart = '<a href="'.$url.'"';
|
||||
$linkstart.=$linkclose.'>';
|
||||
$linkend='</a>';
|
||||
$linkstart .= $linkclose.'>';
|
||||
$linkend = '</a>';
|
||||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= $this->fourn_ref;
|
||||
if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
||||
if ($withpicto != 2) $result .= $this->fourn_ref;
|
||||
$result .= $linkend;
|
||||
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
|
||||
|
||||
@@ -1096,24 +1096,24 @@ class ProductFournisseur extends Product
|
||||
private function logPrice($user, $datec, $buyprice, $qty, $multicurrency_buyprice = null, $multicurrency_unitBuyPrice = null, $multicurrency_tx = null, $fk_multicurrency = null, $multicurrency_code = null)
|
||||
{
|
||||
// Add record into log table
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_fournisseur_price_log(";
|
||||
$sql.= " multicurrency_price, multicurrency_unitprice, multicurrency_tx, fk_multicurrency, multicurrency_code,";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price_log(";
|
||||
$sql .= " multicurrency_price, multicurrency_unitprice, multicurrency_tx, fk_multicurrency, multicurrency_code,";
|
||||
$sql .= "datec, fk_product_fournisseur,fk_user,price,quantity)";
|
||||
$sql .= "values(";
|
||||
$sql.= (isset($multicurrency_buyprice)?"'".$this->db->escape(price2num($multicurrency_buyprice))."'":'null').",";
|
||||
$sql.= (isset($multicurrency_unitBuyPrice)?"'".$this->db->escape(price2num($multicurrency_unitBuyPrice))."'":'null').",";
|
||||
$sql.= (isset($multicurrency_tx)?"'".$this->db->escape($multicurrency_tx)."'":'1').",";
|
||||
$sql.= (isset($fk_multicurrency)?"'".$this->db->escape($fk_multicurrency)."'":'null').",";
|
||||
$sql.= (isset($multicurrency_code)?"'".$this->db->escape($multicurrency_code)."'":'null').",";
|
||||
$sql .= "'" . $this->db->idate($datec) . "',";
|
||||
$sql .= " " . $this->product_fourn_price_id . ",";
|
||||
$sql .= " " . $user->id . ",";
|
||||
$sql .= " " . price2num($buyprice) . ",";
|
||||
$sql .= " " . $qty;
|
||||
$sql .= (isset($multicurrency_buyprice) ? "'".$this->db->escape(price2num($multicurrency_buyprice))."'" : 'null').",";
|
||||
$sql .= (isset($multicurrency_unitBuyPrice) ? "'".$this->db->escape(price2num($multicurrency_unitBuyPrice))."'" : 'null').",";
|
||||
$sql .= (isset($multicurrency_tx) ? "'".$this->db->escape($multicurrency_tx)."'" : '1').",";
|
||||
$sql .= (isset($fk_multicurrency) ? "'".$this->db->escape($fk_multicurrency)."'" : 'null').",";
|
||||
$sql .= (isset($multicurrency_code) ? "'".$this->db->escape($multicurrency_code)."'" : 'null').",";
|
||||
$sql .= "'".$this->db->idate($datec)."',";
|
||||
$sql .= " ".$this->product_fourn_price_id.",";
|
||||
$sql .= " ".$user->id.",";
|
||||
$sql .= " ".price2num($buyprice).",";
|
||||
$sql .= " ".$qty;
|
||||
$sql .= ")";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
if (!$resql) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
|
||||
@@ -40,9 +40,9 @@ $result = restrictedArea($user, 'societe', $socid, '');
|
||||
* View
|
||||
*/
|
||||
|
||||
$commandestatic=new CommandeFournisseur($db);
|
||||
$facturestatic=new FactureFournisseur($db);
|
||||
$companystatic=new Societe($db);
|
||||
$commandestatic = new CommandeFournisseur($db);
|
||||
$facturestatic = new FactureFournisseur($db);
|
||||
$companystatic = new Societe($db);
|
||||
|
||||
llxHeader("", $langs->trans("SuppliersArea"));
|
||||
|
||||
@@ -56,13 +56,13 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
// Orders
|
||||
$sql = "SELECT count(cf.rowid), cf.fk_statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
||||
$sql.= " WHERE cf.fk_soc = s.rowid ";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND sc.fk_user = " .$user->id;
|
||||
$sql.= " AND cf.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY cf.fk_statut";
|
||||
$sql .= " WHERE cf.fk_soc = s.rowid ";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND sc.fk_user = ".$user->id;
|
||||
$sql .= " AND cf.entity = ".$conf->entity;
|
||||
$sql .= " GROUP BY cf.fk_statut";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
@@ -97,19 +97,19 @@ else
|
||||
|
||||
|
||||
// Draft orders
|
||||
if (! empty($conf->fournisseur->enabled))
|
||||
if (!empty($conf->fournisseur->enabled))
|
||||
{
|
||||
$langs->load("orders");
|
||||
|
||||
$sql = "SELECT cf.rowid, cf.ref, cf.total_ttc,";
|
||||
$sql.= " s.nom as name, s.rowid as socid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " s.nom as name, s.rowid as socid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
||||
$sql.= " WHERE cf.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND sc.fk_user = " .$user->id;
|
||||
$sql.= " AND cf.entity = ".$conf->entity;
|
||||
$sql.= " AND cf.fk_statut = 0";
|
||||
$sql .= " WHERE cf.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND sc.fk_user = ".$user->id;
|
||||
$sql .= " AND cf.entity = ".$conf->entity;
|
||||
$sql .= " AND cf.fk_statut = 0";
|
||||
if ($socid) $sql .= " AND cf.fk_soc = ".$socid;
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@@ -129,21 +129,21 @@ if (! empty($conf->fournisseur->enabled))
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
print '<tr class="oddeven"><td class="nowrap">';
|
||||
$commandestatic->id=$obj->rowid;
|
||||
$commandestatic->ref=$obj->ref;
|
||||
$commandestatic->id = $obj->rowid;
|
||||
$commandestatic->ref = $obj->ref;
|
||||
print $commandestatic->getNomUrl(1, '', 16);
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->client=0;
|
||||
$companystatic->id = $obj->socid;
|
||||
$companystatic->name = $obj->name;
|
||||
$companystatic->client = 0;
|
||||
print $companystatic->getNomUrl(1, '', 16);
|
||||
print '</td>';
|
||||
print '<td class="right nowrap">'.price($obj->total_ttc).'</td></tr>';
|
||||
$i++;
|
||||
$total += $obj->total_ttc;
|
||||
}
|
||||
if ($total>0)
|
||||
if ($total > 0)
|
||||
{
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" class="right">'.price($total)."</td></tr>";
|
||||
}
|
||||
@@ -154,22 +154,22 @@ if (! empty($conf->fournisseur->enabled))
|
||||
}
|
||||
|
||||
// Draft invoices
|
||||
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire)
|
||||
if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire)
|
||||
{
|
||||
$sql = "SELECT ff.ref_supplier, ff.rowid, ff.total_ttc, ff.type";
|
||||
$sql.= ", s.nom as name, s.rowid as socid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ", s.nom as name, s.rowid as socid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
||||
$sql.= " WHERE s.rowid = ff.fk_soc";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND sc.fk_user = " .$user->id;
|
||||
$sql.= " AND ff.entity = ".$conf->entity;
|
||||
$sql.= " AND ff.fk_statut = 0";
|
||||
$sql .= " WHERE s.rowid = ff.fk_soc";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND sc.fk_user = ".$user->id;
|
||||
$sql .= " AND ff.entity = ".$conf->entity;
|
||||
$sql .= " AND ff.fk_statut = 0";
|
||||
if ($socid) $sql .= " AND f.fk_soc = ".$socid;
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ( $resql )
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
@@ -185,20 +185,20 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
print '<tr class="oddeven"><td class="nowrap">';
|
||||
$facturestatic->ref=$obj->ref;
|
||||
$facturestatic->id=$obj->rowid;
|
||||
$facturestatic->type=$obj->type;
|
||||
$facturestatic->ref = $obj->ref;
|
||||
$facturestatic->id = $obj->rowid;
|
||||
$facturestatic->type = $obj->type;
|
||||
print $facturestatic->getNomUrl(1, '');
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->client=0;
|
||||
$companystatic->id = $obj->socid;
|
||||
$companystatic->name = $obj->name;
|
||||
$companystatic->client = 0;
|
||||
print $companystatic->getNomUrl(1, '', 16);
|
||||
print '</td>';
|
||||
print '<td class="right">'.price($obj->total_ttc).'</td>';
|
||||
print '</tr>';
|
||||
$tot_ttc+=$obj->total_ttc;
|
||||
$tot_ttc += $obj->total_ttc;
|
||||
$i++;
|
||||
}
|
||||
|
||||
@@ -225,18 +225,18 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
/*
|
||||
* List last modified supliers
|
||||
*/
|
||||
$max=10;
|
||||
$max = 10;
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name, s.town, s.datec, s.tms, s.prefix_comm, s.code_fournisseur, s.code_compta_fournisseur";
|
||||
$sql.= ", st.libelle as stcomm";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st";
|
||||
$sql .= ", st.libelle as stcomm";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."c_stcomm as st";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE s.fk_stcomm = st.id";
|
||||
$sql.= " AND s.fournisseur = 1";
|
||||
$sql.= " AND s.entity IN (".getEntity('societe').")";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
$sql .= " WHERE s.fk_stcomm = st.id";
|
||||
$sql .= " AND s.fournisseur = 1";
|
||||
$sql .= " AND s.entity IN (".getEntity('societe').")";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql .= " AND s.rowid = ".$socid;
|
||||
$sql.= " ORDER BY s.tms DESC";
|
||||
$sql .= " ORDER BY s.tms DESC";
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@@ -252,7 +252,7 @@ if ($resql)
|
||||
print '<td class="right">'.$langs->trans("DateModification")."</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
while ($obj = $db->fetch_object($resql) )
|
||||
while ($obj = $db->fetch_object($resql))
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td><a href="card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowSupplier"), "company").'</a>';
|
||||
@@ -275,7 +275,7 @@ else
|
||||
* List of suppliers categories
|
||||
*/
|
||||
$companystatic->LoadSupplierCateg();
|
||||
$categstatic=new Categorie($db);
|
||||
$categstatic = new Categorie($db);
|
||||
|
||||
if (count($companystatic->SupplierCategories))
|
||||
{
|
||||
@@ -290,9 +290,9 @@ if (count($companystatic->SupplierCategories))
|
||||
{
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>';
|
||||
$categstatic->id=$rowid;
|
||||
$categstatic->ref=$label;
|
||||
$categstatic->label=$label;
|
||||
$categstatic->id = $rowid;
|
||||
$categstatic->ref = $label;
|
||||
$categstatic->label = $label;
|
||||
print $categstatic->getNomUrl(1);
|
||||
print '</td>'."\n";
|
||||
// TODO this page not exist
|
||||
|
||||
@@ -911,7 +911,7 @@ if ((empty($id) && empty($ref)) || $action == 'add' || $action == 'request' || $
|
||||
|
||||
// Si il y a une erreur
|
||||
if (GETPOST('error')) {
|
||||
switch(GETPOST('error')) {
|
||||
switch (GETPOST('error')) {
|
||||
case 'datefin' :
|
||||
$errors[] = $langs->trans('ErrorEndDateCP');
|
||||
break;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -62,7 +62,7 @@ $max=3;
|
||||
*/
|
||||
|
||||
// Update sold
|
||||
if (! empty($conf->holiday->enabled) && ! empty($setupcompanynotcomplete))
|
||||
if (!empty($conf->holiday->enabled) && !empty($setupcompanynotcomplete))
|
||||
{
|
||||
$result = $holiday->updateBalance();
|
||||
}
|
||||
@@ -73,18 +73,18 @@ if (! empty($conf->holiday->enabled) && ! empty($setupcompanynotcomplete))
|
||||
*/
|
||||
|
||||
$childids = $user->getAllChildIds();
|
||||
$childids[]=$user->id;
|
||||
$childids[] = $user->id;
|
||||
|
||||
llxHeader('', $langs->trans('HRMArea'));
|
||||
|
||||
print load_fiche_titre($langs->trans("HRMArea"), '', 'hrm');
|
||||
|
||||
|
||||
if (! empty($setupcompanynotcomplete))
|
||||
if (!empty($setupcompanynotcomplete))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"));
|
||||
print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete)?'':'&action=edit').'">'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").'</a></div>';
|
||||
$warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"));
|
||||
print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit').'">'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").'</a></div>';
|
||||
|
||||
llxFooter();
|
||||
exit;
|
||||
@@ -134,7 +134,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
|
||||
}
|
||||
|
||||
|
||||
if (! empty($conf->holiday->enabled))
|
||||
if (!empty($conf->holiday->enabled))
|
||||
{
|
||||
if (empty($conf->global->HOLIDAY_HIDE_BALANCE))
|
||||
{
|
||||
@@ -146,13 +146,13 @@ if (! empty($conf->holiday->enabled))
|
||||
print '<tr class="oddeven">';
|
||||
print '<td colspan="3">';
|
||||
|
||||
$out='';
|
||||
$typeleaves=$holiday->getTypes(1, 1);
|
||||
foreach($typeleaves as $key => $val)
|
||||
$out = '';
|
||||
$typeleaves = $holiday->getTypes(1, 1);
|
||||
foreach ($typeleaves as $key => $val)
|
||||
{
|
||||
$nb_type = $holiday->getCPforUser($user->id, $val['rowid']);
|
||||
$nb_holiday += $nb_type;
|
||||
$out .= ' - '.$val['label'].': <strong>'.($nb_type?price2num($nb_type):0).'</strong><br>';
|
||||
$out .= ' - '.$val['label'].': <strong>'.($nb_type ?price2num($nb_type) : 0).'</strong><br>';
|
||||
}
|
||||
print $langs->trans('SoldeCPUser', round($nb_holiday, 5)).'<br>';
|
||||
print $out;
|
||||
@@ -161,7 +161,7 @@ if (! empty($conf->holiday->enabled))
|
||||
print '</tr>';
|
||||
print '</table></div><br>';
|
||||
}
|
||||
elseif (! is_numeric($conf->global->HOLIDAY_HIDE_BALANCE))
|
||||
elseif (!is_numeric($conf->global->HOLIDAY_HIDE_BALANCE))
|
||||
{
|
||||
print $langs->trans($conf->global->HOLIDAY_HIDE_BALANCE).'<br>';
|
||||
}
|
||||
@@ -287,22 +287,22 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire
|
||||
{
|
||||
$total_ttc = $totalam = $total = 0;
|
||||
|
||||
$expensereportstatic=new ExpenseReport($db);
|
||||
$userstatic=new User($db);
|
||||
$expensereportstatic = new ExpenseReport($db);
|
||||
$userstatic = new User($db);
|
||||
while ($i < $num && $i < $max)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$expensereportstatic->id=$obj->rowid;
|
||||
$expensereportstatic->ref=$obj->ref;
|
||||
$expensereportstatic->id = $obj->rowid;
|
||||
$expensereportstatic->ref = $obj->ref;
|
||||
|
||||
$userstatic->id=$obj->uid;
|
||||
$userstatic->lastname=$obj->lastname;
|
||||
$userstatic->firstname=$obj->firstname;
|
||||
$userstatic->email=$obj->email;
|
||||
$userstatic->login=$obj->login;
|
||||
$userstatic->statut=$obj->statut;
|
||||
$userstatic->photo=$obj->photo;
|
||||
$userstatic->id = $obj->uid;
|
||||
$userstatic->lastname = $obj->lastname;
|
||||
$userstatic->firstname = $obj->firstname;
|
||||
$userstatic->email = $obj->email;
|
||||
$userstatic->login = $obj->login;
|
||||
$userstatic->statut = $obj->statut;
|
||||
$userstatic->photo = $obj->photo;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowraponall">'.$expensereportstatic->getNomUrl(1).'</td>';
|
||||
|
||||
362
htdocs/index.php
362
htdocs/index.php
@@ -24,14 +24,14 @@
|
||||
* \brief Dolibarr home page
|
||||
*/
|
||||
|
||||
define('NOCSRFCHECK', 1); // This is main home and login page. We must be able to go on it from another web site.
|
||||
define('NOCSRFCHECK', 1); // This is main home and login page. We must be able to go on it from another web site.
|
||||
|
||||
require 'main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
|
||||
// If not defined, we select menu "home"
|
||||
$_GET['mainmenu']=GETPOST('mainmenu', 'aZ09')?GETPOST('mainmenu', 'aZ09'):'home';
|
||||
$action=GETPOST('action', 'aZ09');
|
||||
$_GET['mainmenu'] = GETPOST('mainmenu', 'aZ09') ?GETPOST('mainmenu', 'aZ09') : 'home';
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$hookmanager->initHooks(array('index'));
|
||||
|
||||
@@ -46,7 +46,7 @@ if (!isset($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_IN
|
||||
header("Location: ".DOL_URL_ROOT."/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete");
|
||||
exit;
|
||||
}
|
||||
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)?1:$conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled
|
||||
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete");
|
||||
exit;
|
||||
@@ -54,12 +54,12 @@ if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FO
|
||||
if (GETPOST('addbox')) // Add box (when submit is done from a form when ajax disabled)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
|
||||
$zone=GETPOST('areacode', 'aZ09');
|
||||
$userid=GETPOST('userid', 'int');
|
||||
$boxorder=GETPOST('boxorder', 'aZ09');
|
||||
$boxorder.=GETPOST('boxcombo', 'aZ09');
|
||||
$zone = GETPOST('areacode', 'aZ09');
|
||||
$userid = GETPOST('userid', 'int');
|
||||
$boxorder = GETPOST('boxorder', 'aZ09');
|
||||
$boxorder .= GETPOST('boxcombo', 'aZ09');
|
||||
|
||||
$result=InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
|
||||
$result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
|
||||
if ($result > 0) setEventMessages($langs->trans("BoxAdded"), null);
|
||||
}
|
||||
|
||||
@@ -68,26 +68,26 @@ if (GETPOST('addbox')) // Add box (when submit is done from a form when ajax dis
|
||||
* View
|
||||
*/
|
||||
|
||||
if (! is_object($form)) $form=new Form($db);
|
||||
if (!is_object($form)) $form = new Form($db);
|
||||
|
||||
// Title
|
||||
$title=$langs->trans("HomeArea").' - Dolibarr '.DOL_VERSION;
|
||||
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$langs->trans("HomeArea").' - '.$conf->global->MAIN_APPLICATION_TITLE;
|
||||
$title = $langs->trans("HomeArea").' - Dolibarr '.DOL_VERSION;
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $title = $langs->trans("HomeArea").' - '.$conf->global->MAIN_APPLICATION_TITLE;
|
||||
|
||||
llxHeader('', $title);
|
||||
|
||||
|
||||
$resultboxes=FormOther::getBoxesArea($user, "0"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
|
||||
$resultboxes = FormOther::getBoxesArea($user, "0"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("HomeArea"), $resultboxes['selectboxlist'], 'home');
|
||||
|
||||
if (! empty($conf->global->MAIN_MOTD))
|
||||
if (!empty($conf->global->MAIN_MOTD))
|
||||
{
|
||||
$conf->global->MAIN_MOTD=preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', $conf->global->MAIN_MOTD);
|
||||
if (! empty($conf->global->MAIN_MOTD))
|
||||
$conf->global->MAIN_MOTD = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', $conf->global->MAIN_MOTD);
|
||||
if (!empty($conf->global->MAIN_MOTD))
|
||||
{
|
||||
$substitutionarray=getCommonSubstitutionArray($langs);
|
||||
$substitutionarray = getCommonSubstitutionArray($langs);
|
||||
complete_substitutions_array($substitutionarray, $langs);
|
||||
$texttoshow = make_substitutions($conf->global->MAIN_MOTD, $substitutionarray, $langs);
|
||||
|
||||
@@ -117,39 +117,39 @@ $langs->loadLangs(array('commercial', 'bills', 'orders', 'contracts'));
|
||||
|
||||
if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
|
||||
{
|
||||
$object=new stdClass();
|
||||
$parameters=array();
|
||||
$action='';
|
||||
$reshook=$hookmanager->executeHooks('addStatisticLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$boxstatFromHook=$hookmanager->resPrint;
|
||||
$object = new stdClass();
|
||||
$parameters = array();
|
||||
$action = '';
|
||||
$reshook = $hookmanager->executeHooks('addStatisticLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$boxstatFromHook = $hookmanager->resPrint;
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Condition to be checked for each display line dashboard
|
||||
$conditions=array(
|
||||
$conditions = array(
|
||||
$user->rights->user->user->lire,
|
||||
! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS),
|
||||
! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS),
|
||||
! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS),
|
||||
! empty($conf->societe->enabled) && $user->rights->societe->contact->lire,
|
||||
! empty($conf->adherent->enabled) && $user->rights->adherent->lire,
|
||||
! empty($conf->product->enabled) && $user->rights->produit->lire,
|
||||
! empty($conf->service->enabled) && $user->rights->service->lire,
|
||||
! empty($conf->propal->enabled) && $user->rights->propale->lire,
|
||||
! empty($conf->commande->enabled) && $user->rights->commande->lire,
|
||||
! empty($conf->facture->enabled) && $user->rights->facture->lire,
|
||||
! empty($conf->contrat->enabled) && $user->rights->contrat->lire,
|
||||
! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire,
|
||||
! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS),
|
||||
! empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS),
|
||||
! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS),
|
||||
! empty($conf->projet->enabled) && $user->rights->projet->lire,
|
||||
! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire,
|
||||
! empty($conf->holiday->enabled) && $user->rights->holiday->read,
|
||||
! empty($conf->don->enabled) && $user->rights->don->lire
|
||||
!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS),
|
||||
!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS),
|
||||
!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS),
|
||||
!empty($conf->societe->enabled) && $user->rights->societe->contact->lire,
|
||||
!empty($conf->adherent->enabled) && $user->rights->adherent->lire,
|
||||
!empty($conf->product->enabled) && $user->rights->produit->lire,
|
||||
!empty($conf->service->enabled) && $user->rights->service->lire,
|
||||
!empty($conf->propal->enabled) && $user->rights->propale->lire,
|
||||
!empty($conf->commande->enabled) && $user->rights->commande->lire,
|
||||
!empty($conf->facture->enabled) && $user->rights->facture->lire,
|
||||
!empty($conf->contrat->enabled) && $user->rights->contrat->lire,
|
||||
!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire,
|
||||
!empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS),
|
||||
!empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS),
|
||||
!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS),
|
||||
!empty($conf->projet->enabled) && $user->rights->projet->lire,
|
||||
!empty($conf->expensereport->enabled) && $user->rights->expensereport->lire,
|
||||
!empty($conf->holiday->enabled) && $user->rights->holiday->read,
|
||||
!empty($conf->don->enabled) && $user->rights->don->lire
|
||||
);
|
||||
// Class file containing the method load_state_board for each line
|
||||
$includes=array(
|
||||
$includes = array(
|
||||
DOL_DOCUMENT_ROOT."/user/class/user.class.php",
|
||||
DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
|
||||
DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
|
||||
@@ -172,7 +172,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
|
||||
DOL_DOCUMENT_ROOT."/don/class/don.class.php"
|
||||
);
|
||||
// Name class containing the method load_state_board for each line
|
||||
$classes=array('User',
|
||||
$classes = array('User',
|
||||
'Client',
|
||||
'Client',
|
||||
'Fournisseur',
|
||||
@@ -194,7 +194,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
|
||||
'Don'
|
||||
);
|
||||
// Cle array returned by the method load_state_board for each line
|
||||
$keys=array('users',
|
||||
$keys = array('users',
|
||||
'customers',
|
||||
'prospects',
|
||||
'suppliers',
|
||||
@@ -216,7 +216,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
|
||||
'donations'
|
||||
);
|
||||
// Dashboard Icon lines
|
||||
$icons=array('user',
|
||||
$icons = array('user',
|
||||
'company',
|
||||
'company',
|
||||
'company',
|
||||
@@ -238,7 +238,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
|
||||
'generic'
|
||||
);
|
||||
// Translation keyword
|
||||
$titres=array("Users",
|
||||
$titres = array("Users",
|
||||
"ThirdPartyCustomersStats",
|
||||
"ThirdPartyProspectsStats",
|
||||
"Suppliers",
|
||||
@@ -260,7 +260,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
|
||||
"Donations"
|
||||
);
|
||||
// Dashboard Link lines
|
||||
$links=array(
|
||||
$links = array(
|
||||
DOL_URL_ROOT.'/user/list.php',
|
||||
DOL_URL_ROOT.'/societe/list.php?type=c&mainmenu=companies',
|
||||
DOL_URL_ROOT.'/societe/list.php?type=p&mainmenu=companies',
|
||||
@@ -308,36 +308,36 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
|
||||
|
||||
|
||||
// Loop and displays each line of table
|
||||
$boardloaded=array();
|
||||
$boardloaded = array();
|
||||
foreach ($keys as $key=>$val)
|
||||
{
|
||||
if ($conditions[$key])
|
||||
{
|
||||
$boxstatItem = '';
|
||||
$classe=$classes[$key];
|
||||
$classe = $classes[$key];
|
||||
// Search in cache if load_state_board is already realized
|
||||
if (! isset($boardloaded[$classe]) || ! is_object($boardloaded[$classe]))
|
||||
if (!isset($boardloaded[$classe]) || !is_object($boardloaded[$classe]))
|
||||
{
|
||||
include_once $includes[$key]; // Loading a class cost around 1Mb
|
||||
include_once $includes[$key]; // Loading a class cost around 1Mb
|
||||
|
||||
$board=new $classe($db);
|
||||
$board = new $classe($db);
|
||||
$board->load_state_board($user);
|
||||
$boardloaded[$classe]=$board;
|
||||
$boardloaded[$classe] = $board;
|
||||
}
|
||||
else
|
||||
{
|
||||
$board=$boardloaded[$classe];
|
||||
$board = $boardloaded[$classe];
|
||||
}
|
||||
|
||||
|
||||
if (!empty($langfile[$key])) $langs->load($langfile[$key]);
|
||||
$text=$langs->trans($titres[$key]);
|
||||
$boxstatItem.='<a href="'.$links[$key].'" class="boxstatsindicator thumbstat nobold nounderline">';
|
||||
$boxstatItem.='<div class="boxstats">';
|
||||
$boxstatItem.='<span class="boxstatstext" title="'.dol_escape_htmltag($text).'">'.$text.'</span><br>';
|
||||
$boxstatItem.='<span class="boxstatsindicator">'.img_object("", $icons[$key], 'class="inline-block"').' '.($board->nb[$val]?$board->nb[$val]:0).'</span>';
|
||||
$boxstatItem.='</div>';
|
||||
$boxstatItem.='</a>';
|
||||
$text = $langs->trans($titres[$key]);
|
||||
$boxstatItem .= '<a href="'.$links[$key].'" class="boxstatsindicator thumbstat nobold nounderline">';
|
||||
$boxstatItem .= '<div class="boxstats">';
|
||||
$boxstatItem .= '<span class="boxstatstext" title="'.dol_escape_htmltag($text).'">'.$text.'</span><br>';
|
||||
$boxstatItem .= '<span class="boxstatsindicator">'.img_object("", $icons[$key], 'class="inline-block"').' '.($board->nb[$val] ? $board->nb[$val] : 0).'</span>';
|
||||
$boxstatItem .= '</div>';
|
||||
$boxstatItem .= '</a>';
|
||||
|
||||
$boxstatItems[$val] = $boxstatItem;
|
||||
}
|
||||
@@ -485,7 +485,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
$parameters = array();
|
||||
$action = '';
|
||||
$reshook = $hookmanager->executeHooks('addOpenElementsDashboardLine', $parameters, $object,
|
||||
$action); // Note that $action and $object may have been modified by some hooks
|
||||
$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook == 0) {
|
||||
$dashboardlines = array_merge($dashboardlines, $hookmanager->resArray);
|
||||
}
|
||||
@@ -586,7 +586,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
'dashboardgroup' => $dashboardgroup
|
||||
);
|
||||
$reshook = $hookmanager->executeHooks('addOpenElementsDashboardGroup', $parameters, $object,
|
||||
$action); // Note that $action and $object may have been modified by some hooks
|
||||
$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook == 0) {
|
||||
$dashboardgroup = array_merge($dashboardgroup, $hookmanager->resArray);
|
||||
}
|
||||
@@ -628,23 +628,23 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
|
||||
$boxwork = '';
|
||||
$boxwork .= '<div class="box">';
|
||||
$boxwork .= '<table summary="' . dol_escape_htmltag($langs->trans("WorkingBoard")) . '" class="noborder boxtable boxtablenobottom boxworkingboard" width="100%">' . "\n";
|
||||
$boxwork .= '<table summary="'.dol_escape_htmltag($langs->trans("WorkingBoard")).'" class="noborder boxtable boxtablenobottom boxworkingboard" width="100%">'."\n";
|
||||
$boxwork .= '<tr class="liste_titre">';
|
||||
$boxwork .= '<th class="liste_titre"><div class="inline-block valignmiddle">' . $langs->trans("DolibarrWorkBoard") . '</div>';
|
||||
$boxwork .= '<th class="liste_titre"><div class="inline-block valignmiddle">'.$langs->trans("DolibarrWorkBoard").'</div>';
|
||||
if ($showweather) {
|
||||
if ($totallate > 0) {
|
||||
$text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate") . ' (' . $langs->transnoentitiesnoconv("NActionsLate",
|
||||
$totallate . (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')) . ')';
|
||||
$text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv("NActionsLate",
|
||||
$totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')).')';
|
||||
} else {
|
||||
$text = $langs->transnoentitiesnoconv("NoItemLate");
|
||||
}
|
||||
$text .= '. ' . $langs->transnoentitiesnoconv("LateDesc");
|
||||
$text .= '. '.$langs->transnoentitiesnoconv("LateDesc");
|
||||
//$text.=$form->textwithpicto('',$langs->trans("LateDesc"));
|
||||
$options = 'height="24px" style="float: right"';
|
||||
$boxwork .= showWeather($totallate, $text, $options, 'inline-block valignmiddle');
|
||||
}
|
||||
$boxwork .= '</th>';
|
||||
$boxwork .= '</tr>' . "\n";
|
||||
$boxwork .= '</tr>'."\n";
|
||||
|
||||
// Show dashboard
|
||||
$nbworkboardempty = 0;
|
||||
@@ -673,21 +673,21 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
|
||||
// global stats
|
||||
$globalStatsKey = false;
|
||||
if (!empty($groupElement['globalStatsKey']) && empty($groupElement['globalStats'])){ // can be filled by hook
|
||||
if (!empty($groupElement['globalStatsKey']) && empty($groupElement['globalStats'])) { // can be filled by hook
|
||||
$globalStatsKey = $groupElement['globalStatsKey'];
|
||||
$groupElement['globalStats'] = array();
|
||||
|
||||
if(in_array($globalStatsKey, $keys))
|
||||
if (in_array($globalStatsKey, $keys))
|
||||
{
|
||||
// get key index of stats used in $includes, $classes, $keys, $icons, $titres, $links
|
||||
$keyIndex = array_search($globalStatsKey, $keys);
|
||||
|
||||
$classe=$classes[$keyIndex];
|
||||
$classe = $classes[$keyIndex];
|
||||
if (isset($boardloaded[$classe]) && is_object($boardloaded[$classe]))
|
||||
{
|
||||
$groupElement['globalStats']['total'] = $boardloaded[$classe]->nb[$globalStatsKey]?$boardloaded[$classe]->nb[$globalStatsKey]:0;
|
||||
$groupElement['globalStats']['total'] = $boardloaded[$classe]->nb[$globalStatsKey] ? $boardloaded[$classe]->nb[$globalStatsKey] : 0;
|
||||
$nbTotal = doubleval($groupElement['globalStats']['total']);
|
||||
if($nbTotal>=10000){ $nbTotal = round($nbTotal/1000, 2) .'k'; }
|
||||
if ($nbTotal >= 10000) { $nbTotal = round($nbTotal / 1000, 2).'k'; }
|
||||
$groupElement['globalStats']['text'] = $langs->trans('Total').' : '.$langs->trans($titres[$keyIndex]).' ('.$groupElement['globalStats']['total'].')';
|
||||
$groupElement['globalStats']['total'] = $nbTotal;
|
||||
$groupElement['globalStats']['link'] = $links[$keyIndex];
|
||||
@@ -696,35 +696,35 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
}
|
||||
|
||||
|
||||
$openedDashBoard.= '<div class="box-flex-item">' . "\n";
|
||||
$openedDashBoard.= ' <div class="info-box ' . $openedDashBoardSize . '">' . "\n";
|
||||
$openedDashBoard.= ' <span class="info-box-icon bg-infoxbox-'.$groupKeyLowerCase.'">'."\n";
|
||||
$openedDashBoard.= ' <i class="fa fa-dol-'.$groupKeyLowerCase.'"></i>'."\n";
|
||||
$openedDashBoard .= '<div class="box-flex-item">'."\n";
|
||||
$openedDashBoard .= ' <div class="info-box '.$openedDashBoardSize.'">'."\n";
|
||||
$openedDashBoard .= ' <span class="info-box-icon bg-infoxbox-'.$groupKeyLowerCase.'">'."\n";
|
||||
$openedDashBoard .= ' <i class="fa fa-dol-'.$groupKeyLowerCase.'"></i>'."\n";
|
||||
|
||||
if(!empty($groupElement['globalStats'])){
|
||||
if (!empty($groupElement['globalStats'])) {
|
||||
$globalStatInTopOpenedDashBoard[] = $globalStatsKey;
|
||||
$openedDashBoard.= ' <span class="info-box-icon-text" title="'.$groupElement['globalStats']['text'].'">'.$nbTotal.'</span>'."\n";
|
||||
$openedDashBoard .= ' <span class="info-box-icon-text" title="'.$groupElement['globalStats']['text'].'">'.$nbTotal.'</span>'."\n";
|
||||
}
|
||||
|
||||
$openedDashBoard.= ' </span>'."\n";
|
||||
$openedDashBoard .= ' <div class="info-box-content">' . "\n";
|
||||
$openedDashBoard .= ' </span>'."\n";
|
||||
$openedDashBoard .= ' <div class="info-box-content">'."\n";
|
||||
|
||||
$openedDashBoard .= ' <span class="info-box-title" title="'.strip_tags($groupName).'">'.$groupName.'</span>' . "\n";
|
||||
$openedDashBoard .= ' <span class="info-box-title" title="'.strip_tags($groupName).'">'.$groupName.'</span>'."\n";
|
||||
|
||||
foreach ($boards as $board) {
|
||||
if (!empty($board->labelShort)) {
|
||||
$infoName = '<span title="' . $board->label . '">' . $board->labelShort . '</span>';
|
||||
$infoName = '<span title="'.$board->label.'">'.$board->labelShort.'</span>';
|
||||
} else {
|
||||
$infoName = $board->label;
|
||||
}
|
||||
|
||||
$textLateTitle = $langs->trans("NActionsLate", $board->nbtodolate);
|
||||
$textLateTitle .= ' (' . $langs->trans("Late") . ' = ' . $langs->trans("DateReference") . ' > ' . $langs->trans("DateToday") . ' ' . (ceil($board->warning_delay) >= 0 ? '+' : '') . ceil($board->warning_delay) . ' ' . $langs->trans("days") . ')';
|
||||
$textLateTitle .= ' ('.$langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($board->warning_delay) >= 0 ? '+' : '').ceil($board->warning_delay).' '.$langs->trans("days").')';
|
||||
|
||||
$textLate = '';
|
||||
if ($board->nbtodolate > 0) {
|
||||
$textLate .= ' <span title="' . dol_htmlentities($textLateTitle) . '" class="classfortooltip badge badge-danger">';
|
||||
$textLate .= '<i class="fa fa-exclamation-triangle"></i> ' . $board->nbtodolate;
|
||||
$textLate .= ' <span title="'.dol_htmlentities($textLateTitle).'" class="classfortooltip badge badge-danger">';
|
||||
$textLate .= '<i class="fa fa-exclamation-triangle"></i> '.$board->nbtodolate;
|
||||
$textLate .= '</span>';
|
||||
}
|
||||
|
||||
@@ -733,16 +733,16 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
$nbtodClass = 'badge badge-info';
|
||||
}
|
||||
|
||||
$openedDashBoard .= ' <a href="' . $board->url . '" class="info-box-text">' . $infoName . ' : <span class="' . $nbtodClass . ' classfortooltip" title="' . $board->label . '" >' . $board->nbtodo . '</span>' . $textLate . '</a>' . "\n";
|
||||
$openedDashBoard .= ' <a href="'.$board->url.'" class="info-box-text">'.$infoName.' : <span class="'.$nbtodClass.' classfortooltip" title="'.$board->label.'" >'.$board->nbtodo.'</span>'.$textLate.'</a>'."\n";
|
||||
|
||||
if ($board->total > 0 && !empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)) {
|
||||
$openedDashBoard .= '<a href="' . $board->url . '" class="info-box-text">' . $langs->trans('Total') . ' : ' . price($board->total) . '</a>';
|
||||
$openedDashBoard .= '<a href="'.$board->url.'" class="info-box-text">'.$langs->trans('Total').' : '.price($board->total).'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
$openedDashBoard .= ' </div><!-- /.info-box-content -->' . "\n";
|
||||
$openedDashBoard .= ' </div><!-- /.info-box -->' . "\n";
|
||||
$openedDashBoard .= '</div><!-- /.box-flex-item -->' . "\n";
|
||||
$openedDashBoard .= ' </div><!-- /.info-box-content -->'."\n";
|
||||
$openedDashBoard .= ' </div><!-- /.info-box -->'."\n";
|
||||
$openedDashBoard .= '</div><!-- /.box-flex-item -->'."\n";
|
||||
$openedDashBoard .= "\n";
|
||||
}
|
||||
}
|
||||
@@ -753,41 +753,41 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
|
||||
$text = '';
|
||||
if ($totallate > 0) {
|
||||
$text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate") . ' (' . $langs->transnoentitiesnoconv("NActionsLate",
|
||||
$totallate . (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')) . ')';
|
||||
$text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv("NActionsLate",
|
||||
$totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')).')';
|
||||
} else {
|
||||
$text = $langs->transnoentitiesnoconv("NoItemLate");
|
||||
}
|
||||
$text .= '. ' . $langs->transnoentitiesnoconv("LateDesc");
|
||||
$text .= '. '.$langs->transnoentitiesnoconv("LateDesc");
|
||||
|
||||
$weatherDashBoard = '<div class="box-flex-item ' . $appendClass . '">' . "\n";
|
||||
$weatherDashBoard .= ' <div class="info-box ' . $openedDashBoardSize . ' info-box-weather info-box-weather-level' . $weather->level . '">' . "\n";
|
||||
$weatherDashBoard = '<div class="box-flex-item '.$appendClass.'">'."\n";
|
||||
$weatherDashBoard .= ' <div class="info-box '.$openedDashBoardSize.' info-box-weather info-box-weather-level'.$weather->level.'">'."\n";
|
||||
$weatherDashBoard .= ' <span class="info-box-icon">';
|
||||
$weatherDashBoard .= img_weather('', $weather->level, '', 0, 'valignmiddle width50');
|
||||
$weatherDashBoard .= ' </span>' . "\n";
|
||||
$weatherDashBoard .= ' <div class="info-box-content">' . "\n";
|
||||
$weatherDashBoard .= ' <span class="info-box-title">' . $langs->trans('GlobalOpenedElemView') . '</span>' . "\n";
|
||||
$weatherDashBoard .= ' </span>'."\n";
|
||||
$weatherDashBoard .= ' <div class="info-box-content">'."\n";
|
||||
$weatherDashBoard .= ' <span class="info-box-title">'.$langs->trans('GlobalOpenedElemView').'</span>'."\n";
|
||||
|
||||
if ($totallatePercentage > 0 && !empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) {
|
||||
$weatherDashBoard .= ' <span class="info-box-number">' . $langs->transnoentitiesnoconv("NActionsLate",
|
||||
price($totallatePercentage) . '%') . '</span>' . "\n";
|
||||
$weatherDashBoard .= ' <span class="progress-description">' . $langs->trans('NActionsLate',
|
||||
$totalLateNumber) . '</span>' . "\n";
|
||||
$weatherDashBoard .= ' <span class="info-box-number">'.$langs->transnoentitiesnoconv("NActionsLate",
|
||||
price($totallatePercentage).'%').'</span>'."\n";
|
||||
$weatherDashBoard .= ' <span class="progress-description">'.$langs->trans('NActionsLate',
|
||||
$totalLateNumber).'</span>'."\n";
|
||||
} else {
|
||||
$weatherDashBoard .= ' <span class="info-box-number">' . $langs->transnoentitiesnoconv("NActionsLate",
|
||||
$totalLateNumber) . '</span>' . "\n";
|
||||
$weatherDashBoard .= ' <span class="info-box-number">'.$langs->transnoentitiesnoconv("NActionsLate",
|
||||
$totalLateNumber).'</span>'."\n";
|
||||
if ($totallatePercentage > 0) {
|
||||
$weatherDashBoard .= ' <span class="progress-description">' . $langs->trans('NActionsLate',
|
||||
price($totallatePercentage) . '%') . '</span>' . "\n";
|
||||
$weatherDashBoard .= ' <span class="progress-description">'.$langs->trans('NActionsLate',
|
||||
price($totallatePercentage).'%').'</span>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
$weatherDashBoard .= ' </div><!-- /.info-box-content -->' . "\n";
|
||||
$weatherDashBoard .= ' </div><!-- /.info-box -->' . "\n";
|
||||
$weatherDashBoard .= '</div><!-- /.box-flex-item -->' . "\n";
|
||||
$weatherDashBoard .= ' </div><!-- /.info-box-content -->'."\n";
|
||||
$weatherDashBoard .= ' </div><!-- /.info-box -->'."\n";
|
||||
$weatherDashBoard .= '</div><!-- /.box-flex-item -->'."\n";
|
||||
$weatherDashBoard .= "\n";
|
||||
|
||||
$openedDashBoard = $weatherDashBoard . $openedDashBoard;
|
||||
$openedDashBoard = $weatherDashBoard.$openedDashBoard;
|
||||
}
|
||||
|
||||
if (!empty($isIntopOpenedDashBoard)) {
|
||||
@@ -810,24 +810,24 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
|
||||
|
||||
$textlate = $langs->trans("NActionsLate", $board->nbtodolate);
|
||||
$textlate .= ' (' . $langs->trans("Late") . ' = ' . $langs->trans("DateReference") . ' > ' . $langs->trans("DateToday") . ' ' . (ceil($board->warning_delay) >= 0 ? '+' : '') . ceil($board->warning_delay) . ' ' . $langs->trans("days") . ')';
|
||||
$textlate .= ' ('.$langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($board->warning_delay) >= 0 ? '+' : '').ceil($board->warning_delay).' '.$langs->trans("days").')';
|
||||
|
||||
|
||||
$boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats130 boxstatsborder">';
|
||||
$boxwork .= '<div class="boxstatscontent">';
|
||||
$boxwork .= '<span class="boxstatstext" title="' . dol_escape_htmltag($board->label) . '">' . $board->img . ' ' . $board->label . '</span><br>';
|
||||
$boxwork .= '<a class="valignmiddle dashboardlineindicator" href="' . $board->url . '"><span class="dashboardlineindicator' . (($board->nbtodo == 0) ? ' dashboardlineok' : '') . '">' . $board->nbtodo . '</span></a>';
|
||||
$boxwork .= '<span class="boxstatstext" title="'.dol_escape_htmltag($board->label).'">'.$board->img.' '.$board->label.'</span><br>';
|
||||
$boxwork .= '<a class="valignmiddle dashboardlineindicator" href="'.$board->url.'"><span class="dashboardlineindicator'.(($board->nbtodo == 0) ? ' dashboardlineok' : '').'">'.$board->nbtodo.'</span></a>';
|
||||
if ($board->total > 0 && !empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)) {
|
||||
$boxwork .= ' / <a class="valignmiddle dashboardlineindicator" href="' . $board->url . '"><span class="dashboardlineindicator' . (($board->nbtodo == 0) ? ' dashboardlineok' : '') . '">' . price($board->total) . '</span></a>';
|
||||
$boxwork .= ' / <a class="valignmiddle dashboardlineindicator" href="'.$board->url.'"><span class="dashboardlineindicator'.(($board->nbtodo == 0) ? ' dashboardlineok' : '').'">'.price($board->total).'</span></a>';
|
||||
}
|
||||
$boxwork .= '</div>';
|
||||
if ($board->nbtodolate > 0) {
|
||||
$boxwork .= '<div class="dashboardlinelatecoin nowrap">';
|
||||
$boxwork .= '<a title="' . dol_escape_htmltag($textlate) . '" class="valignmiddle dashboardlineindicatorlate' . ($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok') . '" href="' . ((!$board->url_late) ? $board->url : $board->url_late) . '">';
|
||||
$boxwork .= '<a title="'.dol_escape_htmltag($textlate).'" class="valignmiddle dashboardlineindicatorlate'.($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok').'" href="'.((!$board->url_late) ? $board->url : $board->url_late).'">';
|
||||
//$boxwork .= img_picto($textlate, "warning_white", 'class="valigntextbottom"').'';
|
||||
$boxwork .= img_picto($textlate, "warning_white",
|
||||
'class="inline-block hideonsmartphone valigntextbottom"') . '';
|
||||
$boxwork .= '<span class="dashboardlineindicatorlate' . ($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok') . '">';
|
||||
'class="inline-block hideonsmartphone valigntextbottom"').'';
|
||||
$boxwork .= '<span class="dashboardlineindicatorlate'.($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok').'">';
|
||||
$boxwork .= $board->nbtodolate;
|
||||
$boxwork .= '</span>';
|
||||
$boxwork .= '</a>';
|
||||
@@ -854,12 +854,12 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
|
||||
$boxwork .= '</td></tr>';
|
||||
|
||||
$boxwork .= '</table>'; // End table array of working board
|
||||
$boxwork .= '</table>'; // End table array of working board
|
||||
$boxwork .= '</div>';
|
||||
|
||||
if (!empty($isIntopOpenedDashBoard)) {
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="opened-dash-board-wrap"><div class="box-flex-container">' . $openedDashBoard . '</div></div>';
|
||||
print '<div class="opened-dash-board-wrap"><div class="box-flex-container">'.$openedDashBoard.'</div></div>';
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
@@ -898,47 +898,47 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($boxstatFromHook) || !empty($boxstatItems)){
|
||||
$boxstat.='<div class="box">';
|
||||
$boxstat.='<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable boxtablenobottom nohover" width="100%">';
|
||||
$boxstat.='<tr class="liste_titre">';
|
||||
$boxstat.='<th class="liste_titre">';
|
||||
$boxstat.='<div class="inline-block valignmiddle">'.$langs->trans("DolibarrStateBoard").'</div>';
|
||||
$boxstat.='</th>';
|
||||
$boxstat.='</tr>';
|
||||
$boxstat.='<tr class="nobottom nohover"><td class="tdboxstats nohover flexcontainer">';
|
||||
if (!empty($boxstatFromHook) || !empty($boxstatItems)) {
|
||||
$boxstat .= '<div class="box">';
|
||||
$boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable boxtablenobottom nohover" width="100%">';
|
||||
$boxstat .= '<tr class="liste_titre">';
|
||||
$boxstat .= '<th class="liste_titre">';
|
||||
$boxstat .= '<div class="inline-block valignmiddle">'.$langs->trans("DolibarrStateBoard").'</div>';
|
||||
$boxstat .= '</th>';
|
||||
$boxstat .= '</tr>';
|
||||
$boxstat .= '<tr class="nobottom nohover"><td class="tdboxstats nohover flexcontainer">';
|
||||
|
||||
$boxstat.=$boxstatFromHook;
|
||||
$boxstat .= $boxstatFromHook;
|
||||
|
||||
if(is_array($boxstatItems) && count($boxstatItems) > 0)
|
||||
if (is_array($boxstatItems) && count($boxstatItems) > 0)
|
||||
{
|
||||
$boxstat.= implode('', $boxstatItems);
|
||||
$boxstat .= implode('', $boxstatItems);
|
||||
}
|
||||
|
||||
$boxstat.='<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
|
||||
$boxstat.='<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
|
||||
$boxstat.='<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
|
||||
$boxstat.='<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
|
||||
$boxstat.='<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
|
||||
$boxstat.='<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
|
||||
$boxstat.='<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
|
||||
$boxstat.='<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
|
||||
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
|
||||
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
|
||||
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
|
||||
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
|
||||
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
|
||||
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
|
||||
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
|
||||
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
|
||||
|
||||
$boxstat.='</td></tr>';
|
||||
$boxstat.='</table>';
|
||||
$boxstat.='</div>';
|
||||
$boxstat .= '</td></tr>';
|
||||
$boxstat .= '</table>';
|
||||
$boxstat .= '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
$boxlist.= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
|
||||
$boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
|
||||
|
||||
$boxlist.=$boxstat;
|
||||
$boxlist.=$resultboxes['boxlistb'];
|
||||
$boxlist .= $boxstat;
|
||||
$boxlist .= $resultboxes['boxlistb'];
|
||||
|
||||
$boxlist.= '</div>';
|
||||
$boxlist.= "\n";
|
||||
$boxlist .= '</div>';
|
||||
$boxlist .= "\n";
|
||||
|
||||
$boxlist.='</div>';
|
||||
$boxlist .= '</div>';
|
||||
|
||||
|
||||
print $boxlist;
|
||||
@@ -953,15 +953,15 @@ print '</div>';
|
||||
// Security warning repertoire install existe (si utilisateur admin)
|
||||
if ($user->admin && empty($conf->global->MAIN_REMOVE_INSTALL_WARNING))
|
||||
{
|
||||
$message='';
|
||||
$message = '';
|
||||
|
||||
// Check if install lock file is present
|
||||
$lockfile=DOL_DATA_ROOT.'/install.lock';
|
||||
if (! empty($lockfile) && ! file_exists($lockfile) && is_dir(DOL_DOCUMENT_ROOT."/install"))
|
||||
$lockfile = DOL_DATA_ROOT.'/install.lock';
|
||||
if (!empty($lockfile) && !file_exists($lockfile) && is_dir(DOL_DOCUMENT_ROOT."/install"))
|
||||
{
|
||||
$langs->load("errors");
|
||||
//if (! empty($message)) $message.='<br>';
|
||||
$message.=info_admin($langs->trans("WarningLockFileDoesNotExists", DOL_DATA_ROOT).' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth');
|
||||
$message .= info_admin($langs->trans("WarningLockFileDoesNotExists", DOL_DATA_ROOT).' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth');
|
||||
}
|
||||
|
||||
// Conf files must be in read only mode
|
||||
@@ -970,7 +970,7 @@ if ($user->admin && empty($conf->global->MAIN_REMOVE_INSTALL_WARNING))
|
||||
$langs->load("errors");
|
||||
//$langs->load("other");
|
||||
//if (! empty($message)) $message.='<br>';
|
||||
$message.=info_admin($langs->transnoentities("WarningConfFileMustBeReadOnly").' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth');
|
||||
$message .= info_admin($langs->transnoentities("WarningConfFileMustBeReadOnly").' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth');
|
||||
}
|
||||
|
||||
if ($message)
|
||||
@@ -1021,48 +1021,48 @@ function getWeatherStatus($totallate)
|
||||
$weather = new stdClass();
|
||||
$weather->picto = '';
|
||||
|
||||
$offset=0;
|
||||
$factor=10; // By default
|
||||
$offset = 0;
|
||||
$factor = 10; // By default
|
||||
|
||||
$used_conf = !empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'MAIN_METEO_PERCENTAGE_LEVEL' : 'MAIN_METEO_LEVEL';
|
||||
|
||||
$level0=$offset;
|
||||
$weather->level=0;
|
||||
if (! empty($conf->global->{$used_conf.'0'})) {
|
||||
$level0=$conf->global->{$used_conf.'0'};
|
||||
$level0 = $offset;
|
||||
$weather->level = 0;
|
||||
if (!empty($conf->global->{$used_conf.'0'})) {
|
||||
$level0 = $conf->global->{$used_conf.'0'};
|
||||
}
|
||||
$level1=$offset+1*$factor;
|
||||
if (! empty($conf->global->{$used_conf.'1'})) {
|
||||
$level1=$conf->global->{$used_conf.'1'};
|
||||
$level1 = $offset + 1 * $factor;
|
||||
if (!empty($conf->global->{$used_conf.'1'})) {
|
||||
$level1 = $conf->global->{$used_conf.'1'};
|
||||
}
|
||||
$level2=$offset+2*$factor;
|
||||
if (! empty($conf->global->{$used_conf.'2'})) {
|
||||
$level2=$conf->global->{$used_conf.'2'};
|
||||
$level2 = $offset + 2 * $factor;
|
||||
if (!empty($conf->global->{$used_conf.'2'})) {
|
||||
$level2 = $conf->global->{$used_conf.'2'};
|
||||
}
|
||||
$level3=$offset+3*$factor;
|
||||
if (! empty($conf->global->{$used_conf.'3'})) {
|
||||
$level3=$conf->global->{$used_conf.'3'};
|
||||
$level3 = $offset + 3 * $factor;
|
||||
if (!empty($conf->global->{$used_conf.'3'})) {
|
||||
$level3 = $conf->global->{$used_conf.'3'};
|
||||
}
|
||||
|
||||
if ($totallate <= $level0){
|
||||
if ($totallate <= $level0) {
|
||||
$weather->picto = 'weather-clear.png';
|
||||
$weather->level=0;
|
||||
$weather->level = 0;
|
||||
}
|
||||
elseif ($totallate <= $level1){
|
||||
elseif ($totallate <= $level1) {
|
||||
$weather->picto = 'weather-few-clouds.png';
|
||||
$weather->level=1;
|
||||
$weather->level = 1;
|
||||
}
|
||||
elseif ($totallate <= $level2){
|
||||
elseif ($totallate <= $level2) {
|
||||
$weather->picto = 'weather-clouds.png';
|
||||
$weather->level=2;
|
||||
$weather->level = 2;
|
||||
}
|
||||
elseif ($totallate <= $level3){
|
||||
elseif ($totallate <= $level3) {
|
||||
$weather->picto = 'weather-many-clouds.png';
|
||||
$weather->level=3;
|
||||
$weather->level = 3;
|
||||
}
|
||||
else{
|
||||
else {
|
||||
$weather->picto = 'weather-storm.png';
|
||||
$weather->level=4;
|
||||
$weather->level = 4;
|
||||
}
|
||||
|
||||
return $weather;
|
||||
|
||||
0
htdocs/install/mysql/tables/llx_c_holiday_types.sql
Executable file → Normal file
0
htdocs/install/mysql/tables/llx_c_holiday_types.sql
Executable file → Normal file
0
htdocs/install/mysql/tables/llx_c_price_expression.sql
Executable file → Normal file
0
htdocs/install/mysql/tables/llx_c_price_expression.sql
Executable file → Normal file
0
htdocs/install/mysql/tables/llx_c_ticket_category.sql
Executable file → Normal file
0
htdocs/install/mysql/tables/llx_c_ticket_category.sql
Executable file → Normal file
0
htdocs/install/mysql/tables/llx_c_ticket_severity.sql
Executable file → Normal file
0
htdocs/install/mysql/tables/llx_c_ticket_severity.sql
Executable file → Normal file
0
htdocs/install/mysql/tables/llx_c_ticket_type.sql
Executable file → Normal file
0
htdocs/install/mysql/tables/llx_c_ticket_type.sql
Executable file → Normal file
0
htdocs/install/mysql/tables/llx_expensereport.sql
Executable file → Normal file
0
htdocs/install/mysql/tables/llx_expensereport.sql
Executable file → Normal file
0
htdocs/install/mysql/tables/llx_product.sql
Executable file → Normal file
0
htdocs/install/mysql/tables/llx_product.sql
Executable file → Normal file
0
htdocs/install/mysql/tables/llx_product_fournisseur_price.sql
Executable file → Normal file
0
htdocs/install/mysql/tables/llx_product_fournisseur_price.sql
Executable file → Normal file
0
htdocs/install/mysql/tables/llx_product_price.sql
Executable file → Normal file
0
htdocs/install/mysql/tables/llx_product_price.sql
Executable file → Normal file
0
htdocs/install/mysql/tables/llx_ticket.key.sql
Executable file → Normal file
0
htdocs/install/mysql/tables/llx_ticket.key.sql
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
@@ -268,6 +268,7 @@ Emails=Emails
|
||||
EMailsSetup=Emails setup
|
||||
EMailsDesc=This page allows you to override your default PHP parameters for email sending. In most cases on Unix/Linux OS, the PHP setup is correct and these parameters are unnecessary.
|
||||
EmailSenderProfiles=Emails sender profiles
|
||||
EMailsSenderProfileDesc=You can keep this section empty. If you enter some emails here, they will be added to the list of possible senders into the combobox when your write a new email.
|
||||
MAIN_MAIL_SMTP_PORT=SMTP/SMTPS Port (default value in php.ini: <b>%s</b>)
|
||||
MAIN_MAIL_SMTP_SERVER=SMTP/SMTPS Host (default value in php.ini: <b>%s</b>)
|
||||
MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike=SMTP/SMTPS Port (Not defined into PHP on Unix-like systems)
|
||||
@@ -903,6 +904,7 @@ Permission20003=Delete leave requests
|
||||
Permission20004=Read all leave requests (even of user not subordinates)
|
||||
Permission20005=Create/modify leave requests for everybody (even of user not subordinates)
|
||||
Permission20006=Admin leave requests (setup and update balance)
|
||||
Permission20007=Approve leave requests
|
||||
Permission23001=Read Scheduled job
|
||||
Permission23002=Create/update Scheduled job
|
||||
Permission23003=Delete Scheduled job
|
||||
|
||||
@@ -127,4 +127,5 @@ HolidaysNumberingModules=Leave requests numbering models
|
||||
TemplatePDFHolidays=Template for leave requests PDF
|
||||
FreeLegalTextOnHolidays=Free text on PDF
|
||||
WatermarkOnDraftHolidayCards=Watermarks on draft leave requests
|
||||
HolidaysToApprove=Holidays to approve
|
||||
HolidaysToApprove=Holidays to approve
|
||||
NobodyHasPermissionToValidateHolidays=Nobody has permission to validate holidays
|
||||
|
||||
@@ -22,42 +22,42 @@
|
||||
* \brief File to return datables output
|
||||
*/
|
||||
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
|
||||
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
||||
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
|
||||
require '../main.inc.php';
|
||||
require DOL_DOCUMENT_ROOT.'/loan/class/loanschedule.class.php';
|
||||
|
||||
$mens=GETPOST('mens');
|
||||
$capital=GETPOST('capital');
|
||||
$rate=GETPOST('rate');
|
||||
$echance=GETPOST('echeance');
|
||||
$nbterm=GETPOST('nbterm');
|
||||
$mens = GETPOST('mens');
|
||||
$capital = GETPOST('capital');
|
||||
$rate = GETPOST('rate');
|
||||
$echance = GETPOST('echeance');
|
||||
$nbterm = GETPOST('nbterm');
|
||||
|
||||
top_httphead();
|
||||
|
||||
$output=array();
|
||||
$output = array();
|
||||
|
||||
$object = new LoanSchedule($db);
|
||||
|
||||
$int = ($capital*($rate/12));
|
||||
$int = ($capital * ($rate / 12));
|
||||
$int = round($int, 2, PHP_ROUND_HALF_UP);
|
||||
$cap_rest = round($capital - ($mens-$int), 2, PHP_ROUND_HALF_UP);
|
||||
$output[$echance]=array('cap_rest'=>$cap_rest,'cap_rest_str'=>price($cap_rest),'interet'=>$int,'interet_str'=>price($int, 0, '', 1),'mens'=>$mens);
|
||||
$cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP);
|
||||
$output[$echance] = array('cap_rest'=>$cap_rest, 'cap_rest_str'=>price($cap_rest), 'interet'=>$int, 'interet_str'=>price($int, 0, '', 1), 'mens'=>$mens);
|
||||
|
||||
$echance++;
|
||||
$capital=$cap_rest;
|
||||
while ($echance<=$nbterm) {
|
||||
$mens = round($object->calcMonthlyPayments($capital, $rate, $nbterm-$echance+1), 2, PHP_ROUND_HALF_UP);
|
||||
$capital = $cap_rest;
|
||||
while ($echance <= $nbterm) {
|
||||
$mens = round($object->calcMonthlyPayments($capital, $rate, $nbterm - $echance + 1), 2, PHP_ROUND_HALF_UP);
|
||||
|
||||
$int = ($capital*($rate/12));
|
||||
$int = ($capital * ($rate / 12));
|
||||
$int = round($int, 2, PHP_ROUND_HALF_UP);
|
||||
$cap_rest = round($capital - ($mens-$int), 2, PHP_ROUND_HALF_UP);
|
||||
$cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP);
|
||||
|
||||
$output[$echance]=array('cap_rest'=>$cap_rest,'cap_rest_str'=>price($cap_rest),'interet'=>$int,'interet_str'=>price($int, 0, '', 1),'mens'=>$mens);
|
||||
$output[$echance] = array('cap_rest'=>$cap_rest, 'cap_rest_str'=>price($cap_rest), 'interet'=>$int, 'interet_str'=>price($int, 0, '', 1), 'mens'=>$mens);
|
||||
|
||||
$capital=$cap_rest;
|
||||
$capital = $cap_rest;
|
||||
$echance++;
|
||||
}
|
||||
|
||||
|
||||
@@ -137,14 +137,14 @@ $arrayfields=array();
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
// If $val['visible']==0, then we never show the field
|
||||
if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']);
|
||||
if (!empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']);
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
||||
{
|
||||
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attributes[$object->table_element]['list'][$key])) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) {
|
||||
$arrayfields["ef.".$key] = array(
|
||||
'label'=>$extrafields->attributes[$object->table_element]['label'][$key],
|
||||
'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1),
|
||||
@@ -282,13 +282,13 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
}
|
||||
}
|
||||
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
|
||||
if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
|
||||
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit)))
|
||||
{
|
||||
$num = $nbtotalofrecords;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
if ($limit) $sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql)
|
||||
@@ -481,7 +481,7 @@ if (is_array($extrafields->attributes[$object->table_element]['computed']) && co
|
||||
// --------------------------------------------------------------------
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
while ($i < min($num, $limit))
|
||||
while ($i < ($limit ? min($num, $limit) : $num))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) break; // Should not happen
|
||||
|
||||
@@ -40,19 +40,19 @@ if (!$user->rights->opensurvey->write) accessforbidden();
|
||||
if (isset($_SESSION["nbrecases"])) {
|
||||
for ($i = 0; $i < $_SESSION["nbrecases"]; $i++) {
|
||||
if (isset($_POST["choix"][$i])) {
|
||||
$_SESSION["choix$i"]=$_POST["choix"][$i];
|
||||
$_SESSION["choix$i"] = $_POST["choix"][$i];
|
||||
}
|
||||
if (isset($_POST["typecolonne"][$i])) {
|
||||
$_SESSION["typecolonne$i"]=$_POST["typecolonne"][$i];
|
||||
$_SESSION["typecolonne$i"] = $_POST["typecolonne"][$i];
|
||||
}
|
||||
}
|
||||
} else { //nombre de cases par défaut
|
||||
$_SESSION["nbrecases"]=5;
|
||||
$_SESSION["nbrecases"] = 5;
|
||||
}
|
||||
|
||||
if (GETPOST("ajoutcases") || GETPOST("ajoutcases_x"))
|
||||
{
|
||||
$_SESSION["nbrecases"]=$_SESSION["nbrecases"]+5;
|
||||
$_SESSION["nbrecases"] = $_SESSION["nbrecases"] + 5;
|
||||
}
|
||||
|
||||
// Create survey into database
|
||||
@@ -62,23 +62,23 @@ if (isset($_POST["confirmecreation"]))
|
||||
$toutchoix = '';
|
||||
for ($i = 0; $i < $_SESSION["nbrecases"] + 1; $i++)
|
||||
{
|
||||
if (! empty($_POST["choix"][$i]))
|
||||
if (!empty($_POST["choix"][$i]))
|
||||
{
|
||||
$toutchoix.=',';
|
||||
$toutchoix.=str_replace(array(",","@"), " ", $_POST["choix"][$i]).(empty($_POST["typecolonne"][$i])?'':'@'.$_POST["typecolonne"][$i]);
|
||||
$toutchoix .= ',';
|
||||
$toutchoix .= str_replace(array(",", "@"), " ", $_POST["choix"][$i]).(empty($_POST["typecolonne"][$i]) ? '' : '@'.$_POST["typecolonne"][$i]);
|
||||
}
|
||||
}
|
||||
|
||||
$toutchoix=substr("$toutchoix", 1);
|
||||
$_SESSION["toutchoix"]=$toutchoix;
|
||||
$toutchoix = substr("$toutchoix", 1);
|
||||
$_SESSION["toutchoix"] = $toutchoix;
|
||||
|
||||
//test de remplissage des cases
|
||||
$testremplissage = '';
|
||||
for ($i=0;$i<$_SESSION["nbrecases"];$i++)
|
||||
for ($i = 0; $i < $_SESSION["nbrecases"]; $i++)
|
||||
{
|
||||
if (isset($_POST["choix"][$i]))
|
||||
{
|
||||
$testremplissage="ok";
|
||||
$testremplissage = "ok";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ if (isset($_POST["confirmecreation"]))
|
||||
setEventMessages($langs->trans("ErrorOpenSurveyOneChoice"), null, 'errors');
|
||||
} else {
|
||||
//format du sondage AUTRE
|
||||
$_SESSION["formatsondage"]="A";
|
||||
$_SESSION["formatsondage"] = "A";
|
||||
|
||||
// Add into database
|
||||
ajouter_sondage();
|
||||
@@ -101,10 +101,10 @@ if (isset($_POST["confirmecreation"]))
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
$arrayofjs=array();
|
||||
$arrayofcss=array('/opensurvey/css/style.css');
|
||||
$arrayofjs = array();
|
||||
$arrayofcss = array('/opensurvey/css/style.css');
|
||||
llxHeader('', $langs->trans("OpenSurvey"), "", '', 0, 0, $arrayofjs, $arrayofcss);
|
||||
|
||||
if (empty($_SESSION['titre']))
|
||||
@@ -123,7 +123,7 @@ print '<form name="formulaire" action="#bas" method="POST">'."\n";
|
||||
print load_fiche_titre($langs->trans("CreatePoll").' (2 / 2)');
|
||||
|
||||
|
||||
print '<br>'. $langs->trans("PollOnChoice") .'<br><br>'."\n";
|
||||
print '<br>'.$langs->trans("PollOnChoice").'<br><br>'."\n";
|
||||
|
||||
print '<div class=corps>'."\n";
|
||||
print '<table>'."\n";
|
||||
@@ -134,8 +134,8 @@ for ($i = 0; $i < $_SESSION["nbrecases"]; $i++) {
|
||||
if (isset($_SESSION["choix$i"]) === false) {
|
||||
$_SESSION["choix$i"] = '';
|
||||
}
|
||||
print '<tr><td>'. $langs->trans("TitleChoice") .' '.$j.': </td><td><input type="text" name="choix[]" size="40" maxlength="40" value="'.dol_escape_htmltag($_SESSION["choix$i"]).'" id="choix'.$i.'">';
|
||||
$tmparray=array('checkbox'=>$langs->trans("CheckBox"),'yesno'=>$langs->trans("YesNoList"),'foragainst'=>$langs->trans("PourContreList"));
|
||||
print '<tr><td>'.$langs->trans("TitleChoice").' '.$j.': </td><td><input type="text" name="choix[]" size="40" maxlength="40" value="'.dol_escape_htmltag($_SESSION["choix$i"]).'" id="choix'.$i.'">';
|
||||
$tmparray = array('checkbox'=>$langs->trans("CheckBox"), 'yesno'=>$langs->trans("YesNoList"), 'foragainst'=>$langs->trans("PourContreList"));
|
||||
print ' '.$langs->trans("Type").' '.$form->selectarray("typecolonne[]", $tmparray, $_SESSION["typecolonne$i"]);
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
@@ -144,7 +144,7 @@ print '</table>'."\n";
|
||||
|
||||
//ajout de cases supplementaires
|
||||
print '<table><tr>'."\n";
|
||||
print '<td>'. $langs->trans("5MoreChoices") .'</td><td><input type="image" name="ajoutcases" src="../img/add-16.png"></td>'."\n";
|
||||
print '<td>'.$langs->trans("5MoreChoices").'</td><td><input type="image" name="ajoutcases" src="../img/add-16.png"></td>'."\n";
|
||||
print '</tr></table>'."\n";
|
||||
print'<br>'."\n";
|
||||
|
||||
|
||||
@@ -22,13 +22,13 @@
|
||||
* \brief File to return Ajax response on product list request
|
||||
*/
|
||||
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
|
||||
if (empty($_GET['keysearch']) && ! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
||||
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal
|
||||
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
||||
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
||||
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
||||
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
|
||||
if (empty($_GET['keysearch']) && !defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
@@ -57,9 +57,9 @@ $hidepriceinlabel = GETPOST('hidepriceinlabel', 'int');
|
||||
dol_syslog(join(',', $_GET));
|
||||
// print_r($_GET);
|
||||
|
||||
if (! empty($action) && $action == 'fetch' && ! empty($id))
|
||||
if (!empty($action) && $action == 'fetch' && !empty($id))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
|
||||
$outjson = array();
|
||||
|
||||
@@ -77,11 +77,11 @@ if (! empty($action) && $action == 'fetch' && ! empty($id))
|
||||
$found = false;
|
||||
|
||||
// Price by qty
|
||||
if (! empty($price_by_qty_rowid) && $price_by_qty_rowid >= 1 && (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY))) // If we need a particular price related to qty
|
||||
if (!empty($price_by_qty_rowid) && $price_by_qty_rowid >= 1 && (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY))) // If we need a particular price related to qty
|
||||
{
|
||||
$sql = "SELECT price, unitprice, quantity, remise_percent";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "product_price_by_qty ";
|
||||
$sql .= " WHERE rowid=" . $price_by_qty_rowid . "";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_price_by_qty ";
|
||||
$sql .= " WHERE rowid=".$price_by_qty_rowid."";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
@@ -99,14 +99,14 @@ if (! empty($action) && $action == 'fetch' && ! empty($id))
|
||||
}
|
||||
|
||||
// Multiprice
|
||||
if (! $found && isset($price_level) && $price_level >= 1 && (! empty($conf->global->PRODUIT_MULTIPRICES))) // If we need a particular price
|
||||
if (!$found && isset($price_level) && $price_level >= 1 && (!empty($conf->global->PRODUIT_MULTIPRICES))) // If we need a particular price
|
||||
// level (from 1 to 6)
|
||||
{
|
||||
$sql = "SELECT price, price_ttc, price_base_type, tva_tx";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "product_price ";
|
||||
$sql .= " WHERE fk_product='" . $id . "'";
|
||||
$sql .= " AND entity IN (" . getEntity('productprice') . ")";
|
||||
$sql .= " AND price_level=" . $price_level;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_price ";
|
||||
$sql .= " WHERE fk_product='".$id."'";
|
||||
$sql .= " AND entity IN (".getEntity('productprice').")";
|
||||
$sql .= " AND price_level=".$price_level;
|
||||
$sql .= " ORDER BY date_price";
|
||||
$sql .= " DESC LIMIT 1";
|
||||
|
||||
@@ -124,12 +124,12 @@ if (! empty($action) && $action == 'fetch' && ! empty($id))
|
||||
}
|
||||
|
||||
// Price by customer
|
||||
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES) && ! empty($socid)) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
|
||||
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php';
|
||||
|
||||
$prodcustprice = new Productcustomerprice($db);
|
||||
|
||||
$filter = array('t.fk_product' => $object->id,'t.fk_soc' => $socid);
|
||||
$filter = array('t.fk_product' => $object->id, 't.fk_soc' => $socid);
|
||||
|
||||
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
||||
if ($result) {
|
||||
@@ -143,21 +143,21 @@ if (! empty($action) && $action == 'fetch' && ! empty($id))
|
||||
}
|
||||
}
|
||||
|
||||
if (! $found) {
|
||||
if (!$found) {
|
||||
$outprice_ht = price($object->price);
|
||||
$outprice_ttc = price($object->price_ttc);
|
||||
$outpricebasetype = $object->price_base_type;
|
||||
$outtva_tx = $object->tva_tx;
|
||||
}
|
||||
|
||||
$outjson = array('ref' => $outref,'label' => $outlabel,'desc' => $outdesc,'type' => $outtype,'price_ht' => $outprice_ht,'price_ttc' => $outprice_ttc,'pricebasetype' => $outpricebasetype,'tva_tx' => $outtva_tx,'qty' => $outqty,'discount' => $outdiscount);
|
||||
$outjson = array('ref' => $outref, 'label' => $outlabel, 'desc' => $outdesc, 'type' => $outtype, 'price_ht' => $outprice_ht, 'price_ttc' => $outprice_ttc, 'pricebasetype' => $outpricebasetype, 'tva_tx' => $outtva_tx, 'qty' => $outqty, 'discount' => $outdiscount);
|
||||
}
|
||||
|
||||
echo json_encode($outjson);
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||
|
||||
$langs->load("products");
|
||||
$langs->load("main");
|
||||
@@ -170,19 +170,19 @@ else
|
||||
return;
|
||||
}
|
||||
|
||||
$match = preg_grep('/(' . $htmlname . '[0-9]+)/', array_keys($_GET));
|
||||
$match = preg_grep('/('.$htmlname.'[0-9]+)/', array_keys($_GET));
|
||||
sort($match);
|
||||
|
||||
$idprod = (! empty($match[0]) ? $match[0] : '');
|
||||
$idprod = (!empty($match[0]) ? $match[0] : '');
|
||||
|
||||
if (GETPOST($htmlname, 'alpha') == '' && (! $idprod || ! GETPOST($idprod, 'alpha')))
|
||||
if (GETPOST($htmlname, 'alpha') == '' && (!$idprod || !GETPOST($idprod, 'alpha')))
|
||||
{
|
||||
print json_encode(array());
|
||||
return;
|
||||
}
|
||||
|
||||
// When used from jQuery, the search term is added as GET param "term".
|
||||
$searchkey = (($idprod && GETPOST($idprod, 'alpha')) ? GETPOST($idprod, 'alpha') : (GETPOST($htmlname, 'alpha') ? GETPOST($htmlname, 'alpha') : ''));
|
||||
$searchkey = (($idprod && GETPOST($idprod, 'alpha')) ? GETPOST($idprod, 'alpha') : (GETPOST($htmlname, 'alpha') ? GETPOST($htmlname, 'alpha') : ''));
|
||||
|
||||
$form = new Form($db);
|
||||
if (empty($mode) || $mode == 1) { // mode=1: customer
|
||||
|
||||
@@ -16,16 +16,16 @@
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
if (empty($conf) || !is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$object=$GLOBALS['object'];
|
||||
$object = $GLOBALS['object'];
|
||||
|
||||
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
|
||||
$statutarray = array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
@@ -35,7 +35,7 @@ print load_fiche_titre($langs->trans("NewProduct"), '', 'products');
|
||||
dol_fiche_head('');
|
||||
?>
|
||||
|
||||
<?php dol_htmloutput_errors((is_numeric($object->error)?'':$object->error), $object->errors); ?>
|
||||
<?php dol_htmloutput_errors((is_numeric($object->error) ? '' : $object->error), $object->errors); ?>
|
||||
|
||||
<?php dol_htmloutput_errors($GLOBALS['mesg'], $GLOBALS['mesgs']); ?>
|
||||
|
||||
@@ -71,7 +71,7 @@ dol_fiche_head('');
|
||||
<td><?php echo $form->selectarray('statut_buy', $statutarray, $object->status_buy); ?></td>
|
||||
</tr>
|
||||
|
||||
<?php if (! empty($conf->stock->enabled)) { ?>
|
||||
<?php if (!empty($conf->stock->enabled)) { ?>
|
||||
<tr><td><?php echo $langs->trans("StockLimit"); ?></td><td>
|
||||
<input name="seuil_stock_alerte" size="4" value="<?php echo $object->seuil_stock_alerte; ?>">
|
||||
</td></tr>
|
||||
@@ -108,7 +108,7 @@ dol_fiche_head('');
|
||||
|
||||
<br>
|
||||
|
||||
<?php if (! $conf->global->PRODUIT_MULTIPRICES) { ?>
|
||||
<?php if (!$conf->global->PRODUIT_MULTIPRICES) { ?>
|
||||
<table class="border allwidth">
|
||||
|
||||
<tr><td><?php echo $langs->trans("SellingPrice"); ?></td>
|
||||
|
||||
@@ -16,16 +16,16 @@
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
if (empty($conf) || !is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$object=$GLOBALS['object'];
|
||||
$object = $GLOBALS['object'];
|
||||
|
||||
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
|
||||
$statutarray = array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE CREATE.TPL -->
|
||||
@@ -80,7 +80,7 @@ dol_fiche_head('');
|
||||
|
||||
<br>
|
||||
|
||||
<?php if (! $conf->global->PRODUIT_MULTIPRICES) { ?>
|
||||
<?php if (!$conf->global->PRODUIT_MULTIPRICES) { ?>
|
||||
<table class="border allwidth">
|
||||
|
||||
<tr><td><?php echo $langs->trans("SellingPrice"); ?></td>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
* \ingroup produit
|
||||
* \brief File of class to manage predefined price products or services by customer
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
|
||||
/**
|
||||
* File of class to manage predefined price products or services by customer
|
||||
@@ -73,7 +73,7 @@ class Productcustomerprice extends CommonObject
|
||||
*/
|
||||
public $fk_user;
|
||||
|
||||
public $lines = array ();
|
||||
public $lines = array();
|
||||
|
||||
|
||||
/**
|
||||
@@ -166,7 +166,7 @@ class Productcustomerprice extends CommonObject
|
||||
}
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_customer_price(";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_customer_price(";
|
||||
$sql .= "entity,";
|
||||
$sql .= "datec,";
|
||||
$sql .= "fk_product,";
|
||||
@@ -186,39 +186,39 @@ class Productcustomerprice extends CommonObject
|
||||
$sql .= "fk_user,";
|
||||
$sql .= "import_key";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= " " . $conf->entity . ",";
|
||||
$sql .= " '" . $this->db->idate(dol_now()) . "',";
|
||||
$sql .= " " . (! isset($this->fk_product) ? 'NULL' : "'" . $this->db->escape($this->fk_product) . "'") . ",";
|
||||
$sql .= " " . (! isset($this->fk_soc) ? 'NULL' : "'" . $this->db->escape($this->fk_soc) . "'") . ",";
|
||||
$sql .= " " . (empty($this->price) ? '0' : "'" . $this->db->escape($this->price) . "'") . ",";
|
||||
$sql .= " " . (empty($this->price_ttc) ? '0' : "'" . $this->db->escape($this->price_ttc) . "'") . ",";
|
||||
$sql .= " " . (empty($this->price_min) ? '0' : "'" . $this->db->escape($this->price_min) . "'") . ",";
|
||||
$sql .= " " . (empty($this->price_min_ttc) ? '0' : "'" . $this->db->escape($this->price_min_ttc) . "'") . ",";
|
||||
$sql .= " " . (! isset($this->price_base_type) ? 'NULL' : "'" . $this->db->escape($this->price_base_type) . "'") . ",";
|
||||
$sql .= " ".$conf->entity.",";
|
||||
$sql .= " '".$this->db->idate(dol_now())."',";
|
||||
$sql .= " ".(!isset($this->fk_product) ? 'NULL' : "'".$this->db->escape($this->fk_product)."'").",";
|
||||
$sql .= " ".(!isset($this->fk_soc) ? 'NULL' : "'".$this->db->escape($this->fk_soc)."'").",";
|
||||
$sql .= " ".(empty($this->price) ? '0' : "'".$this->db->escape($this->price)."'").",";
|
||||
$sql .= " ".(empty($this->price_ttc) ? '0' : "'".$this->db->escape($this->price_ttc)."'").",";
|
||||
$sql .= " ".(empty($this->price_min) ? '0' : "'".$this->db->escape($this->price_min)."'").",";
|
||||
$sql .= " ".(empty($this->price_min_ttc) ? '0' : "'".$this->db->escape($this->price_min_ttc)."'").",";
|
||||
$sql .= " ".(!isset($this->price_base_type) ? 'NULL' : "'".$this->db->escape($this->price_base_type)."'").",";
|
||||
$sql .= " ".($this->default_vat_code ? "'".$this->db->escape($this->default_vat_code)."'" : "null").",";
|
||||
$sql .= " " . (! isset($this->tva_tx) ? 'NULL' : (empty($this->tva_tx)?0:$this->tva_tx)) . ",";
|
||||
$sql .= " " . (! isset($this->recuperableonly) ? 'NULL' : "'" . $this->db->escape($this->recuperableonly) . "'") . ",";
|
||||
$sql .= " " . (empty($this->localtax1_type) ? "'0'" : "'" . $this->db->escape($this->localtax1_type) . "'") . ",";
|
||||
$sql .= " " . (! isset($this->localtax1_tx) ? 'NULL' : (empty($this->localtax1_tx)?0:$this->localtax1_tx)) . ",";
|
||||
$sql .= " " . (empty($this->localtax2_type) ? "'0'" : "'" . $this->db->escape($this->localtax2_type) . "'") . ",";
|
||||
$sql .= " " . (! isset($this->localtax2_tx) ? 'NULL' : (empty($this->localtax2_tx)?0:$this->localtax2_tx)) . ",";
|
||||
$sql .= " " . $user->id . ",";
|
||||
$sql .= " " . (! isset($this->import_key) ? 'NULL' : "'" . $this->db->escape($this->import_key) . "'") . "";
|
||||
$sql .= " ".(!isset($this->tva_tx) ? 'NULL' : (empty($this->tva_tx) ? 0 : $this->tva_tx)).",";
|
||||
$sql .= " ".(!isset($this->recuperableonly) ? 'NULL' : "'".$this->db->escape($this->recuperableonly)."'").",";
|
||||
$sql .= " ".(empty($this->localtax1_type) ? "'0'" : "'".$this->db->escape($this->localtax1_type)."'").",";
|
||||
$sql .= " ".(!isset($this->localtax1_tx) ? 'NULL' : (empty($this->localtax1_tx) ? 0 : $this->localtax1_tx)).",";
|
||||
$sql .= " ".(empty($this->localtax2_type) ? "'0'" : "'".$this->db->escape($this->localtax2_type)."'").",";
|
||||
$sql .= " ".(!isset($this->localtax2_tx) ? 'NULL' : (empty($this->localtax2_tx) ? 0 : $this->localtax2_tx)).",";
|
||||
$sql .= " ".$user->id.",";
|
||||
$sql .= " ".(!isset($this->import_key) ? 'NULL' : "'".$this->db->escape($this->import_key)."'")."";
|
||||
$sql .= ")";
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this) . "::create", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error ++;
|
||||
$this->errors [] = "Error " . $this->db->lasterror();
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors [] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "product_customer_price");
|
||||
if (!$error) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."product_customer_price");
|
||||
|
||||
if (! $notrigger) {
|
||||
if (!$notrigger) {
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
@@ -231,21 +231,21 @@ class Productcustomerprice extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
if (!$error) {
|
||||
$result = $this->setPriceOnAffiliateThirdparty($user, $forceupdateaffiliate);
|
||||
if ($result < 0) {
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
foreach ($this->errors as $errmsg) {
|
||||
dol_syslog(get_class($this) . "::create " . $errmsg, LOG_ERR);
|
||||
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
|
||||
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
|
||||
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return - 1 * $error;
|
||||
return -1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
@@ -283,10 +283,10 @@ class Productcustomerprice extends CommonObject
|
||||
$sql .= " t.fk_user,";
|
||||
$sql .= " t.import_key";
|
||||
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "product_customer_price as t";
|
||||
$sql .= " WHERE t.rowid = " . $id;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_customer_price as t";
|
||||
$sql .= " WHERE t.rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this) . "::fetch", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
if ($this->db->num_rows($resql)) {
|
||||
@@ -316,8 +316,8 @@ class Productcustomerprice extends CommonObject
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
return - 1;
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,8 +337,8 @@ class Productcustomerprice extends CommonObject
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
if ( empty($sortfield)) $sortfield = "t.rowid";
|
||||
if ( empty($sortorder)) $sortorder = "DESC";
|
||||
if (empty($sortfield)) $sortfield = "t.rowid";
|
||||
if (empty($sortorder)) $sortorder = "DESC";
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql .= " t.rowid,";
|
||||
@@ -364,39 +364,39 @@ class Productcustomerprice extends CommonObject
|
||||
$sql .= " t.import_key,";
|
||||
$sql .= " soc.nom as socname,";
|
||||
$sql .= " prod.ref as prodref";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "product_customer_price as t ";
|
||||
$sql .= " ," . MAIN_DB_PREFIX . "product as prod ";
|
||||
$sql .= " ," . MAIN_DB_PREFIX . "societe as soc ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_customer_price as t ";
|
||||
$sql .= " ,".MAIN_DB_PREFIX."product as prod ";
|
||||
$sql .= " ,".MAIN_DB_PREFIX."societe as soc ";
|
||||
$sql .= " WHERE soc.rowid=t.fk_soc ";
|
||||
$sql .= " AND prod.rowid=t.fk_product ";
|
||||
$sql .= " AND prod.entity IN (" . getEntity('product') . ")";
|
||||
$sql .= " AND t.entity IN (" . getEntity('productprice') . ")";
|
||||
$sql .= " AND prod.entity IN (".getEntity('product').")";
|
||||
$sql .= " AND t.entity IN (".getEntity('productprice').")";
|
||||
|
||||
// Manage filter
|
||||
if (count($filter) > 0) {
|
||||
foreach ($filter as $key => $value) {
|
||||
if (strpos($key, 'date')) // To allow $filter['YEAR(s.dated)']=>$year
|
||||
{
|
||||
$sql .= ' AND ' . $key . ' = \'' . $value . '\'';
|
||||
$sql .= ' AND '.$key.' = \''.$value.'\'';
|
||||
} elseif ($key == 'soc.nom') {
|
||||
$sql .= ' AND ' . $key . ' LIKE \'%' . $value . '%\'';
|
||||
$sql .= ' AND '.$key.' LIKE \'%'.$value.'%\'';
|
||||
} elseif ($key == 'prod.ref') {
|
||||
$sql .= ' AND ' . $key . ' LIKE \'%' . $value . '%\'';
|
||||
$sql .= ' AND '.$key.' LIKE \'%'.$value.'%\'';
|
||||
} else {
|
||||
$sql .= ' AND ' . $key . ' = ' . $value;
|
||||
$sql .= ' AND '.$key.' = '.$value;
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql.= $this->db->order($sortfield, $sortorder);
|
||||
if (! empty($limit)) $sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
if (!empty($limit)) $sql .= ' '.$this->db->plimit($limit + 1, $offset);
|
||||
|
||||
dol_syslog(get_class($this) . "::fetch_all", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$this->lines = array ();
|
||||
$this->lines = array();
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
while ( $obj = $this->db->fetch_object($resql) ) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$line = new PriceByCustomerLine();
|
||||
|
||||
$line->id = $obj->rowid;
|
||||
@@ -429,8 +429,8 @@ class Productcustomerprice extends CommonObject
|
||||
|
||||
return $num;
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
return - 1;
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,8 +450,8 @@ class Productcustomerprice extends CommonObject
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
if (! empty($sortfield)) $sortfield = "t.rowid";
|
||||
if (! empty($sortorder)) $sortorder = "DESC";
|
||||
if (!empty($sortfield)) $sortfield = "t.rowid";
|
||||
if (!empty($sortorder)) $sortorder = "DESC";
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql .= " t.rowid,";
|
||||
@@ -474,38 +474,38 @@ class Productcustomerprice extends CommonObject
|
||||
$sql .= " t.import_key,";
|
||||
$sql .= " soc.nom as socname,";
|
||||
$sql .= " prod.ref as prodref";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "product_customer_price_log as t ";
|
||||
$sql .= " ," . MAIN_DB_PREFIX . "product as prod ";
|
||||
$sql .= " ," . MAIN_DB_PREFIX . "societe as soc ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_customer_price_log as t ";
|
||||
$sql .= " ,".MAIN_DB_PREFIX."product as prod ";
|
||||
$sql .= " ,".MAIN_DB_PREFIX."societe as soc ";
|
||||
$sql .= " WHERE soc.rowid=t.fk_soc ";
|
||||
$sql .= " AND prod.rowid=t.fk_product ";
|
||||
$sql .= " AND prod.entity IN (" . getEntity('product') . ")";
|
||||
$sql .= " AND t.entity IN (" . getEntity('productprice') . ")";
|
||||
$sql .= " AND prod.entity IN (".getEntity('product').")";
|
||||
$sql .= " AND t.entity IN (".getEntity('productprice').")";
|
||||
|
||||
// Manage filter
|
||||
if (count($filter) > 0) {
|
||||
foreach ($filter as $key => $value) {
|
||||
if (strpos($key, 'date')) // To allow $filter['YEAR(s.dated)']=>$year
|
||||
{
|
||||
$sql .= ' AND ' . $key . ' = \'' . $value . '\'';
|
||||
$sql .= ' AND '.$key.' = \''.$value.'\'';
|
||||
} elseif ($key == 'soc.nom') {
|
||||
$sql .= ' AND ' . $key . ' LIKE \'%' . $value . '%\'';
|
||||
$sql .= ' AND '.$key.' LIKE \'%'.$value.'%\'';
|
||||
} else {
|
||||
$sql .= ' AND ' . $key . ' = ' . $value;
|
||||
$sql .= ' AND '.$key.' = '.$value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql.= $this->db->order($sortfield, $sortorder);
|
||||
if (! empty($limit)) $sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
if (!empty($limit)) $sql .= ' '.$this->db->plimit($limit + 1, $offset);
|
||||
|
||||
dol_syslog(get_class($this) . "::fetch_all_log", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch_all_log", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$this->lines = array ();
|
||||
$this->lines = array();
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
while ( $obj = $this->db->fetch_object($resql) ) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$line = new PriceByCustomerLine();
|
||||
|
||||
$line->id = $obj->rowid;
|
||||
@@ -536,8 +536,8 @@ class Productcustomerprice extends CommonObject
|
||||
|
||||
return $num;
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
return - 1;
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -622,7 +622,7 @@ class Productcustomerprice extends CommonObject
|
||||
|
||||
// Do a copy of current record into log table
|
||||
// Insert request
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_customer_price_log(";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_customer_price_log(";
|
||||
|
||||
$sql .= "entity,";
|
||||
$sql .= "datec,";
|
||||
@@ -665,75 +665,75 @@ class Productcustomerprice extends CommonObject
|
||||
$sql .= " t.fk_user,";
|
||||
$sql .= " t.import_key";
|
||||
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "product_customer_price as t";
|
||||
$sql .= " WHERE t.rowid = " . $this->id;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_customer_price as t";
|
||||
$sql .= " WHERE t.rowid = ".$this->id;
|
||||
|
||||
$this->db->begin();
|
||||
dol_syslog(get_class($this) . "::update", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error ++;
|
||||
$this->errors [] = "Error " . $this->db->lasterror();
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors [] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "product_customer_price SET";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."product_customer_price SET";
|
||||
|
||||
$sql .= " entity=" . $conf->entity . ",";
|
||||
$sql .= " datec='" . $this->db->idate(dol_now()) . "',";
|
||||
$sql .= " tms=" . (dol_strlen($this->tms) != 0 ? "'" . $this->db->idate($this->tms) . "'" : 'null') . ",";
|
||||
$sql .= " fk_product=" . (isset($this->fk_product) ? $this->fk_product : "null") . ",";
|
||||
$sql .= " fk_soc=" . (isset($this->fk_soc) ? $this->fk_soc : "null") . ",";
|
||||
$sql .= " price=" . (isset($this->price) ? $this->price : "null") . ",";
|
||||
$sql .= " price_ttc=" . (isset($this->price_ttc) ? $this->price_ttc : "null") . ",";
|
||||
$sql .= " price_min=" . (isset($this->price_min) ? $this->price_min : "null") . ",";
|
||||
$sql .= " price_min_ttc=" . (isset($this->price_min_ttc) ? $this->price_min_ttc : "null") . ",";
|
||||
$sql .= " price_base_type=" . (isset($this->price_base_type) ? "'" . $this->db->escape($this->price_base_type) . "'" : "null") . ",";
|
||||
$sql .= " entity=".$conf->entity.",";
|
||||
$sql .= " datec='".$this->db->idate(dol_now())."',";
|
||||
$sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
|
||||
$sql .= " fk_product=".(isset($this->fk_product) ? $this->fk_product : "null").",";
|
||||
$sql .= " fk_soc=".(isset($this->fk_soc) ? $this->fk_soc : "null").",";
|
||||
$sql .= " price=".(isset($this->price) ? $this->price : "null").",";
|
||||
$sql .= " price_ttc=".(isset($this->price_ttc) ? $this->price_ttc : "null").",";
|
||||
$sql .= " price_min=".(isset($this->price_min) ? $this->price_min : "null").",";
|
||||
$sql .= " price_min_ttc=".(isset($this->price_min_ttc) ? $this->price_min_ttc : "null").",";
|
||||
$sql .= " price_base_type=".(isset($this->price_base_type) ? "'".$this->db->escape($this->price_base_type)."'" : "null").",";
|
||||
$sql .= " default_vat_code = ".($this->default_vat_code ? "'".$this->db->escape($this->default_vat_code)."'" : "null").",";
|
||||
$sql .= " tva_tx=" . (isset($this->tva_tx) ? (empty($this->tva_tx)?0:$this->tva_tx) : "null") . ",";
|
||||
$sql .= " recuperableonly=" . (isset($this->recuperableonly) ? $this->recuperableonly : "null") . ",";
|
||||
$sql .= " localtax1_tx=" . (isset($this->localtax1_tx) ? (empty($this->localtax1_tx)?0:$this->localtax1_tx) : "null") . ",";
|
||||
$sql .= " localtax2_tx=" . (isset($this->localtax2_tx) ? (empty($this->localtax2_tx)?0:$this->localtax2_tx) : "null") . ",";
|
||||
$sql .= " localtax1_type=" . (! empty($this->localtax1_type) ? "'".$this->db->escape($this->localtax1_type)."'": "'0'") . ",";
|
||||
$sql .= " localtax2_type=" . (! empty($this->localtax2_type) ? "'".$this->db->escape($this->localtax2_type)."'": "'0'") . ",";
|
||||
$sql .= " fk_user=" . $user->id . ",";
|
||||
$sql .= " import_key=" . (isset($this->import_key) ? "'" . $this->db->escape($this->import_key) . "'" : "null") . "";
|
||||
$sql .= " tva_tx=".(isset($this->tva_tx) ? (empty($this->tva_tx) ? 0 : $this->tva_tx) : "null").",";
|
||||
$sql .= " recuperableonly=".(isset($this->recuperableonly) ? $this->recuperableonly : "null").",";
|
||||
$sql .= " localtax1_tx=".(isset($this->localtax1_tx) ? (empty($this->localtax1_tx) ? 0 : $this->localtax1_tx) : "null").",";
|
||||
$sql .= " localtax2_tx=".(isset($this->localtax2_tx) ? (empty($this->localtax2_tx) ? 0 : $this->localtax2_tx) : "null").",";
|
||||
$sql .= " localtax1_type=".(!empty($this->localtax1_type) ? "'".$this->db->escape($this->localtax1_type)."'" : "'0'").",";
|
||||
$sql .= " localtax2_type=".(!empty($this->localtax2_type) ? "'".$this->db->escape($this->localtax2_type)."'" : "'0'").",";
|
||||
$sql .= " fk_user=".$user->id.",";
|
||||
$sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null")."";
|
||||
|
||||
$sql .= " WHERE rowid=" . $this->id;
|
||||
$sql .= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this) . "::update", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error ++;
|
||||
$this->errors [] = "Error " . $this->db->lasterror();
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors [] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
if (! $notrigger) {
|
||||
if (!$error) {
|
||||
if (!$notrigger) {
|
||||
// Call triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('PRODUCT_CUSTOMER_PRICE_UPDATE', $this, $user, $langs, $conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
|
||||
$interface = new Interfaces($this->db);
|
||||
$result = $interface->run_triggers('PRODUCT_CUSTOMER_PRICE_UPDATE', $this, $user, $langs, $conf);
|
||||
if ($result < 0) { $error++; $this->errors = $interface->errors; }
|
||||
// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
if (!$error) {
|
||||
$result = $this->setPriceOnAffiliateThirdparty($user, $forceupdateaffiliate);
|
||||
if ($result < 0) {
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
foreach ($this->errors as $errmsg) {
|
||||
dol_syslog(get_class($this) . "::update " . $errmsg, LOG_ERR);
|
||||
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
|
||||
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return - 1 * $error;
|
||||
return -1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
@@ -754,34 +754,34 @@ class Productcustomerprice extends CommonObject
|
||||
|
||||
// Find all susidiaries
|
||||
$sql = "SELECT s.rowid";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
|
||||
$sql .= " WHERE s.parent = " . $this->fk_soc;
|
||||
$sql .= " AND s.entity IN (" . getEntity('societe') . ")";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " WHERE s.parent = ".$this->fk_soc;
|
||||
$sql .= " AND s.entity IN (".getEntity('societe').")";
|
||||
|
||||
dol_syslog(get_class($this) . "::setPriceOnAffiliateThirdparty", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::setPriceOnAffiliateThirdparty", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($resql) {
|
||||
$this->lines = array ();
|
||||
$this->lines = array();
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
while ( ($obj = $this->db->fetch_object($resql)) && (empty($error)) ) {
|
||||
while (($obj = $this->db->fetch_object($resql)) && (empty($error))) {
|
||||
// find if there is an existing line for the product and the subsidiaries
|
||||
$prodsocprice = new Productcustomerprice($this->db);
|
||||
|
||||
$filter = array (
|
||||
't.fk_product' => $this->fk_product,'t.fk_soc' => $obj->rowid
|
||||
$filter = array(
|
||||
't.fk_product' => $this->fk_product, 't.fk_soc' => $obj->rowid
|
||||
);
|
||||
|
||||
$result = $prodsocprice->fetch_all('', '', 0, 0, $filter);
|
||||
if ($result < 0) {
|
||||
$error ++;
|
||||
$error++;
|
||||
$this->error = $prodsocprice->error;
|
||||
} else {
|
||||
// There is one line
|
||||
if (count($prodsocprice->lines) > 0) {
|
||||
// If force update => Update
|
||||
if (! empty($forceupdateaffiliate)) {
|
||||
if (!empty($forceupdateaffiliate)) {
|
||||
$prodsocpriceupd = new Productcustomerprice($this->db);
|
||||
$prodsocpriceupd->fetch($prodsocprice->lines [0]->id);
|
||||
|
||||
@@ -793,7 +793,7 @@ class Productcustomerprice extends CommonObject
|
||||
|
||||
$resultupd = $prodsocpriceupd->update($user, 0, $forceupdateaffiliate);
|
||||
if ($result < 0) {
|
||||
$error ++;
|
||||
$error++;
|
||||
$this->error = $prodsocpriceupd->error;
|
||||
}
|
||||
}
|
||||
@@ -810,7 +810,7 @@ class Productcustomerprice extends CommonObject
|
||||
|
||||
$resultupd = $prodsocpricenew->create($user, 0, $forceupdateaffiliate);
|
||||
if ($result < 0) {
|
||||
$error ++;
|
||||
$error++;
|
||||
$this->error = $prodsocpriceupd->error;
|
||||
}
|
||||
}
|
||||
@@ -821,11 +821,11 @@ class Productcustomerprice extends CommonObject
|
||||
if (empty($error)) {
|
||||
return 1;
|
||||
} else {
|
||||
return - 1;
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
return - 1;
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -844,8 +844,8 @@ class Productcustomerprice extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if (! $error) {
|
||||
if (! $notrigger) {
|
||||
if (!$error) {
|
||||
if (!$notrigger) {
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
@@ -858,26 +858,26 @@ class Productcustomerprice extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "product_customer_price";
|
||||
$sql .= " WHERE rowid=" . $this->id;
|
||||
if (!$error) {
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_customer_price";
|
||||
$sql .= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this) . "::delete", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error ++;
|
||||
$this->errors [] = "Error " . $this->db->lasterror();
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors [] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
foreach ($this->errors as $errmsg) {
|
||||
dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR);
|
||||
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
|
||||
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return - 1 * $error;
|
||||
return -1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
@@ -908,28 +908,28 @@ class Productcustomerprice extends CommonObject
|
||||
// ...
|
||||
|
||||
// Create clone
|
||||
$object->context['createfromclone']='createfromclone';
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
$result = $object->create($user);
|
||||
|
||||
// Other options
|
||||
if ($result < 0) {
|
||||
$this->error = $object->error;
|
||||
$this->errors=array_merge($this->errors, $object->errors);
|
||||
$this->errors = array_merge($this->errors, $object->errors);
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
if (!$error) {
|
||||
}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (! $error) {
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
return $object->id;
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
return - 1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,33 +62,33 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined,
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="position_name";
|
||||
if (!$sortorder) $sortorder = "ASC";
|
||||
if (!$sortfield) $sortfield = "position_name";
|
||||
|
||||
|
||||
$object = new Product($db);
|
||||
if ($id > 0 || ! empty($ref))
|
||||
if ($id > 0 || !empty($ref))
|
||||
{
|
||||
$result = $object->fetch($id, $ref);
|
||||
|
||||
if (! empty($conf->product->enabled)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref);
|
||||
elseif (! empty($conf->service->enabled)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref);
|
||||
if (!empty($conf->product->enabled)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref);
|
||||
elseif (!empty($conf->service->enabled)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref);
|
||||
|
||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) // For backward compatiblity, we scan also old dirs
|
||||
if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) // For backward compatiblity, we scan also old dirs
|
||||
{
|
||||
if (! empty($conf->product->enabled)) $upload_dirold = $conf->product->multidir_output[$object->entity].'/'.substr(substr("000".$object->id, -2), 1, 1).'/'.substr(substr("000".$object->id, -2), 0, 1).'/'.$object->id."/photos";
|
||||
if (!empty($conf->product->enabled)) $upload_dirold = $conf->product->multidir_output[$object->entity].'/'.substr(substr("000".$object->id, -2), 1, 1).'/'.substr(substr("000".$object->id, -2), 0, 1).'/'.$object->id."/photos";
|
||||
else $upload_dirold = $conf->service->multidir_output[$object->entity].'/'.substr(substr("000".$object->id, -2), 1, 1).'/'.substr(substr("000".$object->id, -2), 0, 1).'/'.$object->id."/photos";
|
||||
}
|
||||
}
|
||||
$modulepart='produit';
|
||||
$modulepart = 'produit';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters=array('id'=>$id);
|
||||
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$parameters = array('id'=>$id);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
@@ -102,10 +102,10 @@ if (empty($reshook))
|
||||
$urlfile = GETPOST('urlfile', 'alpha');
|
||||
$filename = basename($urlfile);
|
||||
$filetomerge = new Propalmergepdfproduct($db);
|
||||
$filetomerge->fk_product=$object->id;
|
||||
$filetomerge->file_name=$filename;
|
||||
$result=$filetomerge->delete_by_file($user);
|
||||
if ($result<0) {
|
||||
$filetomerge->fk_product = $object->id;
|
||||
$filetomerge->file_name = $filename;
|
||||
$result = $filetomerge->delete_by_file($user);
|
||||
if ($result < 0) {
|
||||
setEventMessages($filetomerge->error, $filetomerge->errors, 'errors');
|
||||
}
|
||||
}
|
||||
@@ -115,7 +115,7 @@ if (empty($reshook))
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
|
||||
}
|
||||
|
||||
if ($action=='filemerge')
|
||||
if ($action == 'filemerge')
|
||||
{
|
||||
$is_refresh = GETPOST('refresh');
|
||||
if (empty($is_refresh)) {
|
||||
@@ -131,11 +131,11 @@ if ($action=='filemerge')
|
||||
$filetomerge = new Propalmergepdfproduct($db);
|
||||
|
||||
if ($conf->global->MAIN_MULTILANGS) {
|
||||
$result=$filetomerge->delete_by_product($user, $object->id, $lang_id);
|
||||
$result = $filetomerge->delete_by_product($user, $object->id, $lang_id);
|
||||
} else {
|
||||
$result=$filetomerge->delete_by_product($user, $object->id);
|
||||
$result = $filetomerge->delete_by_product($user, $object->id);
|
||||
}
|
||||
if ($result<0) {
|
||||
if ($result < 0) {
|
||||
setEventMessages($filetomerge->error, $filetomerge->errors, 'errors');
|
||||
}
|
||||
|
||||
@@ -149,8 +149,8 @@ if ($action=='filemerge')
|
||||
$filetomerge->lang = $lang_id;
|
||||
}
|
||||
|
||||
$result=$filetomerge->create($user);
|
||||
if ($result<0) {
|
||||
$result = $filetomerge->create($user);
|
||||
if ($result < 0) {
|
||||
setEventMessages($filetomerge->error, $filetomerge->errors, 'errors');
|
||||
}
|
||||
}
|
||||
@@ -170,13 +170,13 @@ $helpurl = '';
|
||||
$shortlabel = dol_trunc($object->label, 16);
|
||||
if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT))
|
||||
{
|
||||
$title = $langs->trans('Product')." ". $shortlabel ." - ".$langs->trans('Documents');
|
||||
$helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
|
||||
$title = $langs->trans('Product')." ".$shortlabel." - ".$langs->trans('Documents');
|
||||
$helpurl = 'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
|
||||
}
|
||||
if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE))
|
||||
{
|
||||
$title = $langs->trans('Service')." ". $shortlabel ." - ".$langs->trans('Documents');
|
||||
$helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
|
||||
$title = $langs->trans('Service')." ".$shortlabel." - ".$langs->trans('Documents');
|
||||
$helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
|
||||
}
|
||||
|
||||
llxHeader('', $title, $helpurl);
|
||||
@@ -234,8 +234,8 @@ if ($object->id)
|
||||
dol_fiche_end();
|
||||
|
||||
$permission = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer));
|
||||
$param = '&id=' . $object->id;
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||
$param = '&id='.$object->id;
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
|
||||
|
||||
|
||||
// Merge propal PDF document PDF files
|
||||
@@ -255,7 +255,7 @@ if ($object->id)
|
||||
|
||||
$filearray = dol_dir_list($upload_dir, "files", 0, '', '\.meta$', 'name', SORT_ASC, 1);
|
||||
|
||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) // For backward compatiblity, we scan also old dirs
|
||||
if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) // For backward compatiblity, we scan also old dirs
|
||||
{
|
||||
$filearray = array_merge($filearray, dol_dir_list($upload_dirold, "files", 0, '', '\.meta$', 'name', SORT_ASC, 1));
|
||||
}
|
||||
@@ -269,8 +269,8 @@ if ($object->id)
|
||||
print $langs->trans('PropalMergePdfProductActualFile');
|
||||
}
|
||||
|
||||
print '<form name="filemerge" action="' . DOL_URL_ROOT . '/product/document.php?id=' . $object->id . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<form name="filemerge" action="'.DOL_URL_ROOT.'/product/document.php?id='.$object->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="filemerge">';
|
||||
if (count($filetomerge->lines) == 0) {
|
||||
print $langs->trans('PropalMergePdfProductChooseFile');
|
||||
@@ -291,7 +291,7 @@ if ($object->id)
|
||||
print Form::selectarray('lang_id', $langs_available, $default_lang, 0, 0, 0, '', 0, 0, 0, 'ASC');
|
||||
|
||||
if ($conf->global->MAIN_MULTILANGS) {
|
||||
print '<input type="submit" class="button" name="refresh" value="' . $langs->trans('Refresh') . '">';
|
||||
print '<input type="submit" class="button" name="refresh" value="'.$langs->trans('Refresh').'">';
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
@@ -306,9 +306,9 @@ if ($object->id)
|
||||
|
||||
if ($conf->global->MAIN_MULTILANGS)
|
||||
{
|
||||
if (array_key_exists($filetoadd['name'] . '_' . $default_lang, $filetomerge->lines))
|
||||
if (array_key_exists($filetoadd['name'].'_'.$default_lang, $filetomerge->lines))
|
||||
{
|
||||
$filename = $filetoadd['name'] . ' - ' . $langs->trans('Language_' . $default_lang);
|
||||
$filename = $filetoadd['name'].' - '.$langs->trans('Language_'.$default_lang);
|
||||
$checked = ' checked ';
|
||||
}
|
||||
}
|
||||
@@ -321,13 +321,13 @@ if ($object->id)
|
||||
}
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print '<input type="checkbox" ' . $checked . ' name="filetoadd[]" id="filetoadd" value="' . $filetoadd['name'] . '">' . $filename . '</input>';
|
||||
print '<input type="checkbox" '.$checked.' name="filetoadd[]" id="filetoadd" value="'.$filetoadd['name'].'">'.$filename.'</input>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr><td>';
|
||||
print '<input type="submit" class="button" name="save" value="' . $langs->trans('Save') . '">';
|
||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans('Save').'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
@@ -259,8 +259,9 @@ if (empty($reshook))
|
||||
{
|
||||
$supplier = new Fournisseur($db);
|
||||
$result = $supplier->fetch($id_fourn);
|
||||
if (isset($_POST['ref_fourn_price_id']))
|
||||
$object->fetch_product_fournisseur_price($_POST['ref_fourn_price_id']);
|
||||
if (GETPOSTISSET('ref_fourn_price_id')) {
|
||||
$object->fetch_product_fournisseur_price(GETPOST('ref_fourn_price_id', 'int'));
|
||||
}
|
||||
|
||||
$extralabels = $extrafields->fetch_name_optionals_label("product_fournisseur_price");
|
||||
$extrafield_values = $extrafields->getOptionalsFromPost("product_fournisseur_price");
|
||||
|
||||
@@ -56,20 +56,20 @@ $sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
if (empty($page) || $page < 0) $page = 0;
|
||||
if (! $sortfield) $sortfield="p.ref";
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
if (!$sortfield) $sortfield = "p.ref";
|
||||
if (!$sortorder) $sortorder = "ASC";
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page ;
|
||||
$offset = $limit * $page;
|
||||
|
||||
// Load sale and categ filters
|
||||
$search_sale = GETPOST("search_sale");
|
||||
$search_categ = GETPOST("search_categ");
|
||||
|
||||
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||
$canvas=GETPOST("canvas");
|
||||
$objcanvas=null;
|
||||
if (! empty($canvas))
|
||||
$canvas = GETPOST("canvas");
|
||||
$objcanvas = null;
|
||||
if (!empty($canvas))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php';
|
||||
$objcanvas = new Canvas($db, $action);
|
||||
@@ -77,10 +77,10 @@ if (! empty($canvas))
|
||||
}
|
||||
|
||||
// Define virtualdiffersfromphysical
|
||||
$virtualdiffersfromphysical=0;
|
||||
if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)|| ! empty($conf->global->STOCK_CALCULATE_ON_RECEPTION))
|
||||
$virtualdiffersfromphysical = 0;
|
||||
if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION))
|
||||
{
|
||||
$virtualdiffersfromphysical=1; // According to increase/decrease stock options, virtual and physical stock may differs.
|
||||
$virtualdiffersfromphysical = 1; // According to increase/decrease stock options, virtual and physical stock may differs.
|
||||
}
|
||||
|
||||
|
||||
@@ -91,18 +91,18 @@ if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global
|
||||
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$sref="";
|
||||
$snom="";
|
||||
$sall="";
|
||||
$tosell="";
|
||||
$tobuy="";
|
||||
$search_sale="";
|
||||
$search_categ="";
|
||||
$type="";
|
||||
$catid='';
|
||||
$toolowstock='';
|
||||
$fourn_id='';
|
||||
$sbarcode='';
|
||||
$sref = "";
|
||||
$snom = "";
|
||||
$sall = "";
|
||||
$tosell = "";
|
||||
$tobuy = "";
|
||||
$search_sale = "";
|
||||
$search_categ = "";
|
||||
$type = "";
|
||||
$catid = '';
|
||||
$toolowstock = '';
|
||||
$fourn_id = '';
|
||||
$sbarcode = '';
|
||||
}
|
||||
|
||||
|
||||
@@ -111,50 +111,50 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
* View
|
||||
*/
|
||||
|
||||
$helpurl='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
|
||||
$helpurl = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
|
||||
|
||||
$form=new Form($db);
|
||||
$htmlother=new FormOther($db);
|
||||
$form = new Form($db);
|
||||
$htmlother = new FormOther($db);
|
||||
|
||||
$sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,';
|
||||
$sql.= ' p.fk_product_type, p.tms as datem,';
|
||||
$sql.= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock,';
|
||||
$sql.= ' SUM(s.reel) as stock_physique';
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS)) $sql.= ', u.short_label as unit_short';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s on p.rowid = s.fk_product';
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_units as u on p.fk_unit = u.rowid';
|
||||
$sql .= ' p.fk_product_type, p.tms as datem,';
|
||||
$sql .= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock,';
|
||||
$sql .= ' SUM(s.reel) as stock_physique';
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ', u.short_label as unit_short';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s on p.rowid = s.fk_product';
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_units as u on p.fk_unit = u.rowid';
|
||||
// We'll need this table joined to the select in order to filter by categ
|
||||
if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_product as cp";
|
||||
$sql.= " WHERE p.entity IN (".getEntity('product').")";
|
||||
if ($search_categ) $sql.= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ
|
||||
if ($sall) $sql.=natural_search(array('p.ref', 'p.label', 'p.description', 'p.note'), $sall);
|
||||
if ($search_categ) $sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp";
|
||||
$sql .= " WHERE p.entity IN (".getEntity('product').")";
|
||||
if ($search_categ) $sql .= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ
|
||||
if ($sall) $sql .= natural_search(array('p.ref', 'p.label', 'p.description', 'p.note'), $sall);
|
||||
// if the type is not 1, we show all products (type = 0,2,3)
|
||||
if (dol_strlen($type))
|
||||
{
|
||||
if ($type==1)
|
||||
if ($type == 1)
|
||||
{
|
||||
$sql.= " AND p.fk_product_type = '1'";
|
||||
$sql .= " AND p.fk_product_type = '1'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.= " AND p.fk_product_type <> '1'";
|
||||
$sql .= " AND p.fk_product_type <> '1'";
|
||||
}
|
||||
}
|
||||
if ($sref) $sql.= natural_search('p.ref', $sref);
|
||||
if ($search_barcode) $sql.= natural_search('p.barcode', $search_barcode);
|
||||
if ($snom) $sql.= natural_search('p.label', $snom);
|
||||
if (! empty($tosell)) $sql.= " AND p.tosell = ".$tosell;
|
||||
if (! empty($tobuy)) $sql.= " AND p.tobuy = ".$tobuy;
|
||||
if (! empty($canvas)) $sql.= " AND p.canvas = '".$db->escape($canvas)."'";
|
||||
if($catid) $sql.= " AND cp.fk_categorie = ".$catid;
|
||||
if ($fourn_id > 0) $sql.= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".$fourn_id;
|
||||
if ($sref) $sql .= natural_search('p.ref', $sref);
|
||||
if ($search_barcode) $sql .= natural_search('p.barcode', $search_barcode);
|
||||
if ($snom) $sql .= natural_search('p.label', $snom);
|
||||
if (!empty($tosell)) $sql .= " AND p.tosell = ".$tosell;
|
||||
if (!empty($tobuy)) $sql .= " AND p.tobuy = ".$tobuy;
|
||||
if (!empty($canvas)) $sql .= " AND p.canvas = '".$db->escape($canvas)."'";
|
||||
if ($catid) $sql .= " AND cp.fk_categorie = ".$catid;
|
||||
if ($fourn_id > 0) $sql .= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".$fourn_id;
|
||||
// Insert categ filter
|
||||
if ($search_categ) $sql .= " AND cp.fk_categorie = ".$db->escape($search_categ);
|
||||
$sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,";
|
||||
$sql.= " p.fk_product_type, p.tms, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock";
|
||||
if ($toolowstock) $sql.= " HAVING SUM(".$db->ifsql('s.reel IS NULL', '0', 's.reel').") < p.seuil_stock_alerte";
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
$sql .= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,";
|
||||
$sql .= " p.fk_product_type, p.tms, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock";
|
||||
if ($toolowstock) $sql .= " HAVING SUM(".$db->ifsql('s.reel IS NULL', '0', 's.reel').") < p.seuil_stock_alerte";
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
@@ -169,7 +169,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
}
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
@@ -187,31 +187,31 @@ if ($resql)
|
||||
|
||||
if (isset($type))
|
||||
{
|
||||
if ($type==1) { $texte = $langs->trans("Services"); }
|
||||
if ($type == 1) { $texte = $langs->trans("Services"); }
|
||||
else { $texte = $langs->trans("Products"); }
|
||||
} else {
|
||||
$texte = $langs->trans("ProductsAndServices");
|
||||
}
|
||||
$texte.=' ('.$langs->trans("MenuStocks").')';
|
||||
$texte .= ' ('.$langs->trans("MenuStocks").')';
|
||||
|
||||
$param='';
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
if ($sall) $param.="&sall=".urlencode($sall);
|
||||
if ($tosell) $param.="&tosell=".urlencode($tosell);
|
||||
if ($tobuy) $param.="&tobuy=".urlencode($tobuy);
|
||||
if ($type) $param.="&type=".urlencode($type);
|
||||
if ($fourn_id) $param.="&fourn_id=".urlencode($fourn_id);
|
||||
if ($snom) $param.="&snom=".urlencode($snom);
|
||||
if ($sref) $param.="&sref=".urlencode($sref);
|
||||
if ($search_sale) $param.="&search_sale=".urlencode($search_sale);
|
||||
if ($search_categ) $param.="&search_categ=".urlencode($search_categ);
|
||||
if ($toolowstock) $param.="&toolowstock=".urlencode($toolowstock);
|
||||
if ($sbarcode) $param.="&sbarcode=".urlencode($sbarcode);
|
||||
if ($catid) $param.="&catid=".urlencode($catid);
|
||||
$param = '';
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
if ($sall) $param .= "&sall=".urlencode($sall);
|
||||
if ($tosell) $param .= "&tosell=".urlencode($tosell);
|
||||
if ($tobuy) $param .= "&tobuy=".urlencode($tobuy);
|
||||
if ($type) $param .= "&type=".urlencode($type);
|
||||
if ($fourn_id) $param .= "&fourn_id=".urlencode($fourn_id);
|
||||
if ($snom) $param .= "&snom=".urlencode($snom);
|
||||
if ($sref) $param .= "&sref=".urlencode($sref);
|
||||
if ($search_sale) $param .= "&search_sale=".urlencode($search_sale);
|
||||
if ($search_categ) $param .= "&search_categ=".urlencode($search_categ);
|
||||
if ($toolowstock) $param .= "&toolowstock=".urlencode($toolowstock);
|
||||
if ($sbarcode) $param .= "&sbarcode=".urlencode($sbarcode);
|
||||
if ($catid) $param .= "&catid=".urlencode($catid);
|
||||
|
||||
llxHeader("", $texte, $helpurl);
|
||||
|
||||
print '<form action="'. $_SERVER["PHP_SELF"] .'" method="post" name="formulaire">';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">';
|
||||
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.'">';
|
||||
@@ -220,7 +220,7 @@ if ($resql)
|
||||
|
||||
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'products', 0, '', '', $limit);
|
||||
|
||||
if (! empty($catid))
|
||||
if (!empty($catid))
|
||||
{
|
||||
print "<div id='ways'>";
|
||||
$c = new Categorie($db);
|
||||
@@ -231,48 +231,48 @@ if ($resql)
|
||||
}
|
||||
|
||||
// Filter on categories
|
||||
$moreforfilter='';
|
||||
if (! empty($conf->categorie->enabled))
|
||||
$moreforfilter = '';
|
||||
if (!empty($conf->categorie->enabled))
|
||||
{
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('Categories'). ': ';
|
||||
$moreforfilter.=$htmlother->select_categories(Categorie::TYPE_PRODUCT, $search_categ, 'search_categ');
|
||||
$moreforfilter.='</div>';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('Categories').': ';
|
||||
$moreforfilter .= $htmlother->select_categories(Categorie::TYPE_PRODUCT, $search_categ, 'search_categ');
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans("StockTooLow").' <input type="checkbox" name="toolowstock" value="1"'.($toolowstock?' checked':'').'>';
|
||||
$moreforfilter.='</div>';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans("StockTooLow").' <input type="checkbox" name="toolowstock" value="1"'.($toolowstock ? ' checked' : '').'>';
|
||||
$moreforfilter .= '</div>';
|
||||
|
||||
if (! empty($moreforfilter))
|
||||
if (!empty($moreforfilter))
|
||||
{
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
$param='';
|
||||
if ($tosell) $param.="&tosell=".$tosell;
|
||||
if ($tobuy) $param.="&tobuy=".$tobuy;
|
||||
if ($type) $param.="&type=".$type;
|
||||
if ($fourn_id) $param.="&fourn_id=".$fourn_id;
|
||||
if ($snom) $param.="&snom=".$snom;
|
||||
if ($sref) $param.="&sref=".$sref;
|
||||
if ($toolowstock) $param.="&toolowstock=".$toolowstock;
|
||||
if ($search_categ) $param.="&search_categ=".$search_categ;
|
||||
$param = '';
|
||||
if ($tosell) $param .= "&tosell=".$tosell;
|
||||
if ($tobuy) $param .= "&tobuy=".$tobuy;
|
||||
if ($type) $param .= "&type=".$type;
|
||||
if ($fourn_id) $param .= "&fourn_id=".$fourn_id;
|
||||
if ($snom) $param .= "&snom=".$snom;
|
||||
if ($sref) $param .= "&sref=".$sref;
|
||||
if ($toolowstock) $param .= "&toolowstock=".$toolowstock;
|
||||
if ($search_categ) $param .= "&search_categ=".$search_categ;
|
||||
|
||||
$formProduct = new FormProduct($db);
|
||||
$formProduct->loadWarehouses();
|
||||
$warehouses_list = $formProduct->cache_warehouses;
|
||||
$nb_warehouse = count($warehouses_list);
|
||||
$colspan_warehouse = 1;
|
||||
if (! empty($conf->global->STOCK_DETAIL_ON_WAREHOUSE)) { $colspan_warehouse = $nb_warehouse > 1 ? $nb_warehouse+1 : 1; }
|
||||
if (!empty($conf->global->STOCK_DETAIL_ON_WAREHOUSE)) { $colspan_warehouse = $nb_warehouse > 1 ? $nb_warehouse + 1 : 1; }
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">';
|
||||
|
||||
// Fields title search
|
||||
print '<tr class="liste_titre_filter">';
|
||||
@@ -283,7 +283,7 @@ if ($resql)
|
||||
print '<input class="flat" type="text" name="snom" size="8" value="'.$snom.'">';
|
||||
print '</td>';
|
||||
// Duration
|
||||
if (! empty($conf->service->enabled) && $type == 1)
|
||||
if (!empty($conf->service->enabled) && $type == 1)
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print ' ';
|
||||
@@ -298,7 +298,7 @@ if ($resql)
|
||||
print '<td class="liste_titre" colspan="'.$colspan_warehouse.'"> </td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@@ -307,14 +307,14 @@ if ($resql)
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", $param, "", "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", $param, "", "", $sortfield, $sortorder);
|
||||
if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre("Duration", $_SERVER["PHP_SELF"], "p.duration", $param, "", '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($conf->service->enabled) && $type == 1) print_liste_field_titre("Duration", $_SERVER["PHP_SELF"], "p.duration", $param, "", '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("StockLimit", $_SERVER["PHP_SELF"], "p.seuil_stock_alerte", $param, "", '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("DesiredStock", $_SERVER["PHP_SELF"], "p.desiredstock", $param, "", '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("PhysicalStock", $_SERVER["PHP_SELF"], "stock_physique", $param, "", '', $sortfield, $sortorder, 'right ');
|
||||
// Details per warehouse
|
||||
if (! empty($conf->global->STOCK_DETAIL_ON_WAREHOUSE)) // TODO This should be moved into the selection of fields on page product/list (page product/stock will be removed and replaced with product/list with its own context)
|
||||
if (!empty($conf->global->STOCK_DETAIL_ON_WAREHOUSE)) // TODO This should be moved into the selection of fields on page product/list (page product/stock will be removed and replaced with product/list with its own context)
|
||||
{
|
||||
if ($nb_warehouse>1) {
|
||||
if ($nb_warehouse > 1) {
|
||||
foreach ($warehouses_list as &$wh) {
|
||||
print_liste_field_titre($wh['label'], '', '', '', '', '', '', '', 'right ');
|
||||
}
|
||||
@@ -322,7 +322,7 @@ if ($resql)
|
||||
}
|
||||
if ($virtualdiffersfromphysical) print_liste_field_titre("VirtualStock", $_SERVER["PHP_SELF"], "", $param, "", '', $sortfield, $sortorder, 'right ');
|
||||
// Units
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
print_liste_field_titre("Unit", $_SERVER["PHP_SELF"], "unit_short", $param, "", 'align="right"', $sortfield, $sortorder);
|
||||
}
|
||||
print_liste_field_titre('');
|
||||
@@ -335,7 +335,7 @@ if ($resql)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$product=new Product($db);
|
||||
$product = new Product($db);
|
||||
$product->fetch($objp->rowid);
|
||||
$product->load_stock();
|
||||
|
||||
@@ -346,7 +346,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
print '<td>'.$product->label.'</td>';
|
||||
|
||||
if (! empty($conf->service->enabled) && $type == 1)
|
||||
if (!empty($conf->service->enabled) && $type == 1)
|
||||
{
|
||||
print '<td class="center">';
|
||||
if (preg_match('/([0-9]+)y/i', $objp->duration, $regs)) print $regs[1].' '.$langs->trans("DurationYear");
|
||||
@@ -361,14 +361,14 @@ if ($resql)
|
||||
// Real stock
|
||||
print '<td class="right">';
|
||||
if ($objp->seuil_stock_alerte != '' && ($objp->stock_physique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' ';
|
||||
print $objp->stock_physique|0;
|
||||
print $objp->stock_physique | 0;
|
||||
print '</td>';
|
||||
|
||||
// Details per warehouse
|
||||
if (! empty($conf->global->STOCK_DETAIL_ON_WAREHOUSE)) // TODO This should be moved into the selection of fields on page product/list (page product/stock will be removed and replaced with product/list with its own context)
|
||||
if (!empty($conf->global->STOCK_DETAIL_ON_WAREHOUSE)) // TODO This should be moved into the selection of fields on page product/list (page product/stock will be removed and replaced with product/list with its own context)
|
||||
{
|
||||
if($nb_warehouse>1) {
|
||||
foreach($warehouses_list as &$wh) {
|
||||
if ($nb_warehouse > 1) {
|
||||
foreach ($warehouses_list as &$wh) {
|
||||
print '<td class="right">';
|
||||
print empty($product->stock_warehouse[$wh['id']]->real) ? '0' : $product->stock_warehouse[$wh['id']]->real;
|
||||
print '</td>';
|
||||
@@ -385,8 +385,8 @@ if ($resql)
|
||||
print '</td>';
|
||||
}
|
||||
// Units
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
print '<td class="left">' . $objp->unit_short . '</td>';
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
print '<td class="left">'.$objp->unit_short.'</td>';
|
||||
}
|
||||
print '<td class="right"><a href="'.DOL_URL_ROOT.'/product/stock/movement_list.php?idproduct='.$product->id.'">'.$langs->trans("Movements").'</a></td>';
|
||||
print '<td class="right nowrap">'.$product->LibStatut($objp->statut, 5, 0).'</td>';
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user