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

This commit is contained in:
Laurent Destailleur 2015-07-09 12:29:44 +02:00
commit 3eb6ee2030
97 changed files with 1798 additions and 2333 deletions

View File

@ -242,7 +242,7 @@ if ($upgrade) {
[ "versionfrom", $upgrade->{'version'} ],
[ "versionto", $ver ],
);
local $err = &call_dolibarr_wizard_page(\@params, "etape5", $d, $opts);
local $err = &call_dolibarr_wizard_page(\@params, "step5", $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Remove the installation directory.
@ -268,12 +268,12 @@ else {
[ "usealternaterootdir", "1" ],
[ "main_alt_dir_name", "custom" ],
);
local $err = &call_dolibarr_wizard_page(\@params, "etape1", $d, $opts);
local $err = &call_dolibarr_wizard_page(\@params, "step1", $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Second page (Populate database)
local @params = ( [ "action", "set" ] );
local $err = &call_dolibarr_wizard_page(\@params, "etape2", $d, $opts);
local $err = &call_dolibarr_wizard_page(\@params, "step2", $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Third page (Add administrator account)
@ -282,7 +282,7 @@ else {
[ "pass", $dompass ],
[ "pass_verif", $dompass ],
);
local $err = &call_dolibarr_wizard_page(\@params, "etape5", $d, $opts);
local $err = &call_dolibarr_wizard_page(\@params, "step5", $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Remove the installation directory and protect config file.

View File

@ -34,11 +34,11 @@ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
class modMyModule extends DolibarrModules
{
/**
* Constructor. Define names, constants, directories, boxes, permissions
* Constructor. Define names, constants, directories, boxes, permissions
*
* @param DoliDB $db Database handler
* @param DoliDB $db Database handler
*/
function __construct($db)
public function __construct($db)
{
global $langs,$conf;
@ -249,24 +249,24 @@ class modMyModule extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
public function init($options='')
{
$sql = array();
$result=$this->_load_tables('/mymodule/sql/');
//$this->_load_tables('/mymodule/sql/');
return $this->_init($sql, $options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
public function remove($options = '')
{
$sql = array();

View File

@ -9,10 +9,10 @@
<link rel="shortcut icon" type="image/x-icon" href="/dolibarrnew/theme/eldy/img/favicon.ico"/>
<title>Login Dolibarr 3.4.0-alpha</title>
<!-- Includes for JQuery (Ajax library) -->
<link rel="stylesheet" type="text/css" href="/dolibarrnew/includes/jquery/css/smoothness/jquery-ui-latest.custom.css" />
<link rel="stylesheet" type="text/css" href="/dolibarrnew/includes/jquery/css/smoothness/jquery-ui.custom.css" />
<link rel="stylesheet" type="text/css" title="default" href="/dolibarrnew/custom/filemanager/css/filemanager.css.php"><!-- Added by module filemanager-->
<!-- Includes JS for JQuery -->
<script type="text/javascript" src="/dolibarrnew/includes/jquery/js/jquery-latest.min.js"></script>
<script type="text/javascript" src="/dolibarrnew/includes/jquery/js/jquery.min.js"></script>
<script type="text/javascript" src="/dolibarrnew/core/js/dst.js"></script>
<link rel="stylesheet" type="text/css" href="/dolibarrnew/theme/eldy/style.css.php?lang=fr_FR" />
<!-- HTTP_USER_AGENT = Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22 -->

View File

@ -39,6 +39,7 @@ $mesg = '';
$action = GETPOST('action');
$id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'int');
$cancel = GETPOST('cancel');
// Security check
if (!$user->admin)
@ -49,7 +50,7 @@ $accounting = new AccountingAccount($db);
// Action
if ($action == 'add')
{
if (! GETPOST('cancel', 'alpha')) {
if (! $cancel) {
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
@ -59,7 +60,7 @@ if ($action == 'add')
$accounting->fk_pcg_version = $obj->pcg_version;
$accounting->pcg_type = GETPOST('pcg_type');
$accounting->pcg_subtype = GETPOST('pcg_subtype');
$accounting->account_number = GETPOST('account_number', 'int');
$accounting->account_number = GETPOST('account_number');
$accounting->account_parent = GETPOST('account_parent', 'int');
$accounting->label = GETPOST('label', 'alpha');
$accounting->active = 1;
@ -94,7 +95,7 @@ else if ($action == 'edit')
$accounting->fk_pcg_version = $obj->pcg_version;
$accounting->pcg_type = GETPOST('pcg_type');
$accounting->pcg_subtype = GETPOST('pcg_subtype');
$accounting->account_number = GETPOST('account_number', 'int');
$accounting->account_number = GETPOST('account_number');
$accounting->account_parent = GETPOST('account_parent', 'int');
$accounting->label = GETPOST('label', 'alpha');
@ -261,7 +262,7 @@ else if ($id)
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
print '<td colspan="2">' . $accounting->pcg_subtype . '</td></tr>';
print '<tr><td>' . $langs->trans("Active") . '</td>';
print '<tr><td>' . $langs->trans("Activated") . '</td>';
print '<td colspan="2">';
if (empty($accounting->active)) {

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
@ -48,6 +48,8 @@ $action = GETPOST('action', 'alpha');
// Other parameters ACCOUNTING_*
$list = array (
'ACCOUNTING_LIMIT_LIST_VENTILATION',
'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc
'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc
'ACCOUNTING_LENGTH_GACCOUNT',
'ACCOUNTING_LENGTH_AACCOUNT',
'ACCOUNTING_ACCOUNT_CUSTOMER',
@ -287,7 +289,6 @@ if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) {
}
print '</tr>';
print "</table>\n";
print '<br /><br /><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';

View File

@ -2,7 +2,9 @@
/*
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
*
* 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
@ -19,129 +21,404 @@
*/
/**
* \file htdocs/accountancy/admin/productaccount.php
* \ingroup Accounting Expert
* \brief Onglet de gestion de parametrages des ventilations
* \file htdocs/accountancy/admin/productaccount.php
* \ingroup Accounting Expert
* \brief Onglet de gestion de parametrages des ventilations
*/
// Dolibarr environment
$res = @include ("../main.inc.php");
if (! $res && file_exists("../main.inc.php"))
$res = @include ("../main.inc.php");
if (! $res && file_exists("../../main.inc.php"))
$res = @include ("../../main.inc.php");
if (! $res && file_exists("../../../main.inc.php"))
$res = @include ("../../../main.inc.php");
if (! $res)
die("Include of main fails");
require '../../main.inc.php';
// Class
dol_include_once("/core/lib/report.lib.php");
dol_include_once("/core/lib/date.lib.php");
dol_include_once("/product/class/product.class.php");
// Class
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.'/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
// Langs
$langs->load("companies");
$langs->load("compta");
$langs->load("main");
$langs->load("accountancy");
// Security check
if (!$user->admin)
accessforbidden();
// Search & action GETPOST
$action = GETPOST('action');
$codeventil_buy = GETPOST('codeventil_buy', 'array');
$codeventil_sell = GETPOST('codeventil_sell', 'array');
$mesCasesCochees = GETPOST('mesCasesCochees', 'array');
$account_number_buy = GETPOST('account_number_buy');
$account_number_sell = GETPOST('account_number_sell');
$changeaccount = GETPOST('changeaccount','array');
$changeaccount_buy = GETPOST('changeaccount_buy','array');
$changeaccount_sell = GETPOST('changeaccount_sell','array');
$search_ref = GETPOST('search_ref','alpha');
$search_label = GETPOST('search_label','alpha');
$search_desc = GETPOST('search_desc','alpha');
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if ($page < 0) $page = 0;
$pageprev = $page - 1;
$pagenext = $page + 1;
//bug in page limit if ACCOUNTING_LIMIT_LIST_VENTILATION < $conf->liste_limit there is no pagination displayed !
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) && $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION >= $conf->liste_limit) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
//} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
// $limit = $conf->liste_limit;
} else {
$limit = $conf->liste_limit;
}
$offset = $limit * $page;
if (! $sortfield) $sortfield="p.ref";
if (! $sortorder) $sortorder="ASC";
// Security check
if ($user->societe_id > 0)
accessforbidden();
// TODO after adding menu
// if (! $user->rights->accounting->ventilation->dispatch)
// accessforbidden();
$form = new FormVentilation($db);
//Defaut AccountingAccount RowId Product / Service
//at this time ACCOUNTING_SERVICE_SOLD_ACCOUNT & ACCOUNTING_PRODUCT_SOLD_ACCOUNT are account number not accountingacount rowid
//so we need to get those default value rowid first
$accounting = new AccountingAccount($db);
//TODO: we should need to check if result is a really exist accountaccount rowid.....
$aarowid_servbuy = $accounting->fetch('', ACCOUNTING_SERVICE_BUY_ACCOUNT);
$aarowid_prodbuy = $accounting->fetch('', ACCOUNTING_PRODUCT_BUY_ACCOUNT);
$aarowid_servsell = $accounting->fetch('', ACCOUNTING_SERVICE_SOLD_ACCOUNT);
$aarowid_prodsell = $accounting->fetch('', ACCOUNTING_PRODUCT_SOLD_ACCOUNT);
$aacompta_servbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_servsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
// Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_ref='';
$search_label='';
$search_desc='';
}
//debug move header to top
llxHeader('', $langs->trans("Accounts"));
$form = new Form($db);
print '<input type="button" class="button" style="float: right;" value="Renseigner les comptes comptables produits manquant" onclick="launch_export();" />';
//TODO: modify to update all selected product with a sell account
if (is_array($changeaccount) && count($changeaccount) > 0 && $action == $langs->trans("Accountancy_code_sell")) {
//print_r ($changeaccount);
$error = 0;
$db->begin();
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "product as p";
$sql1 .= " SET p.accountancy_code_sell=" . $account_number_sell;
$sql1 .= ' WHERE p.rowid IN (' . implode(',', $changeaccount) . ')';
dol_syslog('accountancy/customer/lines.php::changeaccount product sell sql= ' . $sql1);
print_r ($sql1);
$resql1 = $db->query($sql1);
if (! $resql1) {
$error ++;
setEventMessage($db->lasterror(), 'errors');
}
if (! $error) {
$db->commit();
setEventMessage($langs->trans('Save'), 'mesgs');
} else {
$db->rollback();
setEventMessage($db->lasterror(), 'errors');
}
}
print '
<script type="text/javascript">
function launch_export() {
$("div.fiche div.tabBar form input[name=\"action\"]").val("export_csv");
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
}
//TODO: modify to update all selected product with a buy account
if (is_array($changeaccount) && count($changeaccount) > 0 && $action == $langs->trans("Accountancy_code_buy")) {
$error = 0;
$db->begin();
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "product as p";
$sql1 .= " SET p.accountancy_code_buy=" . $account_number_buy;
$sql1 .= ' WHERE p.rowid IN (' . implode(',', $changeaccount) . ')';
print_r ($sql1);
dol_syslog('accountancy/customer/lines.php::changeaccount product buy sql= ' . $sql1);
$resql1 = $db->query($sql1);
if (! $resql1) {
$error ++;
setEventMessage($db->lasterror(), 'errors');
}
if (! $error) {
$db->commit();
setEventMessage($langs->trans('Save'), 'mesgs');
} else {
$db->rollback();
setEventMessage($db->lasterror(), 'errors');
}
}
/*
* View
*/
//DEBUG elarifr
//llxHeader('', $langs->trans("Accounts"));
//For updating account export
print '<script type="text/javascript">
function launch_export() {
$("div.fiche div.tabBar form input[name=\"action\"]").val("export_csv");
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
}
</script>';
$sql = "SELECT p.rowid, p.ref , p.label, p.description , p.accountancy_code_sell as codesell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type , p.tosell , p.tobuy ";
$sql .= " FROM " . MAIN_DB_PREFIX . "product as p";
$sql .= " WHERE p.accountancy_code_sell IS NULL AND p.tosell = 1 OR p.accountancy_code_buy IS NULL AND p.tobuy = 1";
//TODO For select box
print '<script type="text/javascript">
$(function () {
$(\'#select-all\').click(function(event) {
// Iterate each checkbox
$(\':checkbox\').each(function() {
this.checked = true;
});
});
$(\'#unselect-all\').click(function(event) {
// Iterate each checkbox
$(\':checkbox\').each(function() {
this.checked = false;
});
});
});
</script>';
dol_syslog('accountancy/admin/productaccount.php:: $sql=' . $sql);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
/*
* Action
*/
//TODO
/*
if ($action == 'ventil') {
print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
if (! empty($codeventil_buy) && ! empty($mesCasesCochees)) {
if (! empty($codeventil_sell) && ! empty($mesCasesCochees)) {
/*
* view
*/
print '<br><br>';
print '<table class="noborder" width="100%">';
print '<td align="left">' . $langs->trans("Ref") . '</td>';
print '<td align="left">' . $langs->trans("Label") . '</td>';
print '<td align="left">' . $langs->trans("Description") . '</td>';
print '<td align="left">' . $langs->trans("Accountancy_code_buy") . '</td>';
print '<td align="left">' . $langs->trans("Accountancy_code_buy_suggest") . '</td>';
print '<td align="left">' . $langs->trans("Accountancy_code_sell") . '</td>';
print '<td align="left">' . $langs->trans("Accountancy_code_sell_suggest") . '</td>';
$var = true;
while ( $i < min($num, 250) ) {
$obj = $db->fetch_object($resql);
$var = ! $var;
$compta_prodsell = $obj->accountancy_code_sell;
if (empty($compta_prodsell)) {
if ($obj->product_type == 0)
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
else
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
}
$compta_prodbuy = $obj->accountancy_code_buy;
if (empty($compta_prodbuy)) {
if ($obj->product_type == 0)
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
else
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
}
$product_static = new Product($db);
print "<tr $bc[$var]>";
// Ref produit
$product_static->ref = $objp->ref;
$product_static->id = $objp->rowid;
$product_static->type = $objp->type;
print '<td>';
if ($product_static->id)
print $product_static->getNomUrl(1);
else
print '&nbsp;';
print '</td>';
print '<td align="left">' . $obj->ref . '</td>';
print '<td align="left">' . $obj->label . '</td>';
print '<td align="left">' . $obj->description . '</td>';
print '<td align="left">' . $obj->accountancy_code_buy . '</td>';
print '<td align="left">' . $compta_prodbuy . '</td>';
print '<td align="left">' . $obj->accountancy_code_sell . '</td>';
print '<td align="left">' . $compta_prodsell . '</td>';
print "</tr>\n";
$i ++;
}
print "</table>";
$db->free($resql);
} else {
dol_print_error($db);
} else {
print '<div><font color="red">' . $langs->trans("AnyLineVentilate") . '</font></div>';
}
print '<div><font color="red">' . $langs->trans("EndProcessing") . '</font></div>';
}
*/
//do we really need to exclude old product not tosell / tobuy ?
//$sql = "SELECT p.rowid, p.ref , p.label, p.description , p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type , p.tosell , p.tobuy ";
//$sql .= " WHERE p.accountancy_code_sell IS NULL AND p.tosell = 1 OR p.accountancy_code_buy IS NULL AND p.tobuy = 1";
//$sql .= " WHERE p.accountancy_code_sell ='' AND p.tosell = 1 OR p.accountancy_code_buy ='' AND p.tobuy = 1";
$sql = "SELECT p.rowid, p.ref , p.label, p.description , p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type";
$sql .= " FROM " . MAIN_DB_PREFIX . "product as p";
//$sql .= " , " . MAIN_DB_PREFIX . "accountingaccount as aa";
$sql .= " WHERE (";
$sql .= " p.accountancy_code_sell ='' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_buy ='' OR p.accountancy_code_buy IS NULL";
//Search on correct pcg version
$pcgver = $conf->global->CHARTOFACCOUNTS;
$sql .= " OR (p.accountancy_code_sell IS NOT NULL AND p.accountancy_code_sell != '' AND p.accountancy_code_sell NOT IN
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))";
//(SELECT account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa WHERE fk_pcg_version='PCG99-BASE'))";
$sql .= " OR (p.accountancy_code_buy IS NOT NULL AND p.accountancy_code_buy != '' AND p.accountancy_code_buy NOT IN
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))";
//(SELECT account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa WHERE fk_pcg_version='PCG99-BASE'))";
$sql .= ")";
//Add search filter like
if (strlen(trim($search_ref))) {
$sql .= " AND (p.ref like '" . $search_ref . "%')";
}
if (strlen(trim($search_label))) {
$sql .= " AND (p.label like '" . $search_label . "%')";
}
if (strlen(trim($search_desc))) {
$sql .= " AND (p.description like '%" . $search_desc . "%')";
}
$sql.= $db->order($sortfield,$sortorder);
$sql .= $db->plimit($limit + 1, $offset);
dol_syslog("/accountancy/admin/productaccount.php:: sql=" . $sql, LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
$num_lines = $db->num_rows($result);
$i = 0;
/*
* View
*/
print_barre_liste($langs->trans("ProductAccountingAccountSelect"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
print '<td align="left"><b>' . $langs->trans("DescProductAccountingAccount") . '</b></td>&nbsp;';
print_liste_field_titre($langs->trans("RowId"), $_SERVER["PHP_SELF"],"p.rowid","",$param,'',$sortfield,$sortorder);
print '&nbsp;&nbsp;';
//DEBUG
//print $sql;
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post"><br />';
// print '<input type="hidden" name="action" value="ventil">';
print '<table class="noborder" width="100%">';
print '<tr>';
print '<td width="33%">';
print '<div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br />';
print $langs->trans("Accountancy_code_buy") . ': ' . $form->select_account($account_number_buy, 'account_number_buy', 1,'', 0, 1);
print '<input type="submit" class="butAction" name="action" value="' . $langs->trans("Accountancy_code_buy") . '"/></div>';
print '</td>';
print '<td width="33%">';
print '<div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br />';
print $langs->trans("Accountancy_code_sell") . ': ' . $form->select_account($account_number_sell, 'account_number_sell', 1, '', 0, 1);
print '<input type="submit" class="butAction" name="action" value="' . $langs->trans("Accountancy_code_sell") . '"/></div>';
print '</td>';
print '<td width="33%">';
//TODO change button
print '<input type="button" class="button" style="float: right;" value="Renseigner les comptes comptables produits manquant" onclick="launch_export();" />';
print '</td>';
print '</tr>';
print '</table>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
// print '<td align="left">' . $langs->trans("Ref") . '</td>';
// print '<td align="left">' . $langs->trans("Label") . '</td>';
// print '<td align="left">' . $langs->trans("Description") . '</td>';
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"],"p.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder);
print '<td align="left">' . $langs->trans("Accountancy_code_buy") . '</td>';
print '<td align="left">' . $langs->trans("Accountancy_code_buy_suggest") . '</td>';
print '<td align="left">' . $langs->trans("Accountancy_code_sell") . '</td>';
print '<td align="left">' . $langs->trans("Accountancy_code_sell_suggest") . '</td>';
print_liste_field_titre('');
// print_liste_field_titre('');
print '<td align="center" colspan="2">' . $langs->trans("Ventilate") . '<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>'.'</td>';
print '</tr>';
print '<tr class="liste_titre">';
print '<td class="liste_titre">%<input type="text" class="flat" size="20" name="search_ref" value="' . $search_ref . '"></td>';
print '<td class="liste_titre">%<input type="text" class="flat" size="20" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="30" name="search_desc" value="' . $search_desc . '"></td>';
print '<td class="liste_titre" colspan="3">&nbsp;</td>';
print '<td align="right" colspan="4" class="liste_titre">';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
// print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '&nbsp;';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
// print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
// print '<td class="liste_titre" colspan="2">&nbsp;</td>';
print '</tr>';
$var = true;
while ( $i < min($num_lines, 250) ) {
$obj = $db->fetch_object($result);
$var = ! $var;
$compta_prodsell = $obj->accountancy_code_sell;
if (empty($compta_prodsell)) {
if ($obj->product_type == 0) {
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_prodsell;
} else {
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_servsell;
}
}
$compta_prodbuy = $obj->accountancy_code_buy;
if (empty($compta_prodbuy)) {
if ($obj->product_type == 0) {
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodbuy_id = $aarowid_prodbuy;
} else {
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodbuy_id = $aarowid_servbuy;
}
}
$product_static = new Product($db);
print "<tr $bc[$var]>";
//debug
print '<td align="left" colspan="6">Compte Suggeres compta_prodbuy=' . $compta_prodbuy . ' -- compta_prodbuy_id' . $compta_prodbuy_id . '-- compta_prodsell:' . $compta_prodsell . '-- compta_prodsell_id' . $compta_prodsell_id . '</td>';
print "</tr>";
print "<tr $bc[$var]>";
// Ref produit as link
$product_static->ref = $obj->ref;
$product_static->id = $obj->rowid;
$product_static->type = $obj->type;
print '<td>';
if ($product_static->id)
print $product_static->getNomUrl(1);
else
print '-&nbsp;';
print '</td>';
print '<td align="left">' . $obj->label . '</td>';
//TODO ADJUST DESCRIPTION SIZE
// print '<td align="left">' . $obj->description . '</td>';
//TODO: we shoul set a user defined value to adjust user square / wide screen size
$trunclengh = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($obj->description, $trunclengh)) . '</td>';
//acountingaccount buy
print '<td align="left">' . $obj->accountancy_code_buy . '</td>';
//TODO: replace by select
// print '<td align="left">' . $compta_prodbuy . '</td>';
//TODO: we shoul set a user defined value to adjust user square / wide screen size
//$trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
print '<td align="center">';
print $form->select_account($compta_prodbuy_id, 'codeventil[]', 1);
print '</td>';
//acountingaccount sel
print '<td align="left">' . $obj->accountancy_code_sell . '</td>';
//TODO: replace by select
//TODO: we shoul set a user defined value to adjust user square / wide screen size
//$trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
print '<td align="center">';
print $form->select_account($compta_prodsell_id, 'codeventil[]', 1);
print '</td>';
//action edit & select box
print '<td align="center">' . $obj->rowid . '</td>';
print '<td><a href="./card.php?id=' . $obj->rowid . '">';
print img_edit();
print '</a></td>';
//Checkbox select
print '<td align="center">';
print '<input type="checkbox" name="changeaccount[]" value="' . $obj->rowid . '"/></td>';
print "</tr>";
$i ++;
}
$db->free($result);
} else {
// print $db->error();
dol_print_error($db);
}
print "</table></form>";
llxFooter();
$db->close();

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* 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
@ -18,23 +18,23 @@
*/
/**
* \file htdocs/accountancy/bookkeeping/card.php
* \ingroup Accounting Expert
* \brief Page to show account
* \file htdocs/accountancy/bookkeeping/card.php
* \ingroup Accounting Expert
* \brief Page to show account
*/
require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
// Langs
$langs->load("accounting");
$langs->load("accountancy");
// Security check
$id = GETPOST('id', 'int');
if ($user->societe_id > 0)
accessforbidden();
accessforbidden();
$action = GETPOST('action');
$piece_num = GETPOST("piece_num");
@ -48,132 +48,132 @@ $debit = price2num(GETPOST('debit'));
$credit = price2num(GETPOST('credit'));
if ($action == "confirm_update") {
$error = 0;
if ((intval($debit) != 0) && (intval($credit) != 0)) {
setEventMessage($langs->trans('ErrorDebitCredit'), 'errors');
$error ++;
}
if (empty($error)) {
$book = new BookKeeping($db);
$result = $book->fetch($id);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
} else {
$book->numero_compte = $numero_compte;
$book->code_tiers = $code_tiers;
$book->label_compte = $label_compte;
$book->debit = $debit;
$book->credit = $credit;
if (! empty($debit)) {
$book->montant = $debit;
$book->sens = 'D';
}
if (! empty($credit)) {
$book->montant = $credit;
$book->sens = 'C';
}
$result = $book->update();
if ($result < 0) {
setEventMessage($book->errors, 'errors');
} else {
setEventMessage($langs->trans('Saved'), 'mesgs');
$action = '';
}
}
}
}
$error = 0;
if ((intval($debit) != 0) && (intval($credit) != 0)) {
setEventMessage($langs->trans('ErrorDebitCredit'), 'errors');
$error ++;
}
if (empty($error)) {
$book = new BookKeeping($db);
$result = $book->fetch($id);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
} else {
$book->numero_compte = $numero_compte;
$book->code_tiers = $code_tiers;
$book->label_compte = $label_compte;
$book->debit = $debit;
$book->credit = $credit;
if (! empty($debit)) {
$book->montant = $debit;
$book->sens = 'D';
}
if (! empty($credit)) {
$book->montant = $credit;
$book->sens = 'C';
}
$result = $book->update();
if ($result < 0) {
setEventMessage($book->errors, 'errors');
} else {
setEventMessage($langs->trans('Saved'), 'mesgs');
$action = '';
}
}
}
}
else if ($action == "add") {
$error = 0;
if ((intval($debit) != 0) && (intval($credit) != 0)) {
setEventMessage($langs->trans('ErrorDebitCredit'), 'errors');
$error ++;
}
if (empty($error)) {
$book = new BookKeeping($db);
$book->numero_compte = $numero_compte;
$book->code_tiers = $code_tiers;
$book->label_compte = $label_compte;
$book->debit = $debit;
$book->credit = $credit;
$book->doc_date = GETPOST('doc_date');
$book->doc_type = GETPOST('doc_type');
$book->piece_num = $piece_num;
$book->doc_ref = GETPOST('doc_ref');
$book->code_journal = GETPOST('code_journal');
$book->fk_doc = GETPOST('fk_doc');
$book->fk_docdet = GETPOST('fk_docdet');
if (! empty($debit)) {
$book->montant = $debit;
$book->sens = 'D';
}
if (! empty($credit)) {
$book->montant = $credit;
$book->sens = 'C';
}
$result = $book->create_std($user);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
} else {
setEventMessage($langs->trans('Saved'), 'mesgs');
$action = '';
}
}
}
$error = 0;
if ((intval($debit) != 0) && (intval($credit) != 0)) {
setEventMessage($langs->trans('ErrorDebitCredit'), 'errors');
$error ++;
}
if (empty($error)) {
$book = new BookKeeping($db);
$book->numero_compte = $numero_compte;
$book->code_tiers = $code_tiers;
$book->label_compte = $label_compte;
$book->debit = $debit;
$book->credit = $credit;
$book->doc_date = GETPOST('doc_date');
$book->doc_type = GETPOST('doc_type');
$book->piece_num = $piece_num;
$book->doc_ref = GETPOST('doc_ref');
$book->code_journal = GETPOST('code_journal');
$book->fk_doc = GETPOST('fk_doc');
$book->fk_docdet = GETPOST('fk_docdet');
if (! empty($debit)) {
$book->montant = $debit;
$book->sens = 'D';
}
if (! empty($credit)) {
$book->montant = $credit;
$book->sens = 'C';
}
$result = $book->create_std($user);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
} else {
setEventMessage($langs->trans('Saved'), 'mesgs');
$action = '';
}
}
}
else if ($action == "confirm_delete") {
$book = new BookKeeping($db);
$result = $book->fetch($id);
$piece_num = $book->piece_num;
if ($result < 0) {
setEventMessage($book->errors, 'errors');
} else {
$result = $book->delete($user);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
}
}
$action = '';
}
$book = new BookKeeping($db);
$result = $book->fetch($id);
$piece_num = $book->piece_num;
if ($result < 0) {
setEventMessage($book->errors, 'errors');
} else {
$result = $book->delete($user);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
}
}
$action = '';
}
else if ($action == "confirm_create") {
$book = new BookKeeping($db);
$book->label_compte = '';
$book->debit = 0;
$book->credit = 0;
$book->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOST('doc_datemonth'), GETPOST('doc_dateday'), GETPOST('doc_dateyear'));
$book->doc_type = GETPOST('doc_type');
$book->piece_num = GETPOST('next_num_mvt');
$book->doc_ref = GETPOST('doc_ref');
$book->code_journal = GETPOST('code_journal');
$book->fk_doc = 0;
$book->fk_docdet = 0;
$book->montant = 0;
$result = $book->create_std($user);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
} else {
setEventMessage($langs->trans('Saved'), 'mesgs');
$action = '';
$piece_num = $book->piece_num;
}
$book = new BookKeeping($db);
$book->label_compte = '';
$book->debit = 0;
$book->credit = 0;
$book->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOST('doc_datemonth'), GETPOST('doc_dateday'), GETPOST('doc_dateyear'));
$book->doc_type = GETPOST('doc_type');
$book->piece_num = GETPOST('next_num_mvt');
$book->doc_ref = GETPOST('doc_ref');
$book->code_journal = GETPOST('code_journal');
$book->fk_doc = 0;
$book->fk_docdet = 0;
$book->montant = 0;
$result = $book->create_std($user);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
} else {
setEventMessage($langs->trans('Saved'), 'mesgs');
$action = '';
$piece_num = $book->piece_num;
}
}
llxHeader();
@ -181,197 +181,194 @@ llxHeader();
$html = new Form($db);
/*
* Confirmation to delete the command
* Confirmation to delete the command
*/
if ($action == 'delete') {
$formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'confirm_delete', '', 0, 1);
print $formconfirm;
$formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'confirm_delete', '', 0, 1);
print $formconfirm;
}
if ($action == 'create') {
print_fiche_titre($langs->trans("CreateMvts"));
$code_journal_array = array (
$conf->global->ACCOUNTING_SELL_JOURNAL => $conf->global->ACCOUNTING_SELL_JOURNAL,
$conf->global->ACCOUNTING_PURCHASE_JOURNAL => $conf->global->ACCOUNTING_PURCHASE_JOURNAL,
$conf->global->ACCOUNTING_BANK_JOURNAL => $conf->global->ACCOUNTING_BANK_JOURNAL,
$conf->global->ACCOUNTING_SOCIAL_JOURNAL => $conf->global->ACCOUNTING_SOCIAL_JOURNAL
);
$book = new BookKeeping($db);
$next_num_mvt = $book->getNextNumMvt();
print '<form action="' . $_SERVER["PHP_SELF"] . '" name="create_mvt" method="POST">';
print '<input type="hidden" name="action" value="confirm_create">' . "\n";
print '<input type="hidden" name="next_num_mvt" value="' . $next_num_mvt . '">' . "\n";
print_fiche_titre($langs->trans("CreateMvts"));
dol_fiche_head();
$code_journal_array = array (
$conf->global->ACCOUNTING_SELL_JOURNAL => $conf->global->ACCOUNTING_SELL_JOURNAL,
$conf->global->ACCOUNTING_PURCHASE_JOURNAL => $conf->global->ACCOUNTING_PURCHASE_JOURNAL,
$conf->global->ACCOUNTING_SOCIAL_JOURNAL => $conf->global->ACCOUNTING_SOCIAL_JOURNAL,
$conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL => $conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL,
$conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL => $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL
);
print '<table class="border" width="100%">';
print '<tr>';
print '<td>' . $langs->trans("NumMvts") . '</td>';
print '<td>' . $next_num_mvt . '</td>';
print '</tr>';
print '<tr>';
print '<td>' . $langs->trans("Docdate") . '</td>';
print '<td>';
print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1);
print '</td>';
print '</tr>';
print '<tr>';
print '<td>' . $langs->trans("Codejournal") . '</td>';
print '<td>' . $html->selectarray('code_journal', $code_journal_array) . '</td>';
print '</tr>';
print '<tr>';
print '<td>' . $langs->trans("Docref") . '</td>';
print '<td><input type="text" size="20" name="doc_ref" value=""/></td>';
print '</tr>';
print '<tr>';
print '<td>' . $langs->trans("Doctype") . '</td>';
print '<td><input type="text" size="20" name="doc_type" value=""/></td>';
print '</tr>';
print '</table>';
$book = new BookKeeping($db);
$next_num_mvt = $book->getNextNumMvt();
print '<form action="' . $_SERVER["PHP_SELF"] . '" name="create_mvt" method="POST">';
print '<input type="hidden" name="action" value="confirm_create">' . "\n";
print '<input type="hidden" name="next_num_mvt" value="' . $next_num_mvt . '">' . "\n";
dol_fiche_head();
print '<table class="border" width="100%">';
print '<tr>';
print '<td>' . $langs->trans("NumMvts") . '</td>';
print '<td>' . $next_num_mvt . '</td>';
print '</tr>';
print '<tr>';
print '<td>' . $langs->trans("Docdate") . '</td>';
print '<td>';
print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1);
print '</td>';
print '</tr>';
print '<tr>';
print '<td>' . $langs->trans("Codejournal") . '</td>';
print '<td>' . $html->selectarray('code_journal', $code_journal_array) . '</td>';
print '</tr>';
print '<tr>';
print '<td>' . $langs->trans("Docref") . '</td>';
print '<td><input type="text" size="20" name="doc_ref" value=""/></td>';
print '</tr>';
print '<tr>';
print '<td>' . $langs->trans("Doctype") . '</td>';
print '<td><input type="text" size="20" name="doc_type" value=""/></td>';
print '</tr>';
print '</table>';
dol_fiche_end();
print '<div align="center"><input type="submit" class="butAction" value="' . $langs->trans("Save") . '">';
print '<div align="center"><input type="submit" class="button" value="' . $langs->trans("Create") . '">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="'.$langs->trans("Cancel").'" class="button" onclick="history.go(-1)" />';
print '</div>';
print '</form>';
}
else
{
$book = new BookKeeping($db);
$result = $book->fetch_per_mvt($piece_num);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
}
if (! empty($book->piece_num)) {
print_fiche_titre($langs->trans("UpdateMvts"));
print '<table class="border" width="100%">';
print '<tr class="pair">';
print '<td>' . $langs->trans("NumMvts") . '</td>';
print '<td>' . $book->piece_num . '</td>';
print '</tr>';
print '<tr class="impair">';
print '<td>' . $langs->trans("Docdate") . '</td>';
print '<td>' . dol_print_date($book->doc_date, 'daytextshort') . '</td>';
print '</tr>';
print '<tr class="pair">';
print '<td>' . $langs->trans("Codejournal") . '</td>';
print '<td>' . $book->code_journal . '</td>';
print '</tr>';
print '<tr class="impair">';
print '<td>' . $langs->trans("Docref") . '</td>';
print '<td>' . $book->doc_ref . '</td>';
print '</tr>';
print '<tr class="pair">';
print '<td>' . $langs->trans("Doctype") . '</td>';
print '<td>' . $book->doc_type . '</td>';
print '</tr>';
print '</table>';
$result = $book->fetch_all_per_mvt($piece_num);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
} else {
print_fiche_titre($langs->trans("ListeMvts"));
print "<table class=\"noborder\" width=\"100%\">";
if (count($book->linesmvt) > 0) {
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Numerocompte"));
print_liste_field_titre($langs->trans("Code_tiers"));
print_liste_field_titre($langs->trans("Labelcompte"));
print_liste_field_titre($langs->trans("Debit"));
print_liste_field_titre($langs->trans("Credit"));
print_liste_field_titre($langs->trans("Amount"));
print_liste_field_titre($langs->trans("Sens"));
print_liste_field_titre('');
print '</form>';
} else {
$book = new BookKeeping($db);
$result = $book->fetch_per_mvt($piece_num);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
}
if (! empty($book->piece_num)) {
print "</tr>\n";
foreach ( $book->linesmvt as $line ) {
$var = ! $var;
print "<tr $bc[$var]>";
if ($action == 'update' && $line->id == $id) {
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">';
print '<input type="hidden" name="id" value="' . $line->id . '">' . "\n";
print '<input type="hidden" name="action" value="confirm_update">' . "\n";
print '<td><input type="text" size="6" name="numero_compte" value="' . $line->numero_compte . '"/></td>';
print '<td><input type="text" size="15" name="code_tiers" value="' . $line->code_tiers . '"/></td>';
print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
print '<td><input type="text" size="6" name="debit" value="' . price($line->debit) . '"/></td>';
print '<td><input type="text" size="6" name="credit" value="' . price($line->credit) . '"/></td>';
print '<td>' . $line->montant . '</td>';
print '<td>' . $line->sens . '</td>';
print '<td>';
print '<input type="submit" class="button" value="' . $langs->trans("Update") . '">';
print '</form>';
print '</td>';
}
else {
print '<td>' . $line->numero_compte . '</td>';
print '<td>' . $line->code_tiers . '</td>';
print '<td>' . $line->label_compte . '</td>';
print '<td>' . $line->debit . '</td>';
print '<td>' . $line->credit . '</td>';
print '<td>' . $line->montant . '</td>';
print '<td>' . $line->sens . '</td>';
print '<td>';
print '<a href="./card.php?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '">';
print img_edit();
print '</a>&nbsp;';
print '<a href="./card.php?action=delete&id=' . $line->id . '&piece_num=' . $line->piece_num . '">';
print img_delete();
print '</a>';
print '</td>';
}
print "</tr>\n";
}
if ($action == "" || $action == 'add') {
$var = ! $var;
print "<tr $bc[$var]>";
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">';
print '<input type="hidden" name="action" value="add">' . "\n";
print '<input type="hidden" name="doc_date" value="' . $book->doc_date . '">' . "\n";
print '<input type="hidden" name="doc_type" value="' . $book->doc_type . '">' . "\n";
print '<input type="hidden" name="doc_ref" value="' . $book->doc_ref . '">' . "\n";
print '<input type="hidden" name="code_journal" value="' . $book->code_journal . '">' . "\n";
print '<input type="hidden" name="fk_doc" value="' . $book->fk_doc . '">' . "\n";
print '<input type="hidden" name="fk_docdet" value="' . $book->fk_docdet . '">' . "\n";
print '<td><input type="text" size="6" name="numero_compte" value="' . $numero_compte . '"/></td>';
print '<td><input type="text" size="15" name="code_tiers" value="' . $code_tiers . '"/></td>';
print '<td><input type="text" size="15" name="label_compte" value="' . $label_compte . '"/></td>';
print '<td><input type="text" size="6" name="debit" value="' . price($debit) . '"/></td>';
print '<td><input type="text" size="6" name="credit" value="' . price($credit) . '"/></td>';
print '<td></td>';
print '<td></td>';
print '<td><input type="submit" class="button" value="' . $langs->trans("Save") . '"></td>';
print '</tr>';
}
print '</table>';
print '</form>';
}
}
}
else {
print_fiche_titre($langs->trans("NoRecords"));
}
print_fiche_titre($langs->trans("UpdateMvts"));
print '<table class="border" width="100%">';
print '<tr class="pair">';
print '<td>' . $langs->trans("NumMvts") . '</td>';
print '<td>' . $book->piece_num . '</td>';
print '</tr>';
print '<tr class="impair">';
print '<td>' . $langs->trans("Docdate") . '</td>';
print '<td>' . dol_print_date($book->doc_date, 'daytextshort') . '</td>';
print '</tr>';
print '<tr class="pair">';
print '<td>' . $langs->trans("Codejournal") . '</td>';
print '<td>' . $book->code_journal . '</td>';
print '</tr>';
print '<tr class="impair">';
print '<td>' . $langs->trans("Docref") . '</td>';
print '<td>' . $book->doc_ref . '</td>';
print '</tr>';
print '<tr class="pair">';
print '<td>' . $langs->trans("Doctype") . '</td>';
print '<td>' . $book->doc_type . '</td>';
print '</tr>';
print '</table>';
$result = $book->fetch_all_per_mvt($piece_num);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
} else {
print_fiche_titre($langs->trans("ListeMvts"));
print "<table class=\"noborder\" width=\"100%\">";
if (count($book->linesmvt) > 0) {
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Numerocompte"));
print_liste_field_titre($langs->trans("Code_tiers"));
print_liste_field_titre($langs->trans("Labelcompte"));
print_liste_field_titre($langs->trans("Debit"));
print_liste_field_titre($langs->trans("Credit"));
print_liste_field_titre($langs->trans("Amount"));
print_liste_field_titre($langs->trans("Sens"));
print_liste_field_titre('');
print "</tr>\n";
foreach ( $book->linesmvt as $line ) {
$var = ! $var;
print "<tr $bc[$var]>";
if ($action == 'update' && $line->id == $id) {
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">';
print '<input type="hidden" name="id" value="' . $line->id . '">' . "\n";
print '<input type="hidden" name="action" value="confirm_update">' . "\n";
print '<td><input type="text" size="6" name="numero_compte" value="' . $line->numero_compte . '"/></td>';
print '<td><input type="text" size="15" name="code_tiers" value="' . $line->code_tiers . '"/></td>';
print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
print '<td><input type="text" size="6" name="debit" value="' . price($line->debit) . '"/></td>';
print '<td><input type="text" size="6" name="credit" value="' . price($line->credit) . '"/></td>';
print '<td>' . $line->montant . '</td>';
print '<td>' . $line->sens . '</td>';
print '<td>';
print '<input type="submit" class="button" value="' . $langs->trans("Update") . '">';
print '</form>';
print '</td>';
} else {
print '<td>' . $line->numero_compte . '</td>';
print '<td>' . $line->code_tiers . '</td>';
print '<td>' . $line->label_compte . '</td>';
print '<td>' . $line->debit . '</td>';
print '<td>' . $line->credit . '</td>';
print '<td>' . $line->montant . '</td>';
print '<td>' . $line->sens . '</td>';
print '<td>';
print '<a href="./card.php?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '">';
print img_edit();
print '</a>&nbsp;';
print '<a href="./card.php?action=delete&id=' . $line->id . '&piece_num=' . $line->piece_num . '">';
print img_delete();
print '</a>';
print '</td>';
}
print "</tr>\n";
}
if ($action == "" || $action == 'add') {
$var = ! $var;
print "<tr $bc[$var]>";
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">';
print '<input type="hidden" name="action" value="add">' . "\n";
print '<input type="hidden" name="doc_date" value="' . $book->doc_date . '">' . "\n";
print '<input type="hidden" name="doc_type" value="' . $book->doc_type . '">' . "\n";
print '<input type="hidden" name="doc_ref" value="' . $book->doc_ref . '">' . "\n";
print '<input type="hidden" name="code_journal" value="' . $book->code_journal . '">' . "\n";
print '<input type="hidden" name="fk_doc" value="' . $book->fk_doc . '">' . "\n";
print '<input type="hidden" name="fk_docdet" value="' . $book->fk_docdet . '">' . "\n";
print '<td><input type="text" size="6" name="numero_compte" value="' . $numero_compte . '"/></td>';
print '<td><input type="text" size="15" name="code_tiers" value="' . $code_tiers . '"/></td>';
print '<td><input type="text" size="15" name="label_compte" value="' . $label_compte . '"/></td>';
print '<td><input type="text" size="6" name="debit" value="' . price($debit) . '"/></td>';
print '<td><input type="text" size="6" name="credit" value="' . price($credit) . '"/></td>';
print '<td></td>';
print '<td></td>';
print '<td><input type="submit" class="button" value="' . $langs->trans("Save") . '"></td>';
print '</tr>';
}
print '</table>';
print '</form>';
}
}
}
else {
print_fiche_titre($langs->trans("NoRecords"));
}
}
llxFooter();

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* 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
@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
// Langs
$langs->load("accountancy");
$page = GETPOST("page");
$sortorder = GETPOST("sortorder");
@ -155,8 +157,6 @@ else {
print '</form>';
print '<a href="./card.php?action=create" class="butAction">' . $langs->trans("NewAccountingMvt") . '</a></div>';
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="export_csv">';
@ -209,7 +209,7 @@ else {
print "<tr $bc[$var]>";
print '<td>' . $obj->doc_type . '</td>';
print '<td>' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
print '<td align="center">' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
print '<td>' . $obj->doc_ref . '</td>';
print '<td>' . length_accountg($obj->numero_compte) . '</td>';
print '<td>' . length_accounta($obj->code_tiers) . '</td>';
@ -224,6 +224,11 @@ else {
$i ++;
}
print "</table>";
print '<div class="tabsAction">';
print '<a class="butAction" href="./card.php?action=create">'.$langs->trans("NewAccountingMvt").'</a>';
print '</div>';
$db->free($resql);
} else {
dol_print_error($db);

View File

@ -3,6 +3,7 @@
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
*
* 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
@ -119,8 +120,6 @@ class AccountingAccount extends CommonObject
$error = 0;
$now = dol_now();
$now=dol_now();
// Clean parameters
if (isset($this->fk_pcg_version))
$this->fk_pcg_version = trim($this->fk_pcg_version);

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
*
* 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
@ -91,10 +92,13 @@ class FormVentilation extends Form
* @param string $htmlname Name of field in html form
* @param int $showempty Add an empty field
* @param array $event Event options
* @param int $select_in $selectid value is a aa.rowid (0 default) or aa.account_number (1)
* @param int $select_out set value returned by select 0=rowid (default), 1=account_number
* @param int $aabase set accountingaccount base class to display empty=all or from 1 to 8 will display only account beginning by
*
* @return string String with HTML select
*/
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array())
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '')
{
global $conf;
@ -116,21 +120,26 @@ class FormVentilation extends Form
if ($showempty)
$out .= '<option value="-1"></option>';
$num = $this->db->num_rows($resql);
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : '50';
$i = 0;
if ($num) {
while ( $i < $num ) {
$obj = $this->db->fetch_object($resql);
$label = $obj->account_number . ' - ' . $obj->label;
$label = dol_trunc($label, $trunclength);
if ($select_in == 0 ) $select_value_in = $obj->rowid;
if ($select_in == 1 ) $select_value_in = $obj->account_number;
if ($select_out == 0 ) $select_value_out = $obj->rowid;
if ($select_out == 1 ) $select_value_out = $obj->account_number;
// Remember guy's we store in database llx_facturedet the rowid of accountingaccount and not the account_number
// Because same account_number can be share between different accounting_system and do have the same meaning
if (($selectid != '') && $selectid == $obj->rowid) {
if (($selectid != '') && $selectid == $select_value_in) {
// $out .= '<option value="' . $obj->account_number . '" selected>' . $label . '</option>';
$out .= '<option value="' . $obj->rowid . '" selected>' . $label . '</option>';
$out .= '<option value="' . $select_value_out . '" selected>' . $label . '</option>';
} else {
// $out .= '<option value="' . $obj->account_number . '">' . $label . '</option>';
$out .= '<option value="' . $obj->rowid . '">' . $label . '</option>';
$out .= '<option value="' . $select_value_out . '">' . $label . '</option>';
}
$i ++;
}

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
*
@ -39,7 +39,7 @@ $langs->load("accountancy");
$account_parent = GETPOST('account_parent');
$changeaccount = GETPOST('changeaccount');
$search_ref = GETPOST('search_ref','alpha');
$search_facture = GETPOST('search_facture','alpha');
$search_invoice = GETPOST('search_invoice','alpha');
$search_label = GETPOST('search_label','alpha');
$search_desc = GETPOST('search_desc','alpha');
$search_amount = GETPOST('search_amount','alpha');
@ -49,13 +49,37 @@ $sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if ($page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page;
//if ($page == -1) { $page = 0; }
if ($page < 0) $page = 0;
$pageprev = $page - 1;
$pagenext = $page + 1;
$limit = $conf->liste_limit;
if (! $sortfield) $sortfield="f.facnumber";
if (! $sortorder) $sortorder="DESC";
//$limit = $conf->liste_limit;
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
$limit = $conf->liste_limit;
} else {
$limit = $conf->liste_limit;
}
//$offset = $conf->liste_limit * $page;
$offset = $limit * $page;
// TODO : remove comment
//elarifr we can not use only
//$sql .= " ORDER BY l.rowid";
// f.datef will order like FA08 FA09 FA10 FA05 FA06 FA07 FA04...
// f.facnumber will not order properly invoice / avoir / accompte you can have All AC then All AV and all FA
// l.rowid when an invoice is edited rowid are added at end of table & facturedet.rowid are not ordered
//if (! $sortfield) $sortfield="f.facnumber";
if (! $sortfield) $sortfield="f.datef, f.facnumber, l.rowid";
//if (! $sortorder) $sortorder="DESC";
if (! $sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
$sortorder = " DESC ";
}
}
// Security check
if ($user->societe_id > 0)
@ -69,7 +93,7 @@ $formventilation = new FormVentilation($db);
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_ref='';
$search_facture='';
$search_invoice='';
$search_label='';
$search_desc='';
$search_amount='';
@ -106,6 +130,31 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
llxHeader('', $langs->trans("CustomersVentilation") . ' - ' . $langs->trans("Dispatched"));
print '<script type="text/javascript">
$(function () {
$(\'#select-all\').click(function(event) {
// Iterate each checkbox
$(\':checkbox\').each(function() {
this.checked = true;
});
});
$(\'#unselect-all\').click(function(event) {
// Iterate each checkbox
$(\':checkbox\').each(function() {
this.checked = false;
});
});
});
</script>';
/*
* Action
*/
/*
* Customer Invoice lines
*/
$sql = "SELECT l.rowid , f.facnumber, f.rowid as facid, l.fk_product, l.description, l.total_ht, l.qty, l.tva_tx, l.fk_code_ventilation, aa.label, aa.account_number,";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type";
$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
@ -114,8 +163,8 @@ $sql .= " , " . MAIN_DB_PREFIX . "facturedet as l";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
$sql .= " WHERE f.rowid = l.fk_facture AND f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 ";
$sql .= " AND aa.rowid = l.fk_code_ventilation";
if (strlen(trim(GETPOST("search_facture")))) {
$sql .= " AND f.facnumber like '%" . $search_facture . "%'";
if (strlen(trim($search_invoice))) {
$sql .= " AND f.facnumber like '%" . $search_invoice . "%'";
}
if (strlen(trim($search_ref))) {
$sql .= " AND p.ref like '%" . $search_ref . "%'";
@ -151,7 +200,7 @@ if ($result) {
print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
print '<table class="noborder" width="100%">';
print '<br><br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
print $formventilation->select_account($account_parent, 'account_parent', 1);
print '<input type="submit" class="butAction" value="' . $langs->trans("Validate") . '"/></div>';
@ -164,10 +213,11 @@ if ($result) {
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"],"aa.account_number","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('');
print_liste_field_titre('');
print_liste_field_titre('');
print_liste_field_titre($langs->trans("Ventilate").'<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>','','','','','align="center"');
print "</tr>\n";
print '<tr class="liste_titre"><td><input type="text" class="flat" name="search_facture" size="8" value="' . $search_facture . '"></td>';
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" name="search_invoice" size="10" value="' . $search_invoice . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . $search_desc . '"></td>';
@ -188,12 +238,12 @@ if ($result) {
print "<tr $bc[$var]>";
// Ref facture
// Ref Invoice
$facture_static->ref = $objp->facnumber;
$facture_static->id = $objp->facid;
print '<td>' . $facture_static->getNomUrl(1) . '</td>';
// Ref produit
// Ref Product
$product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id;
$product_static->type = $objp->type;
@ -208,8 +258,8 @@ if ($result) {
print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>';
print '<td align="right">' . price($objp->total_ht) . '</td>';
print '<td align="center">' . $codecompta . '</td>';
print '<td>' . $objp->rowid . '</td>';
print '<td><a href="./card.php?id=' . $objp->rowid . '">';
print '<td align="right">' . $objp->rowid . '</td>';
print '<td align="left"><a href="./card.php?id=' . $objp->rowid . '">';
print img_edit();
print '</a></td>';

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
*
@ -31,16 +31,52 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
// Langs
$langs->load("compta");
$langs->load("bills");
$langs->load("other");
$langs->load("main");
$langs->load("accountancy");
$action = GETPOST('action');
$codeventil = GETPOST('codeventil', 'array');
$mesCasesCochees = GETPOST('mesCasesCochees', 'array');
$search_ref = GETPOST('search_ref','alpha');
$search_label = GETPOST('search_label','alpha');
$search_desc = GETPOST('search_desc','alpha');
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
//Should move to top with all GETPOST
$page = GETPOST('page');
if ($page < 0) $page = 0;
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
$limit = $conf->liste_limit;
} else {
$limit = $conf->liste_limit;
}
$offset = $limit * $page;
//End Should move to top with all GETPOST
// TODO : remove comment
//elarifr we can not use only
//$sql .= " ORDER BY l.rowid";
// f.datef will order like FA08 FA09 FA10 FA05 FA06 FA07 FA04...
// f.facnumber will not order properly invoice / avoir / accompte you can have All AC then All AV and all FA
// l.rowid when an invoice is edited rowid are added at end of table & facturedet.rowid are not ordered
//if (! $sortfield) $sortfield="l.rowid";
if (! $sortfield) $sortfield="f.datef, f.facnumber, l.rowid";
//if (! $sortorder) $sortorder="DESC";
if (! $sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
$sortorder = " DESC ";
}
}
// Security check
if ($user->societe_id > 0)
@ -50,8 +86,31 @@ if (! $user->rights->accounting->ventilation->dispatch)
$formventilation = new FormVentilation($db);
//Defaut AccountingAccount RowId Product / Service
//at this time ACCOUNTING_SERVICE_SOLD_ACCOUNT & ACCOUNTING_PRODUCT_SOLD_ACCOUNT are account number not accountingacount rowid
//so we need to get those default value rowid first
$accounting = new AccountingAccount($db);
//TODO: we should need to check if result is a really exist accountaccount rowid.....
$aarowid_s = $accounting->fetch('', ACCOUNTING_SERVICE_SOLD_ACCOUNT);
$aarowid_p = $accounting->fetch('', ACCOUNTING_PRODUCT_SOLD_ACCOUNT);
// Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_ref='';
$search_label='';
$search_desc='';
}
/*
* View
*/
llxHeader('', $langs->trans("Ventilation"));
//debug
//print_r($aarowid_s);
//print_r($aarowid_p);
print '<script type="text/javascript">
$(function () {
$(\'#select-all\').click(function(event) {
@ -68,6 +127,7 @@ print '<script type="text/javascript">
});
});
</script>';
/*
* Action
*/
@ -123,7 +183,13 @@ $offset = $limit * $page;
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.total_ht, l.rowid, l.fk_code_ventilation,";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell";
// A REVOIR elarifr si vraiment necessaire de rajouter , p.fk_product_type as type. le type produit / service est de facto defini pour chaque ligne de facturedet.product_type
// il est donc plus logique de se servir de l.product_type au lieu de p.fk_product_type
$sql .= " , aa.rowid as aarowid";
// we need f.datef to reorder lines
$sql .= " , f.datef";
// we need to use llx_facturedet l.product_type as used at the time on invoice. if llx_product fk_product_type is changed later it could not change the sell already made !
$sql .= " , l.product_type as type_l";
$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
@ -131,14 +197,27 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON p.accountan
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
$sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation <= 0";
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='')";
// Add search filter like
if (strlen(trim($search_ref))) {
$sql .= " AND (p.ref like '%" . $search_ref . "%')";
}
if (strlen(trim($search_label))) {
$sql .= " AND (p.label like '%" . $search_label . "%')";
}
if (strlen(trim($search_desc))) {
$sql .= " AND (l.description like '%" . $search_desc . "%')";
}
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
}
//TODO: Remove comment
//replaced by default value $sortfield,$sortorder
//$sql .= " ORDER BY l.rowid";
//if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
// $sql .= " DESC ";
//}
$sql.= $db->order($sortfield,$sortorder);
$sql .= " ORDER BY l.rowid";
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
$sql .= " DESC ";
}
$sql .= $db->plimit($limit + 1, $offset);
dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG);
@ -156,58 +235,96 @@ if ($result) {
print '<input type="hidden" name="action" value="ventil">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>' . $langs->trans("Invoice") . '</td>';
print '<td>' . $langs->trans("Ref") . '</td>';
print '<td>' . $langs->trans("Label") . '</td>';
print '<td>' . $langs->trans("Description") . '</td>';
print '<td align="right">' . $langs->trans("Amount") . '</td>';
print '<td align="right">' . $langs->trans("AccountAccounting") . '</td>';
print '<td align="center">' . $langs->trans("IntoAccount") . '</td>';
print '<td align="center">' . $langs->trans("Ventilate") . '<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>'.'</td>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"],"f.facnumber","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"],"p.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Amount"),'','','','','align="right"');
print_liste_field_titre($langs->trans("AccountAccounting"),'','','','','align="center"');
print_liste_field_titre($langs->trans("IntoAccount"),'','','','','align="center"');
print_liste_field_titre('');
print_liste_field_titre($langs->trans("Ventilate") . '<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>','','','','','align="center"');
print '</tr>';
// We add search filter
/* But Hit Enter will validate ventilation....
print '<tr class="liste_titre">';
print '<td class="liste_titre" >&nbsp;</td>';
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_ref" value="' . $search_ref . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="30" name="search_desc" value="' . $search_desc . '"></td>';
print '<td class="liste_titre" colspan="3">&nbsp;</td>';
print '<td align="right" colspan="2" class="liste_titre">';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '&nbsp;';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
print '</tr>';
*/
$facture_static = new Facture($db);
$product_static = new Product($db);
$form = new Form($db);
$var = True;
$var = true;
while ( $i < min($num_lines, $limit) ) {
$objp = $db->fetch_object($result);
$var = ! $var;
// product_type: 0 = service ? 1 = product
// if product does not exist we use the value of product_type provided in facturedet to define if this is a product or service
// issue : if we change product_type value in product DB it should differ from the value stored in facturedet DB !
$code_sell_notset = '';
// C'est le contraire dans les base !!!!!! IT IS INVERTED IN LLX_PRODUCT & LLX_FACTUREDET
// elarifr define account numbercode comptable si pas defini dans la fiche produit a partir des lignes de facturation
// product_type: 1 = service ? 0 = product
// because some modules like subtotal module l.product_type can be other than 0 or 1 ! and we don't put in account lines with product_type=9
// first we check product.fk_product_type as type and l.product_type as type_l
// if product does not exist we use the value of l.product_type provided in facturedet to define if this is a product or service
// issue : if we change product_type value in product DB it should differ from the value stored in facturedet DB ! so we report both and user make choice of accounting account.
$objp->code_sell_l = '';
$objp->code_sell_p = '';
$objp->aarowid_suggest = '';
$code_sell_p_l_differ = '';
if (empty($objp->code_sell)) {
$code_sell_notset = 'color:red';
if (! empty($objp->type)) {
if ($objp->type == 1) {
$objp->code_sell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
} else {
$objp->code_sell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
}
} else {
$code_sell_notset = 'color:blue';
if ($objp->type == 1) {
$objp->code_sell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
} else {
$objp->code_sell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
}
//check if code_sell defined in product or set default value according p.fk_product_type do not care lines when product_type value not 0 || 1
//and we set suggested accounting account rowid as $objp->aarowid_s
$code_sell_p_notset = '';
$objp->aarowid_suggest = $objp->aarowid;
if ( ! empty($objp->code_sell)) {
$objp->code_sell_p = $objp->code_sell;
} else {
$code_sell_p_notset = 'color:red';
if ($objp->type == 1) {
$objp->code_sell_p = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
}
elseif ($objp->type == 0) {
$objp->code_sell_p = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
}
}
// check facturedet.product_type & set default value according l.type_l, do not care lines when product_type value not 0 || 1
// if ( ! empty($objp->type_l)) {
// $objp->code_sell_l = $objp->type_l;
// } else {
if ($objp->type_l == 1) {
$objp->code_sell_l = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
if ($objp->aarowid == '') $objp->aarowid_suggest = $aarowid_s;
}
elseif ($objp->type_l == 0) {
$objp->code_sell_l = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
if ($objp->aarowid == '') $objp->aarowid_suggest = $aarowid_p;
}
// }
//if not same code for product fk_prouct_type and facturedet.product_type, product has been change after sale and must report
if ($objp->code_sell_l <> $objp->code_sell_p) $code_sell_p_l_differ = 'color:red';
print "<tr $bc[$var]>";
// Ref facture
// Ref Invoice
$facture_static->ref = $objp->facnumber;
$facture_static->id = $objp->facid;
print '<td>' . $facture_static->getNomUrl(1) . '</td>';
// Ref produit
// Ref Customer Invoice
$product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id;
$product_static->type = $objp->type;
@ -218,27 +335,39 @@ if ($result) {
print '&nbsp;';
print '</td>';
print '<td>' . dol_trunc($objp->product_label, 24) . '</td>';
print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>';
print '<td style="' . $code_sell_p_l_differ . '">' . dol_trunc($objp->product_label, 24) . '</td>';
//TODO: we should set a user defined value to adjust user square / wide screen size
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($objp->description, $trunclength)) . '</td>';
print '<td align="right">';
print price($objp->total_ht);
print '</td>';
print '<td align="center" style="' . $code_sell_notset . '">';
print $objp->code_sell;
print '<td align="center" style="' . $code_sell_p_notset . '">';
// if not same kind of product_type stored in product & facturedet we display both account and let user choose
if ($objp->code_sell_l == $objp->code_sell_p) {
print $objp->code_sell_l;
} else {
print 'lines='.$objp->code_sell_l . '<br />product=' . $objp->code_sell_p;
}
print '</td>';
// Colonne choix du compte
print '<td align="center">';
print $formventilation->select_account($objp->aarowid, 'codeventil[]', 1);
// TODO: we should set a user defined value to adjust user square / wide screen size
// $trunclengthform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
print $formventilation->select_account($objp->aarowid_suggest, 'codeventil[]', 1);
print '</td>';
print '<td align="center">' . $objp->rowid . '</td>';
// Colonne choix ligne a ventiler
print '<td align="center">';
print '<input type="checkbox" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
//TODO checked only if account exist in product, if only suggested do not check, user must validate
print '<input type="checkbox" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid_suggest ? "checked" : "") . '/>';
print '</td>';
//debug
//print '</tr><tr><td colspan=6>Product: p.type='. $objp->type .' - p.code_sell='. $objp->code_sell .' --- Check code_sell_product=' . $objp->code_sell_p .' ---Check facturedet l.type_l='. $objp->type_l .' - code_sell_lines=' . $objp->code_sell_l . ' -- aarowid_suggest=' . $objp->aarowid_suggest.'</td>';
print '</tr>';
$i ++;
}
@ -250,5 +379,5 @@ if ($result) {
print $db->error();
}
$db->close();
llxFooter();
$db->close();

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
*
@ -40,7 +40,7 @@ $langs->load("accountancy");
$account_parent = GETPOST('account_parent');
$changeaccount = GETPOST('changeaccount');
$search_ref = GETPOST('search_ref','alpha');
$search_facture = GETPOST('search_facture','alpha');
$search_invoice = GETPOST('search_invoice','alpha');
$search_label = GETPOST('search_label','alpha');
$search_desc = GETPOST('search_desc','alpha');
$search_amount = GETPOST('search_amount','alpha');
@ -70,7 +70,7 @@ $formventilation = new FormVentilation($db);
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_ref='';
$search_facture='';
$search_invoice='';
$search_label='';
$search_desc='';
$search_amount='';
@ -107,6 +107,30 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
llxHeader('', $langs->trans("SuppliersVentilation") . ' - ' . $langs->trans("Dispatched"));
print '<script type="text/javascript">
$(function () {
$(\'#select-all\').click(function(event) {
// Iterate each checkbox
$(\':checkbox\').each(function() {
this.checked = true;
});
});
$(\'#unselect-all\').click(function(event) {
// Iterate each checkbox
$(\':checkbox\').each(function() {
this.checked = false;
});
});
});
</script>';
/*
* Action
*/
/*
* Supplier Invoice lines
*/
$sql = "SELECT f.ref as facnumber, f.rowid as facid, l.fk_product, l.description, l.total_ht , l.qty, l.rowid, l.tva_tx, aa.label, aa.account_number, ";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type";
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
@ -115,8 +139,8 @@ $sql .= " , " . MAIN_DB_PREFIX . "facture_fourn_det as l";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
$sql .= " WHERE f.rowid = l.fk_facture_fourn and f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 ";
$sql .= " AND aa.rowid = l.fk_code_ventilation";
if (strlen(trim($search_facture))) {
$sql .= " AND f.ref like '%" . $search_facture . "%'";
if (strlen(trim($search_invoice))) {
$sql .= " AND f.ref like '%" . $search_invoice . "%'";
}
if (strlen(trim($search_ref))) {
$sql .= " AND p.ref like '%" . $search_ref . "%'";
@ -150,10 +174,10 @@ if ($result) {
print '<td align="left"><b>' . $langs->trans("DescVentilDoneSupplier") . '</b></td>';
print '<form method="GET" action="' . $_SERVER["PHP_SELF"] . '">';
print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
print '<table class="noborder" width="100%">';
print '<br><br><div class="inline-block divButAction">'. $langs->trans("ChangeAccount") . '<br>';
print '<br><div class="inline-block divButAction">'. $langs->trans("ChangeAccount") . '<br>';
print $formventilation->select_account(GETPOST('account_parent'), 'account_parent', 1);
print '<input type="submit" class="butAction" value="' . $langs->trans("Validate") . '" /></div>';
@ -166,10 +190,10 @@ if ($result) {
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"],"aa.account_number","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('');
print_liste_field_titre('');
print_liste_field_titre('');
print_liste_field_titre($langs->trans("Ventilate").'<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>','','','','','align="center"');
print "</tr>\n";
print '<tr class="liste_titre"><td><input type="text" class="flat" name="search_facture" size="8" value="' . $search_facture . '"></td>';
print '<tr class="liste_titre"><td><input type="text" class="flat" name="search_invoice" size="10" value="' . $search_invoice . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . $search_desc . '"></td>';
@ -211,8 +235,8 @@ if ($result) {
print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>';
print '<td align="right">' . price($objp->total_ht) . '</td>';
print '<td align="center">' . $codeCompta . '</td>';
print '<td>' . $objp->rowid . '</td>';
print '<td><a href="./card.php?id=' . $objp->rowid . '">';
print '<td align="right">' . $objp->rowid . '</td>';
print '<td align="left"><a href="./card.php?id=' . $objp->rowid . '">';
print img_edit();
print '</a></td>';

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
*
@ -31,6 +31,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
// Langs
$langs->load("compta");
@ -42,6 +43,42 @@ $langs->load("accountancy");
$action = GETPOST('action');
$codeventil = GETPOST('codeventil', 'array');
$mesCasesCochees = GETPOST('mesCasesCochees', 'array');
$search_ref = GETPOST('search_ref','alpha');
$search_label = GETPOST('search_label','alpha');
$search_desc = GETPOST('search_desc','alpha');
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
//Should move to top with all GETPOST
$page = GETPOST('page');
if ($page < 0) $page = 0;
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
$limit = $conf->liste_limit;
} else {
$limit = $conf->liste_limit;
}
$offset = $limit * $page;
//End Should move to top with all GETPOST
// TODO : remove comment
//elarifr we can not use only
//$sql .= " ORDER BY l.rowid";
// f.datef will order like FA08 FA09 FA10 FA05 FA06 FA07 FA04...
// f.ref will not order properly invoice / avoir / accompte you can have All AC then All AV and all FA
// l.rowid when an invoice is edited rowid are added at end of table & facturedet.rowid are not ordered
//if (! $sortfield) $sortfield="l.rowid";
if (! $sortfield) $sortfield="f.datef, f.ref, l.rowid";
//if (! $sortorder) $sortorder="DESC";
if (! $sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
$sortorder = " DESC ";
}
}
// Security check
if ($user->societe_id > 0)
@ -51,8 +88,31 @@ if (! $user->rights->accounting->ventilation->dispatch)
$formventilation = new FormVentilation($db);
//Defaut AccountingAccount RowId Product / Service
//at this time ACCOUNTING_SERVICE_SOLD_ACCOUNT & ACCOUNTING_PRODUCT_SOLD_ACCOUNT are account number not accountingacount rowid
//so we need to get those default value rowid first
$accounting = new AccountingAccount($db);
//TODO: we should need to check if result is a really exist accountaccount rowid.....
$aarowid_s = $accounting->fetch('', ACCOUNTING_SERVICE_BUY_ACCOUNT);
$aarowid_p = $accounting->fetch('', ACCOUNTING_PRODUCT_BUY_ACCOUNT);
// Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_ref='';
$search_label='';
$search_desc='';
}
/*
* View
*/
llxHeader('', $langs->trans("Ventilation"));
//debug
//print_r($aarowid_s);
//print_r($aarowid_p);
print '<script type="text/javascript">
$(function () {
$(\'#select-all\').click(function(event) {
@ -91,7 +151,7 @@ if ($action == 'ventil') {
$sql .= " SET fk_code_ventilation = " . $monCompte;
$sql .= " WHERE rowid = " . $monId;
dol_syslog('accountancy/supplier/list.php:: sql=' . $sql);
dol_syslog('accountancy/supplier/list.php:: sql=' . $sql, LOG_DEBUG);
if ($db->query($sql)) {
print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>';
} else {
@ -126,6 +186,9 @@ $offset = $limit * $page;
$sql = "SELECT f.ref, f.rowid as facid, f.ref_supplier, l.fk_product, l.description, l.total_ht as price, l.rowid, l.fk_code_ventilation, ";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy";
$sql .= " , aa.rowid as aarowid";
$sql .= " , f.datef";
$sql .= " , l.product_type as type_l";
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
@ -134,14 +197,22 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.
$sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation <= 0";
$sql .= " AND (accsys.rowid='".$conf->global->CHARTOFACCOUNTS."' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_buy ='')";
// Add search filter like
if (strlen(trim($search_ref))) {
$sql .= " AND (p.ref like '%" . $search_ref . "%')";
}
if (strlen(trim($search_label))) {
$sql .= " AND (p.label like '%" . $search_label . "%')";
}
if (strlen(trim($search_desc))) {
$sql .= " AND (l.description like '%" . $search_desc . "%')";
}
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity IN (" . getEntity("facture_fourn", 1) . ")";
}
$sql .= " ORDER BY l.rowid";
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
$sql .= " DESC ";
}
$sql.= $db->order($sortfield,$sortorder);
$sql .= $db->plimit($limit + 1, $offset);
dol_syslog('accountancy/supplier/list.php:: $sql=' . $sql);
@ -153,20 +224,22 @@ if ($result) {
// TODO : print_barre_liste always use $conf->liste_limit and do not care about custom limit in list...
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
print '<td align="left"><br><b>' . $langs->trans("DescVentilTodoSupplier") . '</b></br></td>';
print '<br><b>' . $langs->trans("DescVentilTodoCustomer") . '</b></br>';
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
print '<input type="hidden" name="action" value="ventil">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>Facture</td>';
print '<td align="left">' . $langs->trans("Ref") . '</td>';
print '<td align="left">' . $langs->trans("Label") . '</td>';
print '<td>' . $langs->trans("Description") . '</td>';
print '<td align="right">' . $langs->trans("Amount") . '</td>';
print '<td align="right">' . $langs->trans("Compte") . '</td>';
print '<td align="center">' . $langs->trans("IntoAccount") . '</td>';
print '<td align="center">' . $langs->trans("Ventilate") . '<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>'.'</td>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"],"f.ref","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"],"p.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Amount"),'','','','','align="right"');
print_liste_field_titre($langs->trans("AccountAccounting"),'','','','','align="center"');
print_liste_field_titre($langs->trans("IntoAccount"),'','','','','align="center"');
print_liste_field_titre('');
print_liste_field_titre($langs->trans("Ventilate") . '<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>','','','','','align="center"');
print "</tr>\n";
$facturefourn_static = new FactureFournisseur($db);
@ -181,27 +254,48 @@ if ($result) {
// product_type: 0 = service ? 1 = product
// if product does not exist we use the value of product_type provided in facturedet to define if this is a product or service
// issue : if we change product_type value in product DB it should differ from the value stored in facturedet DB !
$code_buy_notset = '';
if (empty($objp->code_buy)) {
$code_buy_notset = 'color:red';
$objp->code_buy_l = '';
$objp->code_buy_p = '';
$objp->aarowid_suggest = '';
$code_buy_p_l_differ = '';
$code_buy_p_notset = '';
$objp->aarowid_suggest = $objp->aarowid;
if ( ! empty($objp->code_buy)) {
$objp->code_buy_p = $objp->code_buy;
} else {
$code_buy_p_notset = 'color:red';
if ($objp->type == 1) {
$objp->code_buy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
} else {
$objp->code_buy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$objp->code_buy_p = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
}
elseif ($objp->type == 0) {
$objp->code_buy_p = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
}
}else {
$code_buy_notset = 'color:blue';
}
if ($objp->type_l == 1) {
$objp->code_buy_l = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
if ($objp->aarowid == '') $objp->aarowid_suggest = $aarowid_s;
}
elseif ($objp->type_l == 0) {
$objp->code_buy_l = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
if ($objp->aarowid == '') $objp->aarowid_suggest = $aarowid_p;
}
if ($objp->code_buy_l <> $objp->code_buy_p) $code_buy_p_l_differ = 'color:red';
print "<tr $bc[$var]>";
// Ref facture
// Ref Invoice
$facturefourn_static->ref = $objp->ref;
$facturefourn_static->id = $objp->facid;
print '<td>' . $facturefourn_static->getNomUrl(1) . '</td>';
// Ref facture supplier
// Ref Supplier Invoice
$productfourn_static->ref = $objp->product_ref;
$productfourn_static->id = $objp->product_id;
$productfourn_static->type = $objp->type;
@ -212,29 +306,33 @@ if ($result) {
print '&nbsp;';
print '</td>';
// print '<td><a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$objp->facid.'">'.$objp->ref.'</a></td>';
print '<td style="' . $code_buy_p_l_differ . '">' . dol_trunc($objp->product_label, 24) . '</td>';
// print '<td><a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$objp->facid.'">'.$objp->ref_supplier.'</a></td>';
print '<td>' . dol_trunc($objp->product_label, 24) . '</td>';
print '<td>' . stripslashes(nl2br($objp->description)) . '</td>';
// TODO: we should set a user defined value to adjust user square / wide screen size
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
print '<td style="' . $code_buy_p_l_differ . '">' . nl2br(dol_trunc($objp->description, $trunclength)) . '</td>';
print '<td align="right">';
print price($objp->price);
print '</td>';
print '<td align="center" style="' . $code_buy_notset . '">';
print $objp->code_buy;
print '<td align="center" style="' . $code_buy_p_notset . '">';
//if not same kind of product_type stored in product & facturedt we display both account and let user choose
if ($objp->code_buy_l == $objp->code_buy_p) {
print $objp->code_buy_l;
} else {
print 'lines='.$objp->code_buy_l . '<br />product=' . $objp->code_buy_p;
}
print '</td>';
// Colonne choix du compte
print '<td align="center">';
print $formventilation->select_account($objp->aarowid, 'codeventil[]', 1);
print $formventilation->select_account($objp->aarowid_suggest, 'codeventil[]', 1);
print '</td>';
print '<td align="center">' . $objp->rowid . '</td>';
// Colonne choix ligne a ventiler
print '<td align="center">';
print '<input type="checkbox" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
print '<input type="checkbox" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid_suggest ? "checked" : "") . '/>';
print '</td>';
print "</tr>";

View File

@ -172,7 +172,7 @@ jQuery(document).ready(function() {
var compcssstring;
getcssurl = $.ajax({
type: "GET",
url: \''.DOL_URL_ROOT.'/includes/jquery/css/smoothness/jquery-ui-latest.custom.css\',
url: \''.DOL_URL_ROOT.'/includes/jquery/css/smoothness/jquery-ui.custom.css\',
cache: false,
/* async: false, */
/*crossDomain: true, */

View File

@ -1431,7 +1431,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<tr>';
print '<td>' . $langs->trans("Project") . '</td><td colspan="2">';
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
print ' &nbsp; <a href="../projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
print '</td>';
print '</tr>';
}

View File

@ -2300,7 +2300,7 @@ if ($action == 'create')
$langs->load('projects');
print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">';
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
print ' &nbsp; <a href="../projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
print '</td></tr>';
}

View File

@ -41,6 +41,11 @@ abstract class CommonObject
*/
public $db;
/**
* @var int The object identifier
*/
public $id;
/**
* @var string Error string
* @deprecated Use instead the array of error strings
@ -92,33 +97,245 @@ abstract class CommonObject
*/
public $canvas;
public $name;
public $lastname;
public $firstname;
public $civility_id;
/**
* @deprecated
* @see thirdparty
* @var Project The related project
* @see fetch_projet()
*/
public $client;
public $project;
/**
* @var Societe
* @var int The related project ID
* @see setProject(), project
*/
public $thirdparty;
public $fk_project;
/**
* @deprecated
* @see project
*/
public $projet;
/**
* @var Project
* @var Contact a related contact
* @see fetch_contact()
*/
public $project;
public $contact;
/**
* @var int The related contact ID
* @see fetch_contact()
*/
public $contact_id;
/**
* @var Societe A related thirdparty
* @see fetch_thirdparty()
*/
public $thirdparty;
/**
* @deprecated
* @see thirdparty
*/
public $client;
/**
* @var User A related user
* @see fetch_user()
*/
public $user;
/**
* @var CommonObject An originating object?
* @see fetch_origin()
*/
public $origin;
/**
* @var int The originating object?
* @see fetch_origin(), origin
*/
public $origin_id;
/**
* @var string The object's reference
*/
public $ref;
/**
* @var string The object's previous reference
*/
public $ref_previous;
/**
* @var string The object's next reference
*/
public $ref_next;
/**
* @var string An external reference for the object
*/
public $ref_ext;
/**
* @var string
*/
public $element;
/**
* @var string
*/
public $table_element;
/**
* @var
*/
public $table_element_line;
/**
* @var int The object's status
* @see setStatut()
*/
public $statut;
/**
* @var string
* @see getFullAddress()
*/
public $country;
/**
* @var int
* @see getFullAddress(), country
*/
public $country_id;
/**
* @var string
* @see getFullAddress(), isInEEC(), country
*/
public $country_code;
/**
* @var int
* @see fetch_barcode()
*/
public $barcode_type;
/**
* @var string
* @see fetch_barcode(), barcode_type
*/
public $barcode_type_code;
/**
* @var string
* @see fetch_barcode(), barcode_type
*/
public $barcode_type_label;
/**
* @var string
* @see fetch_barcode(), barcode_type
*/
public $barcode_type_coder;
/**
* @var int Payment method ID?
* @see setPaymentMethods()
*/
public $mode_reglement_id;
/**
* @var string Payment terms ID
* @see setPaymentTerms()
*/
public $cond_reglement_id;
/**
* @deprecated
* @see cond_reglement_id;
*/
public $cond_reglement;
/**
* @var int Delivery address ID
* @see setDeliveryAddress()
*/
public $fk_delivery_address;
/**
* @var int Shipping method ID
* @see setShippingMethod()
*/
public $shipping_method_id;
/**
* @var string
* @see SetDocModel()
*/
public $modelpdf;
/**
* @var int Bank account ID
* @see SetBankAccount()
*/
public $fk_account;
/**
* @var string Public note
* @see update_note()
*/
public $note_public;
/**
* @var string Private note
* @see update_note()
*/
public $note_private;
/**
* @deprecated
* @see note_public
*/
public $note;
/**
* @var float
* @see update_price()
*/
public $total_ht;
/**
* @var float
* @see update_price()
*/
public $total_tva;
/**
* @var float
* @see update_price()
*/
public $total_localtax1;
/**
* @var float
* @see update_price()
*/
public $total_localtax2;
/**
* @var float
* @see update_price()
*/
public $total_ttc;
/**
* @var CommonObjectLine[]
*/
public $lines;
/**
* @var int
* @see setIncoterms()
*/
public $fk_incoterms;
/**
* @var string
* @see SetIncoterms()
*/
public $libelle_incoterms;
/**
* @var string
* @see display_incoterms()
*/
public $location_incoterms;
public $name;
public $lastname;
public $firstname;
public $civility_id;
// No constructor as it is an abstract class
/**
* Check an object id/ref exists
* If you don't need/want to instantiate object and just need to know if object exists, use this method instead of fetch
@ -178,8 +395,6 @@ abstract class CommonObject
*/
function getFullName($langs,$option=0,$nameorder=-1,$maxlen=0)
{
global $conf;
//print "lastname=".$this->lastname." name=".$this->name." nom=".$this->nom."<br>\n";
$lastname=$this->lastname;
$firstname=$this->firstname;
@ -223,13 +438,13 @@ abstract class CommonObject
*
* @param int $fk_socpeople Id of thirdparty contact (if source = 'external') or id of user (if souce = 'internal') to link
* @param int $type_contact Type of contact (code or id). Must be if or code found into table llx_c_type_contact. For example: SALESREPFOLL
* @param int $source external=Contact extern (llx_socpeople), internal=Contact intern (llx_user)
* @param string $source external=Contact extern (llx_socpeople), internal=Contact intern (llx_user)
* @param int $notrigger Disable all triggers
* @return int <0 if KO, >0 if OK
*/
function add_contact($fk_socpeople, $type_contact, $source='external',$notrigger=0)
{
global $user,$conf,$langs;
global $user,$langs;
dol_syslog(get_class($this)."::add_contact $fk_socpeople, $type_contact, $source");
@ -321,8 +536,6 @@ abstract class CommonObject
*/
function copy_linked_contact($objFrom, $source='internal')
{
global $user,$langs,$conf;
$contacts = $objFrom->liste_contact(-1, $source);
foreach($contacts as $contact)
{
@ -373,7 +586,7 @@ abstract class CommonObject
*/
function delete_contact($rowid, $notrigger=0)
{
global $user,$langs,$conf;
global $user;
$this->db->begin();
@ -545,7 +758,7 @@ abstract class CommonObject
* Return array with list of possible values for type of contacts
*
* @param string $source 'internal', 'external' or 'all'
* @param string $order Sort order by 'code' or 'rowid'
* @param string $order Sort order by : 'code' or 'rowid'
* @param int $option 0=Return array id->label, 1=Return array code->label
* @param int $activeonly 0=all status of contact, 1=only the active
* @param string $code Type of contact (Example: 'CUSTOMER', 'SERVICE')
@ -769,7 +982,7 @@ abstract class CommonObject
}
}
}
else return 0;
return 0;
}
/**
@ -891,10 +1104,8 @@ abstract class CommonObject
* @param User|string $user Update last update fields also if user object provided
* @return int <0 if KO, >0 if OK
*/
function setValueFrom($field, $value, $table='', $id='', $format='', $id_field='', $user='')
function setValueFrom($field, $value, $table='', $id=null, $format='', $id_field='', $user='')
{
global $conf;
if (empty($table)) $table=$this->table_element;
if (empty($id)) $id=$this->id;
if (empty($format)) $format='text';
@ -933,7 +1144,7 @@ abstract class CommonObject
*/
function load_previous_next_ref($filter,$fieldid,$nodbprefix=0)
{
global $conf, $user;
global $user;
if (! $this->table_element)
{
@ -1253,6 +1464,8 @@ abstract class CommonObject
}
}
// TODO: Move line related operations to CommonObjectLine?
/**
* Save a new position (field rang) for details lines.
* You can choose to set position for lines with already a position or lines without any position defined.
@ -1918,7 +2131,7 @@ abstract class CommonObject
* @return void
* @see add_object_linked, updateObjectLinked, deleteObjectLinked
*/
function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR',$alsosametype=1)
function fetchObjectLinked($sourceid=null,$sourcetype='',$targetid=null,$targettype='',$clause='OR',$alsosametype=1)
{
global $conf;
@ -1948,7 +2161,7 @@ abstract class CommonObject
if (empty($sourceid) && empty($targetid))
{
dol_syslog('Bad usage of function. No source nor target id defined (nor as parameter nor as object id)', LOG_ERROR);
dol_syslog('Bad usage of function. No source nor target id defined (nor as parameter nor as object id)', LOG_ERR);
return -1;
}
@ -2082,7 +2295,7 @@ abstract class CommonObject
* @return int >0 if OK, <0 if KO
* @see add_object_linked, fetObjectLinked, deleteObjectLinked
*/
function updateObjectLinked($sourceid='', $sourcetype='', $targetid='', $targettype='')
function updateObjectLinked($sourceid=null, $sourcetype='', $targetid=null, $targettype='')
{
$updatesource=false;
$updatetarget=false;
@ -2128,7 +2341,7 @@ abstract class CommonObject
* @return int >0 if OK, <0 if KO
* @see add_object_linked, updateObjectLinked, fetchObjectLinked
*/
function deleteObjectLinked($sourceid='', $sourcetype='', $targetid='', $targettype='')
function deleteObjectLinked($sourceid=null, $sourcetype='', $targetid=null, $targettype='')
{
$deletesource=false;
$deletetarget=false;
@ -2180,7 +2393,7 @@ abstract class CommonObject
* @param string $elementType Type of element to force (use this->table_element by default)
* @return int <0 if KO, >0 if OK
*/
function setStatut($status,$elementId='',$elementType='')
function setStatut($status,$elementId=null,$elementType='')
{
global $user,$langs,$conf;
@ -2324,7 +2537,6 @@ abstract class CommonObject
foreach($this->childtables as $table)
{
// Check if third party can be deleted
$nb=0;
$sql = "SELECT COUNT(*) as nb from ".MAIN_DB_PREFIX.$table;
$sql.= " WHERE ".$this->fk_element." = ".$id;
$resql=$this->db->query($sql);
@ -2398,10 +2610,9 @@ abstract class CommonObject
$pu_ht = $obj->pu_ht;
$qty= $obj->qty;
$discount_percent_line = $obj->remise_percent;
$total_ht = $obj->total_ht;
$total_discount_line = price2num(($pu_ht * $qty) - $total_ht, 'MT');
$total_discount_line = floatval(price2num(($pu_ht * $qty) - $total_ht, 'MT'));
$total_discount += $total_discount_line;
$i++;
@ -2451,7 +2662,7 @@ abstract class CommonObject
function display_incoterms()
{
$out = '';
$this->incoterms_libelle = '';
$this->libelle_incoterms = '';
if (!empty($this->fk_incoterms))
{
$sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int) $this->fk_incoterms;
@ -2640,8 +2851,8 @@ abstract class CommonObject
* But for the moment we don't know if it'st possible as we keep a method available on overloaded objects.
*
* @param string $action Action code
* @param Societe $seller Object of seller third party
* @param Societe $buyer Object of buyer third party
* @param string $seller Object of seller third party
* @param string $buyer Object of buyer third party
* @param int $selected Object line selected
* @param int $dateSelector 1=Show also date range input fields
* @return void
@ -2734,12 +2945,12 @@ abstract class CommonObject
if (empty($line->fk_parent_line))
{
$parameters = array('line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected, 'extrafieldsline'=>$extrafieldsline);
$reshook=$hookmanager->executeHooks('printObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$hookmanager->executeHooks('printObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
}
else
{
$parameters = array('line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected, 'extrafieldsline'=>$extrafieldsline);
$reshook=$hookmanager->executeHooks('printObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$hookmanager->executeHooks('printObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
}
}
else
@ -2755,16 +2966,16 @@ abstract class CommonObject
* Return HTML content of a detail line
* TODO Move this into an output class file (htmlline.class.php)
*
* @param string $action GET/POST action
* @param CommonObjectLine $line Selected object line to output
* @param string $var Is it a an odd line (true)
* @param int $num Number of line (0)
* @param int $i I
* @param int $dateSelector 1=Show also date range input fields
* @param Societe $seller Object of seller third party
* @param Societe $buyer Object of buyer third party
* @param int $selected Object line selected
* @param object $extrafieldsline Object of extrafield line attribute
* @param string $action GET/POST action
* @param CommonObjectLine $line Selected object line to output
* @param string $var Is it a an odd line (true)
* @param int $num Number of line (0)
* @param int $i I
* @param int $dateSelector 1=Show also date range input fields
* @param string $seller Object of seller third party
* @param string $buyer Object of buyer third party
* @param int $selected Object line selected
* @param int $extrafieldsline Object of extrafield line attribute
* @return void
*/
function printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected=0,$extrafieldsline=0)
@ -2895,7 +3106,6 @@ abstract class CommonObject
}
print '<td align="right">'.$langs->trans('ReductionShort').'</td></tr>';
$num = count($this->lines);
$var = true;
$i = 0;
@ -2909,7 +3119,7 @@ abstract class CommonObject
{
$parameters=array('line'=>$line,'var'=>$var,'i'=>$i);
$action='';
$reshook=$hookmanager->executeHooks('printOriginObjectLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
$hookmanager->executeHooks('printOriginObjectLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
}
}
else
@ -2927,13 +3137,13 @@ abstract class CommonObject
* If lines are into a template, title must also be into a template
* But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
*
* @param array $line Line
* @param string $var Var
* @param CommonObjectLine $line Line
* @param string $var Var
* @return void
*/
function printOriginLine($line,$var)
{
global $conf,$langs,$bc, $conf;
global $langs, $conf;
//var_dump($line);
if (!empty($line->date_start))
@ -3042,7 +3252,7 @@ abstract class CommonObject
/**
* Show the array with all margin infos
*
* @param boolean $force_price Force price
* @param bool $force_price Force price
* @return void
* @deprecated 3.8 Load FormMargin class and make a direct call to displayMarginInfos
*/
@ -3108,7 +3318,7 @@ abstract class CommonObject
*/
function delete_resource($rowid, $element, $notrigger=0)
{
global $user,$langs,$conf;
global $user;
$this->db->begin();
@ -3150,7 +3360,7 @@ abstract class CommonObject
$nboflines=count($this->lines);
for($i=0; $i < $nboflines; $i++)
{
$this->lines[$i] = dol_clone($this->lines[$i]);
$this->lines[$i] = clone $this->lines[$i];
}
}
}
@ -3306,11 +3516,11 @@ abstract class CommonObject
{
// Create small thumbs for company (Ratio is near 16/9)
// Used on logon for example
$imgThumbSmall = vignette($file_osencoded, $maxwidthsmall, $maxheightsmall, '_small', $quality);
vignette($file_osencoded, $maxwidthsmall, $maxheightsmall, '_small', $quality);
// Create mini thumbs for company (Ratio is near 16/9)
// Used on menu or for setup page for example
$imgThumbMini = vignette($file_osencoded, $maxwidthmini, $maxheightmini, '_mini', $quality);
vignette($file_osencoded, $maxwidthmini, $maxheightmini, '_mini', $quality);
}
}
@ -3365,7 +3575,7 @@ abstract class CommonObject
* @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label()
* @return int <0 if error, 0 if no optionals to find nor found, 1 if a line is found and optional loaded
*/
function fetch_optionals($rowid='',$optionsArray='')
function fetch_optionals($rowid=null,$optionsArray=null)
{
if (empty($rowid)) $rowid=$this->id;
@ -3429,10 +3639,6 @@ abstract class CommonObject
*/
function deleteExtraFields()
{
global $langs;
$error=0;
$this->db->begin();
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id;
@ -3472,13 +3678,12 @@ abstract class CommonObject
$langs->load('admin');
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$optionsArray = $extrafields->fetch_name_optionals_label($this->table_element);
$extrafields->fetch_name_optionals_label($this->table_element);
foreach($this->array_options as $key => $value)
{
$attributeKey = substr($key,8); // Remove 'options_' prefix
$attributeType = $extrafields->attribute_type[$attributeKey];
//$attributeSize = $extrafields->attribute_size[$attributeKey]; Not required to insert an extrafield value. Only used for definition.
$attributeLabel = $extrafields->attribute_label[$attributeKey];
$attributeParam = $extrafields->attribute_param[$attributeKey];
switch ($attributeType)
@ -3486,7 +3691,7 @@ abstract class CommonObject
case 'int':
if (!is_numeric($value) && $value!='')
{
$error++; $this->errors[]=$langs->trans("ExtraFieldHasWrongValue",$attributeLabel);
$this->errors[]=$langs->trans("ExtraFieldHasWrongValue",$attributeLabel);
return -1;
}
elseif ($value=='')

View File

@ -194,6 +194,13 @@ abstract class DolibarrModules
*/
public $core_enabled;
/**
* Constructor. Define names, constants, directories, boxes, permissions
*
* @param DoliDB $db Database handler
*/
abstract public function __construct($db);
/**
* Enables a module.
* Inserts all informations into database
@ -1672,4 +1679,30 @@ print $sql;
return $err;
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
public function init($options = '')
{
return $this->_init(array(), $options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
public function remove($options = '')
{
return $this->_remove(array(), $options);
}
}

View File

@ -272,35 +272,4 @@ class modAccounting extends DolibarrModules
$this->menus = array();
$r = 0;
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
$sql = array();
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -230,37 +230,4 @@ class modAdherent extends DolibarrModules
$this->import_regex_array[$r]=array('a.civility'=>'code@'.MAIN_DB_PREFIX.'c_civility','a.fk_adherent_type'=>'rowid@'.MAIN_DB_PREFIX.'adherent_type','a.morphy'=>'(phy|mor)','a.statut'=>'^[0|1]','a.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','a.datefin'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
$this->import_examplevalues_array[$r]=array('a.civility'=>"MR",'a.lastname'=>'Smith','a.firstname'=>'John','a.login'=>'jsmith','a.pass'=>'passofjsmith','a.fk_adherent_type'=>'1','a.morphy'=>'"mor" or "phy"','a.societe'=>'JS company','a.address'=>'21 jump street','a.zip'=>'55000','a.town'=>'New York','a.country'=>'1','a.email'=>'jsmith@example.com','a.birth'=>'1972-10-10','a.statut'=>"0 or 1",'a.note_public'=>"This is a public comment on member",'a.note_private'=>"This is private comment on member",'a.datec'=>dol_print_date($now,'%Y-%m-%d'),'a.datefin'=>dol_print_date(dol_time_plus_duree($now, 1, 'y'),'%Y-%m-%d'));
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
$sql = array();
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -399,39 +399,4 @@ class modAgenda extends DolibarrModules
$this->export_sql_end[$r] .=' ORDER BY ac.datep';
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
// Prevent pb of modules not correctly disabled
//$this->remove($options);
$sql = array();
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -232,21 +232,5 @@ class modApi extends DolibarrModules
return $this->_init($sql, $options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql, $options);
}
}

View File

@ -221,20 +221,4 @@ class modAskPriceSupplier extends DolibarrModules
return $this->_init($sql, $options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -209,20 +209,4 @@ class modBanque extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -146,20 +146,4 @@ class modBarcode extends DolibarrModules
return $this->_init($sql, $options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql, $options);
}
}

View File

@ -99,35 +99,4 @@ class modBookmark extends DolibarrModules
$this->rights[$r][4] = 'supprimer';
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories.
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
$sql = array();
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -139,20 +139,4 @@ class modCashDesk extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted.
*
* @param string $options Options
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -363,20 +363,4 @@ class modCategorie extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -74,37 +74,4 @@ class modClickToDial extends DolibarrModules
$this->rights = array();
$this->rights_class = 'clicktodial';
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
global $conf;
$sql = array();
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -237,21 +237,4 @@ class modCommande extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -115,20 +115,4 @@ class modComptabilite extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -199,20 +199,4 @@ class modContrat extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -137,39 +137,4 @@ class modCron extends DolibarrModules
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
$r++;
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
$sql = array();
// Prevent pb of modules not correctly disabled
//$this->remove($options);
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -145,20 +145,4 @@ class modDeplacement extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -114,21 +114,4 @@ class modDocumentGeneration extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -158,20 +158,4 @@ class modDon extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -84,39 +84,4 @@ class modDynamicPrices extends DolibarrModules
$this->rights_class = 'dynamicprices';
$r=0;
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
// Prevent pb of modules not correctly disabled
//$this->remove($options);
$sql = array();
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -179,36 +179,5 @@ class modECM extends DolibarrModules
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
$r++;
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
$sql = array();
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -277,20 +277,4 @@ class modExpedition extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -345,19 +345,4 @@ class modExpenseReport extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted.
*
* @param string $options Options
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -89,35 +89,4 @@ class modExport extends DolibarrModules
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'creer';
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
$sql = array();
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -117,36 +117,5 @@ class modExternalSite extends DolibarrModules
$r++;
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
$sql = array();
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -126,36 +126,5 @@ class modFTP extends DolibarrModules
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
$r++;
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
$sql = array();
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -342,20 +342,4 @@ class modFacture extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -82,37 +82,4 @@ class modFckeditor extends DolibarrModules
$this->rights = array();
$this->rights_class = 'fckeditor';
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
global $conf;
$sql = array();
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -175,20 +175,4 @@ class modFicheinter extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -564,20 +564,4 @@ class modFournisseur extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -85,35 +85,4 @@ class modGeoIPMaxmind extends DolibarrModules
$this->rights_class = 'geoipmaxmind';
$r=0;
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
$sql = array();
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -183,38 +183,5 @@ class modGravatar extends DolibarrModules
// $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture';
// $r++;
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
$sql = array();
//$result=$this->_load_tables('');
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -278,36 +278,5 @@ class modHoliday extends DolibarrModules
// $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture';
// $r++;
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories.
*
* @return int 1 if OK, 0 if KO
*/
function init()
{
$sql = array();
//$result=$this->_load_tables('');
return $this->_init($sql);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted.
*
* @return int 1 if OK, 0 if KO
*/
function remove()
{
$sql = array();
return $this->_remove($sql);
}
}

View File

@ -85,35 +85,4 @@ class modImport extends DolibarrModules
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'run';
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
$sql = array();
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -109,34 +109,4 @@ class modIncoterm extends DolibarrModules
$this->menus = array(); // List of menus to add
$r=0;
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
$sql = array();
return $this->_init($sql, $options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql, $options);
}
}

View File

@ -89,7 +89,6 @@ class modLabel extends DolibarrModules
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
@ -107,20 +106,4 @@ class modLabel extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -90,35 +90,4 @@ class modLdap extends DolibarrModules
$this->rights = array();
$this->rights_class = 'ldap';
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
$sql = array();
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -162,20 +162,4 @@ class modLoan extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -147,20 +147,4 @@ class modMailing extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -77,37 +77,4 @@ class modMailmanSpip extends DolibarrModules
$this->rights = array();
$this->rights_class = 'clicktodial';
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
global $conf;
$sql = array();
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -139,36 +139,5 @@ class modMargin extends DolibarrModules
$this->rights[$r][4] = 'read';
$this->rights[$r][5] = 'all';
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories.
*
* @return int 1 if OK, 0 if KO
*/
function init()
{
$sql = array();
//$result=$this->_load_tables();
return $this->_init($sql);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted.
*
* @return int 1 if OK, 0 if KO
*/
function remove()
{
$sql = array();
return $this->_remove($sql);
}
}

View File

@ -90,20 +90,4 @@ class modNotification extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -195,20 +195,5 @@ class modOpenSurvey extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -172,38 +172,5 @@ class modPayBox extends DolibarrModules
// $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture';
// $r++;
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
$sql = array();
//$result=$this->_load_tables('');
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -164,38 +164,5 @@ class modPaypal extends DolibarrModules
// $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture';
// $r++;
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
$sql = array();
//$result=$this->_load_tables('');
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -141,20 +141,4 @@ class modPrelevement extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -120,35 +120,4 @@ class modPrinting extends DolibarrModules
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
$sql = array();
return $this->_init($sql, $options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql, $options);
}
}

View File

@ -343,20 +343,4 @@ class modProduct extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -124,21 +124,5 @@ class modProductBatch extends DolibarrModules
return $this->_init($sql, $options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql, $options);
}
}

View File

@ -361,20 +361,4 @@ class modProjet extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -231,20 +231,4 @@ class modPropale extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -360,21 +360,6 @@ class modResource extends DolibarrModules
return $this->_init($sql, $options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
public function remove($options = '')
{
$sql = array();
return $this->_remove($sql, $options);
}
/**
* Create tables, keys and data required by module
* Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys

View File

@ -168,20 +168,4 @@ class modSalaries extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -327,20 +327,4 @@ class modService extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -87,39 +87,4 @@ class modSkype extends DolibarrModules
//------------------
$this->menu = array();
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
$sql = array();
// Prevent pb of modules not correctly disabled
//$this->remove($options);
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -505,20 +505,4 @@ class modSociete extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -198,35 +198,4 @@ class modStock extends DolibarrModules
);
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
$sql = array();
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -83,39 +83,4 @@ class modSyncSupplierWebServices extends DolibarrModules
$this->rights_class = 'syncsupplierwebservices';
$r=0;
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
// Prevent pb of modules not correctly disabled
//$this->remove($options);
$sql = array();
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -80,37 +80,4 @@ class modSyslog extends DolibarrModules
$this->rights = array();
$this->rights_class = 'syslog';
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
$sql = array();
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -156,20 +156,4 @@ class modTax extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -242,20 +242,4 @@ class modUser extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -83,39 +83,4 @@ class modWebServices extends DolibarrModules
$this->rights_class = 'webservices';
$r=0;
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
// Prevent pb of modules not correctly disabled
//$this->remove($options);
$sql = array();
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -148,20 +148,4 @@ class modWorkflow extends DolibarrModules
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

View File

@ -417,22 +417,22 @@ class ExpenseReport extends CommonObject
global $langs;
if ($mode == 0)
return $langs->trans($this->statuts[$status]);
return $langs->transnoentities($this->statuts[$status]);
if ($mode == 1)
return $langs->trans($this->statuts_short[$status]);
return $langs->transnoentities($this->statuts_short[$status]);
if ($mode == 2)
return img_picto($langs->trans($this->statuts_short[$status]), $this->statuts_logo[$status]).' '.$langs->trans($this->statuts_short[$status]);
return img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]).' '.$langs->transnoentities($this->statuts_short[$status]);
if ($mode == 3)
return img_picto($langs->trans($this->statuts_short[$status]), $this->statuts_logo[$status]);
return img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]);
if ($mode == 4)
return img_picto($langs->trans($this->statuts_short[$status]),$this->statuts_logo[$status]).' '.$langs->trans($this->statuts[$status]);
return img_picto($langs->transnoentities($this->statuts_short[$status]),$this->statuts_logo[$status]).' '.$langs->transnoentities($this->statuts[$status]);
if ($mode == 5)
return '<span class="hideonsmartphone">'.$langs->trans($this->statuts_short[$status]).' </span>'.img_picto($langs->trans($this->statuts_short[$status]),$this->statuts_logo[$status]);
return '<span class="hideonsmartphone">'.$langs->transnoentities($this->statuts_short[$status]).' </span>'.img_picto($langs->transnoentities($this->statuts_short[$status]),$this->statuts_logo[$status]);
}

View File

@ -1283,82 +1283,44 @@ class FactureFournisseur extends CommonInvoice
$product_type = $type;
}
$this->db->begin();
$line = new SupplierInvoiceLine($this->db);
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det SET";
$sql.= " description ='".$this->db->escape($desc)."'";
$sql.= ", pu_ht = ".price2num($pu_ht);
$sql.= ", pu_ttc = ".price2num($pu_ttc);
$sql.= ", qty = ".price2num($qty);
$sql.= ", remise_percent = ".price2num($remise_percent);
$sql.= ", tva_tx = ".price2num($vatrate);
$sql.= ", localtax1_tx = ".price2num($txlocaltax1);
$sql.= ", localtax2_tx = ".price2num($txlocaltax2);
$sql.= ", localtax1_type = '".$localtaxes_type[0]."'";
$sql.= ", localtax2_type = '".$localtaxes_type[2]."'";
$sql.= ", total_ht = ".price2num($total_ht);
$sql.= ", tva= ".price2num($total_tva);
$sql.= ", total_localtax1= ".price2num($total_localtax1);
$sql.= ", total_localtax2= ".price2num($total_localtax2);
$sql.= ", total_ttc = ".price2num($total_ttc);
if ($idproduct) $sql.= ", fk_product = ".$idproduct;
else $sql.= ", fk_product = null";
$sql.= ", product_type = ".$product_type;
$sql.= ", info_bits = ".$info_bits;
$sql.= ", fk_unit = ".($fk_unit ? "'".$this->db->escape($fk_unit)."'":"null");
$sql.= " WHERE rowid = ".$id;
if ($line->fetch($id) < 1) {
return -1;
}
dol_syslog(get_class($this)."::updateline", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
$this->rowid = $id;
$line->description = $desc;
$line->subprice = $pu_ht;
$line->pu_ht = $pu_ht;
$line->pu_ttc = $pu_ttc;
$line->qty = $qty;
$line->remise_percent = $remise_percent;
$line->tva_tx = $vatrate;
$line->localtax1_tx = $txlocaltax1;
$line->localtax2_tx = $txlocaltax2;
$line->localtax1_type = $localtaxes_type[0];
$line->localtax2_type = $localtaxes_type[2];
$line->total_ht = $total_ht;
$line->total_tva = $total_tva;
$line->total_localtax1 = $total_localtax1;
$line->total_localtax2 = $total_localtax2;
$line->total_ttc = $total_ttc;
$line->fk_product = $idproduct;
$line->product_type = $product_type;
$line->info_bits = $info_bits;
$line->fk_unit = $fk_unit;
$line->array_options = $array_options;
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$linetmp = new SupplierInvoiceLine($this->db);
$linetmp->id=$this->rowid;
$linetmp->array_options = $array_options;
$result=$linetmp->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
$res = $line->update($notrigger);
if (! $error && ! $notrigger)
{
global $conf, $langs, $user;
// Call trigger
$result=$this->call_trigger('LINEBILL_SUPPLIER_UPDATE',$user);
if ($result < 0)
{
$this->db->rollback();
return -1;
}
// End call triggers
}
if ($res < 1) {
$this->errors[] = $line->error;
} else {
// Update total price into invoice record
$res = $this->update_price('','auto');
}
// Update total price into invoice record
$result=$this->update_price('','auto');
if (! $error)
{
$this->db->commit();
return $result;
}
else
{
$this->db->rollback();
return -1;
}
}
else
{
$this->db->rollback();
$this->error=$this->db->lasterror();
return -1;
}
return $res;
}
/**
@ -1972,6 +1934,8 @@ class SupplierInvoiceLine extends CommonObjectLine
public $fk_parent_line;
public $special_code;
public $rang;
public $localtax1_type;
public $localtax2_type;
/**
@ -1993,12 +1957,12 @@ class SupplierInvoiceLine extends CommonObjectLine
public function fetch($rowid)
{
$sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx';
$sql.= ', f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 ';
$sql.= ', f.localtax1_type, f.localtax2_type, f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 ';
$sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit';
$sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det as f';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid';
$sql.= ' WHERE rowid = '.$rowid;
$sql.= ' WHERE f.rowid = '.$rowid;
$sql.= ' ORDER BY f.rang, f.rowid';
$query = $this->db->query($sql);
@ -2029,6 +1993,8 @@ class SupplierInvoiceLine extends CommonObjectLine
$this->tva_tx = $obj->tva_tx;
$this->localtax1_tx = $obj->localtax1_tx;
$this->localtax2_tx = $obj->localtax2_tx;
$this->localtax1_type = $obj->localtax1_type;
$this->localtax2_type = $obj->localtax2_type;
$this->qty = $obj->qty;
$this->remise_percent = $obj->remise_percent;
$this->tva = $obj->total_tva;
@ -2095,5 +2061,113 @@ class SupplierInvoiceLine extends CommonObjectLine
}
}
/**
* Update a supplier invoice line
*
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
public function update($notrigger = 0)
{
global $conf;
$pu = price2num($this->pu_ht);
$qty = price2num($this->qty);
// Check parameters
if (! is_numeric($pu) || ! is_numeric($qty)) {
return -1;
}
if ($this->product_type < 0) {
return -1;
}
// Clean parameters
if (empty($this->tva_tx)) {
$this->tva_tx = 0;
}
if (empty($this->localtax1_tx)) {
$this->localtax1_tx = 0;
}
if (empty($this->localtax2_tx)) {
$this->localtax2_tx = 0;
}
$this->db->begin();
if ($this->fk_product) {
$fk_product = "null";
} else {
$fk_product = $this->fk_product;
}
if ($this->fk_unit) {
$fk_unit = "'".$this->db->escape($this->fk_unit)."'";
} else {
$fk_unit = "null";
}
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det SET";
$sql.= " description ='".$this->db->escape($this->description)."'";
$sql.= ", pu_ht = ".price2num($this->pu_ht);
$sql.= ", pu_ttc = ".price2num($this->pu_ttc);
$sql.= ", qty = ".price2num($this->qty);
$sql.= ", remise_percent = ".price2num($this->remise_percent);
$sql.= ", tva_tx = ".price2num($this->tva_tx);
$sql.= ", localtax1_tx = ".price2num($this->localtax1_tx);
$sql.= ", localtax2_tx = ".price2num($this->localtax2_tx);
$sql.= ", localtax1_type = '".$this->localtax1_type."'";
$sql.= ", localtax2_type = '".$this->localtax2_type."'";
$sql.= ", total_ht = ".price2num($this->total_ht);
$sql.= ", tva= ".price2num($this->total_tva);
$sql.= ", total_localtax1= ".price2num($this->total_localtax1);
$sql.= ", total_localtax2= ".price2num($this->total_localtax2);
$sql.= ", total_ttc = ".price2num($this->total_ttc);
$sql.= ", fk_product = ".$fk_product;
$sql.= ", product_type = ".$this->product_type;
$sql.= ", info_bits = ".$this->info_bits;
$sql.= ", fk_unit = ".$fk_unit;
$sql.= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$this->db->rollback();
$this->error = $this->db->lasterror();
return -1;
}
$this->rowid = $this->id;
$error = 0;
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
if ($this->insertExtraFields() < 0) {
$error++;
}
}
if (! $error && ! $notrigger)
{
global $langs, $user;
// Call trigger
if ($this->call_trigger('LINEBILL_SUPPLIER_UPDATE',$user) < 0) {
$this->db->rollback();
return -1;
}
// End call triggers
}
if ($error) {
$this->db->rollback();
return -1;
}
$this->db->commit();
return 1;
}
}

View File

@ -5,6 +5,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.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
@ -43,8 +44,7 @@ $forcedfile="./install.forced.php";
if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php";
if (@file_exists($forcedfile)) { $useforcedwizard=true; include_once $forcedfile; }
dolibarr_install_syslog("Dolibarr install/upgrade process started");
dolibarr_install_syslog("--- check: Dolibarr install/upgrade process started");
/*
@ -167,11 +167,11 @@ if ($memmaxorig != '')
}
// If config file presente and filled
// If config file present and filled
clearstatcache();
if (is_readable($conffile) && filesize($conffile) > 8)
{
dolibarr_install_syslog("conf file '$conffile' already defined");
dolibarr_install_syslog("check: conf file '" . $conffile . "' already defined");
$confexists=1;
include_once $conffile;
@ -189,19 +189,19 @@ if (is_readable($conffile) && filesize($conffile) > 8)
else
{
// If not, we create it
dolibarr_install_syslog("we try to create conf file '$conffile'");
dolibarr_install_syslog("check: we try to create conf file '" . $conffile . "'");
$confexists=0;
// First we try by copying example
if (@copy($conffile.".example", $conffile))
{
// Success
dolibarr_install_syslog("copied file ".$conffile.".example into ".$conffile." done successfully.");
dolibarr_install_syslog("check: successfully copied file " . $conffile . ".example into " . $conffile);
}
else
{
// If failed, we try to create an empty file
dolibarr_install_syslog("failed to copy file ".$conffile.".example into ".$conffile.". We try to create it.", LOG_WARNING);
dolibarr_install_syslog("check: failed to copy file " . $conffile . ".example into " . $conffile . ". We try to create it.", LOG_WARNING);
$fp = @fopen($conffile, "w");
if ($fp)
@ -210,7 +210,7 @@ else
@fputs($fp,"\n");
fclose($fp);
}
else dolibarr_install_syslog("failed to create a new file ".$conffile." into current dir ".getcwd().". Check permission.", LOG_ERR);
else dolibarr_install_syslog("check: failed to create a new file " . $conffile . " into current dir " . getcwd() . ". Please check permissions.", LOG_ERR);
}
// First install, we can't upgrade
@ -282,7 +282,7 @@ else
if (! file_exists($dolibarr_main_document_root."/core/lib/admin.lib.php"))
{
print '<font class="error">A '.$conffiletoshow.' file exists with a dolibarr_main_document_root to '.$dolibarr_main_document_root.' that seems wrong. Try to fix or remove the '.$conffiletoshow.' file.</font><br>'."\n";
dol_syslog("A '.$conffiletoshow.' file exists with a dolibarr_main_document_root to ".$dolibarr_main_document_root." that seems wrong. Try to fix or remove the '.$conffiletoshow.' file.", LOG_WARNING);
dol_syslog("A '" . $conffiletoshow . "' file exists with a dolibarr_main_document_root to " . $dolibarr_main_document_root . " that seems wrong. Try to fix or remove the '" . $conffiletoshow . "' file.", LOG_WARNING);
}
else
{
@ -531,5 +531,6 @@ $(".runupgrade").click(function() {
</script>';
dolibarr_install_syslog("--- check: end");
pFooter(true); // Never display next button

View File

@ -36,7 +36,7 @@ $langs->setDefaultLang($setuplang);
$langs->load("install");
$langs->load("errors");
dolibarr_install_syslog("Fileconf: Entering fileconf.php page");
dolibarr_install_syslog("--- fileconf: entering fileconf.php page");
// You can force preselected values of the config step of Dolibarr by adding a file
// install.forced.php into directory htdocs/install (This is the case with some wizard
@ -71,12 +71,14 @@ if (@file_exists($forcedfile)) {
session_start(); // To be able to keep info into session (used for not loosing pass during navigation. pass must not transit throug parmaeters)
pHeader($langs->trans("ConfigurationFile"),"etape1","set","",(empty($force_dolibarr_js_JQUERY)?'':$force_dolibarr_js_JQUERY.'/'));
pHeader($langs->trans("ConfigurationFile"),"step1","set","",(empty($force_dolibarr_js_JQUERY)?'':$force_dolibarr_js_JQUERY.'/'));
// Test if we can run a first install process
if (! is_writable($conffile))
{
print $langs->trans("ConfFileIsNotWritable",$conffiletoshow);
print $langs->trans("ConfFileIsNotWritable", $conffiletoshow);
dolibarr_install_syslog("fileconf: config file is not writable", LOG_WARNING);
dolibarr_install_syslog("--- fileconf: end");
pFooter(1,$setuplang,'jscheckparam');
exit;
}
@ -584,4 +586,5 @@ function jscheckparam()
// $db->close(); Not database connexion yet
dolibarr_install_syslog("--- fileconf: end");
pFooter($err,$setuplang,'jscheckparam');

View File

@ -375,13 +375,13 @@ function pHeader($subtitle,$next,$action='set',$param='',$forcejqueryurl='')
print '<!-- Includes CSS for JQuery -->'."\n";
if ($jQueryUiCustomPath) print '<link rel="stylesheet" type="text/css" href="'.$jQueryUiCustomPath.'css/'.$jquerytheme.'/jquery-ui.min.css" />'."\n"; // JQuery
else print '<link rel="stylesheet" type="text/css" href="../includes/jquery/css/'.$jquerytheme.'/jquery-ui-latest.custom.css" />'."\n"; // JQuery
else print '<link rel="stylesheet" type="text/css" href="../includes/jquery/css/'.$jquerytheme.'/jquery-ui.custom.css" />'."\n"; // JQuery
print '<!-- Includes JS for JQuery -->'."\n";
if ($jQueryCustomPath) print '<script type="text/javascript" src="'.$jQueryCustomPath.'jquery.min.js"></script>'."\n";
else print '<script type="text/javascript" src="../includes/jquery/js/jquery-latest.min.js"></script>'."\n";
else print '<script type="text/javascript" src="../includes/jquery/js/jquery.min.js"></script>'."\n";
if ($jQueryUiCustomPath) print '<script type="text/javascript" src="'.$jQueryUiCustomPath.'jquery-ui.min.js"></script>'."\n";
else print '<script type="text/javascript" src="../includes/jquery/js/jquery-ui-latest.custom.min.js"></script>'."\n";
else print '<script type="text/javascript" src="../includes/jquery/js/jquery-ui.custom.min.js"></script>'."\n";
print '<title>'.$langs->trans("DolibarrSetup").'</title>'."\n";
print '</head>'."\n";

View File

@ -28,8 +28,7 @@ include_once '../core/class/html.formadmin.class.php';
$err = 0;
// Si fichier conf existe deja et rempli, on est pas sur une premiere install,
// on ne passe donc pas par la page de choix de langue
// If the config file exists and is filled, we're not on first install so we skip the language selection page
if (file_exists($conffile) && isset($dolibarr_main_url_root))
{
header("Location: check.php?testget=ok");
@ -45,7 +44,7 @@ $langs->load("admin");
$formadmin=new FormAdmin(''); // Note: $db does not exist yet but we don't need it, so we put ''.
pHeader("", "check"); // Etape suivante = check
pHeader("", "check"); // Next step = check
// Ask installation language
@ -62,6 +61,6 @@ print '</table></div>';
print '<br><br>'.$langs->trans("SomeTranslationAreUncomplete");
// Si pas d'erreur, on affiche le bouton pour passer a l'etape suivante
// If there's no error, we display the next step button
if ($err == 0) pFooter(0);

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.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
@ -18,7 +19,7 @@
*/
/**
* \file htdocs/install/repair.php
* \file htdocs/install/repair.php
* \brief Run repair script
*/
@ -29,7 +30,7 @@ require_once $dolibarr_main_document_root.'/core/class/extrafields.class.php';
require_once 'lib/repair.lib.php';
$grant_query='';
$etape = 2;
$step = 2;
$ok = 0;
@ -54,8 +55,8 @@ if ($dolibarr_main_db_type == "pgsql") $choix=2;
if ($dolibarr_main_db_type == "mssql") $choix=3;
dolibarr_install_syslog("repair: Entering upgrade.php page");
if (! is_object($conf)) dolibarr_install_syslog("repair: conf file not initialized",LOG_ERR);
dolibarr_install_syslog("--- repair: entering upgrade.php page");
if (! is_object($conf)) dolibarr_install_syslog("repair: conf file not initialized", LOG_ERR);
/*
@ -105,13 +106,13 @@ if ($db->connected)
{
print '<tr><td class="nowrap">';
print $langs->trans("ServerConnection")." : $dolibarr_main_db_host</td><td align=\"right\">".$langs->trans("OK")."</td></tr>";
dolibarr_install_syslog("repair: ".$langs->transnoentities("ServerConnection")." : $dolibarr_main_db_host ".$langs->transnoentities("OK"));
dolibarr_install_syslog("repair: " . $langs->transnoentities("ServerConnection") . ": " . $dolibarr_main_db_host . $langs->transnoentities("OK"));
$ok = 1;
}
else
{
print "<tr><td>".$langs->trans("ErrorFailedToConnectToDatabase",$dolibarr_main_db_name)."</td><td align=\"right\">".$langs->transnoentities("Error")."</td></tr>";
dolibarr_install_syslog("repair: ".$langs->transnoentities("ErrorFailedToConnectToDatabase",$dolibarr_main_db_name));
dolibarr_install_syslog("repair: " . $langs->transnoentities("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name));
$ok = 0;
}
@ -121,13 +122,13 @@ if ($ok)
{
print '<tr><td class="nowrap">';
print $langs->trans("DatabaseConnection")." : ".$dolibarr_main_db_name."</td><td align=\"right\">".$langs->trans("OK")."</td></tr>";
dolibarr_install_syslog("repair: Database connection successfull : $dolibarr_main_db_name");
dolibarr_install_syslog("repair: database connection successful: " . $dolibarr_main_db_name);
$ok=1;
}
else
{
print "<tr><td>".$langs->trans("ErrorFailedToConnectToDatabase",$dolibarr_main_db_name)."</td><td align=\"right\">".$langs->trans("Error")."</td></tr>";
dolibarr_install_syslog("repair: ".$langs->transnoentities("ErrorFailedToConnectToDatabase",$dolibarr_main_db_name));
dolibarr_install_syslog("repair: " . $langs->transnoentities("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name));
$ok=0;
}
}
@ -139,7 +140,7 @@ if ($ok)
$versionarray=$db->getVersionArray();
print '<tr><td>'.$langs->trans("ServerVersion").'</td>';
print '<td align="right">'.$version.'</td></tr>';
dolibarr_install_syslog("repair: ".$langs->transnoentities("ServerVersion")." : $version");
dolibarr_install_syslog("repair: " . $langs->transnoentities("ServerVersion") . ": " . $version);
//print '<td align="right">'.join('.',$versionarray).'</td></tr>';
}
@ -514,6 +515,7 @@ print '<div class="center"><a href="../index.php?mainmenu=home'.(isset($_POST["l
print $langs->trans("GoToDolibarr");
print '</a></div>';
dolibarr_install_syslog("--- repair: end");
pFooter(1,$setuplang);
if ($db->connected) $db->close();

View File

@ -4,6 +4,7 @@
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.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
@ -20,7 +21,7 @@
*/
/**
* \file htdocs/install/etape1.php
* \file htdocs/install/step1.php
* \ingroup install
* \brief Build conf file on disk
*/
@ -64,7 +65,7 @@ $forcedfile="./install.forced.php";
if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php";
if (@file_exists($forcedfile)) { $useforcedwizard=true; include_once $forcedfile; }
dolibarr_install_syslog("--- etape1: Entering etape1.php page");
dolibarr_install_syslog("--- step1: entering step1.php page");
$error = 0;
@ -74,7 +75,7 @@ $error = 0;
*/
pHeader($langs->trans("ConfigurationFile"),"etape2");
pHeader($langs->trans("ConfigurationFile"),"step2");
// Test if we can run a first install process
if (! is_writable($conffile))
@ -185,7 +186,7 @@ if (! $error)
$db=getDoliDBInstance($db_type, $db_host, $userroot, $passroot, $databasefortest, $db_port);
dol_syslog("databasefortest=".$databasefortest." connected=".$db->connected." database_selected=".$db->database_selected, LOG_DEBUG);
dol_syslog("databasefortest=" . $databasefortest . " connected=" . $db->connected . " database_selected=" . $db->database_selected, LOG_DEBUG);
//print "databasefortest=".$databasefortest." connected=".$db->connected." database_selected=".$db->database_selected;
if (empty($_POST["db_create_database"]) && $db->connected && ! $db->database_selected)
@ -276,7 +277,7 @@ if (! $error && $db->connected)
print '<input type="hidden" name="dolibarr_main_db_collation" value="'.$defaultDBSortingCollation.'">';
$db_character_set=$defaultCharacterSet;
$db_collation=$defaultDBSortingCollation;
dolibarr_install_syslog("db_character_set=".$db_character_set." db_collation=".$db_collation);
dolibarr_install_syslog("step1: db_character_set=" . $db_character_set . " db_collation=" . $db_collation);
}
@ -286,8 +287,9 @@ if (! $error && $db->connected && $action == "set")
umask(0);
foreach($_POST as $key => $value)
{
if (! preg_match('/^db_pass/i', $key))
dolibarr_install_syslog("Choice for ".$key." = ".$value);
if (! preg_match('/^db_pass/i', $key)) {
dolibarr_install_syslog("step1: choice for " . $key . " = " . $value);
}
}
// Show title of step
@ -299,7 +301,7 @@ if (! $error && $db->connected && $action == "set")
{
if (! is_dir($main_dir))
{
dolibarr_install_syslog("etape1: Repertoire '".$main_dir."' inexistant ou non accessible");
dolibarr_install_syslog("step1: directory '" . $main_dir . "' is unavailable or can't be accessed");
print "<tr><td>";
print $langs->trans("ErrorDirDoesNotExists",$main_dir).'<br>';
@ -314,7 +316,7 @@ if (! $error && $db->connected && $action == "set")
if (! $error)
{
dolibarr_install_syslog("etape1: Directory '".$main_dir."' exists");
dolibarr_install_syslog("step1: directory '" . $main_dir . "' exists");
}
@ -343,7 +345,7 @@ if (! $error && $db->connected && $action == "set")
$pathhtaccess=$main_data_dir.'/.htaccess';
if (! file_exists($pathhtaccess))
{
dolibarr_install_syslog("etape1: .htaccess file does not exists, we create it in '".$main_data_dir."'");
dolibarr_install_syslog("step1: .htaccess file did not exist, we created it in '" . $main_data_dir . "'");
$handlehtaccess=@fopen($pathhtaccess,'w');
if ($handlehtaccess)
{
@ -351,7 +353,7 @@ if (! $error && $db->connected && $action == "set")
fwrite($handlehtaccess,'Deny from all'."\n");
fclose($handlehtaccess);
dolibarr_install_syslog("etape1: .htaccess file created");
dolibarr_install_syslog("step1: .htaccess file created");
}
}
@ -372,7 +374,7 @@ if (! $error && $db->connected && $action == "set")
{
if (is_dir($dir[$i]))
{
dolibarr_install_syslog("etape1: Directory '".$dir[$i]."' exists");
dolibarr_install_syslog("step1: directory '" . $dir[$i] . "' exists");
}
else
{
@ -387,7 +389,7 @@ if (! $error && $db->connected && $action == "set")
}
else
{
dolibarr_install_syslog("etape1: Directory '".$dir[$i]."' created");
dolibarr_install_syslog("step1: directory '" . $dir[$i] . "' created");
}
}
}
@ -475,7 +477,7 @@ if (! $error && $db->connected && $action == "set")
// Si creation utilisateur admin demandee, on le cree
if (isset($_POST["db_create_user"]) && $_POST["db_create_user"] == "on")
{
dolibarr_install_syslog("etape1: Create database user: ".$dolibarr_main_db_user);
dolibarr_install_syslog("step1: create database user: " . $dolibarr_main_db_user);
//print $conf->db->host." , ".$conf->db->name." , ".$conf->db->user." , ".$conf->db->port;
$databasefortest=$conf->db->name;
@ -523,7 +525,7 @@ if (! $error && $db->connected && $action == "set")
|| $db->errno() == 'DB_ERROR_KEY_NAME_ALREADY_EXISTS'
|| $db->errno() == 'DB_ERROR_USER_ALREADY_EXISTS')
{
dolibarr_install_syslog("etape1: User already exists");
dolibarr_install_syslog("step1: user already exists");
print '<tr><td>';
print $langs->trans("UserCreation").' : ';
print $dolibarr_main_db_user;
@ -532,7 +534,7 @@ if (! $error && $db->connected && $action == "set")
}
else
{
dolibarr_install_syslog("etape1: Failed to create user");
dolibarr_install_syslog("step1: failed to create user", LOG_ERR);
print '<tr><td>';
print $langs->trans("UserCreation").' : ';
print $dolibarr_main_db_user;
@ -569,7 +571,7 @@ if (! $error && $db->connected && $action == "set")
// If database creation is asked, we create it
if (! $error && (isset($_POST["db_create_database"]) && $_POST["db_create_database"] == "on"))
{
dolibarr_install_syslog("etape1: Create database : ".$dolibarr_main_db_name." ".$dolibarr_main_db_character_set." ".$dolibarr_main_db_collation." ".$dolibarr_main_db_user, LOG_DEBUG);
dolibarr_install_syslog("step1: create database: " . $dolibarr_main_db_name . " " . $dolibarr_main_db_character_set . " " . $dolibarr_main_db_collation . " " . $dolibarr_main_db_user);
$newdb=getDoliDBInstance($conf->db->type,$conf->db->host,$userroot,$passroot,'',$conf->db->port);
//print 'eee'.$conf->db->type." ".$conf->db->host." ".$userroot." ".$passroot." ".$conf->db->port." ".$newdb->connected." ".$newdb->forcecharset;exit;
@ -587,11 +589,11 @@ if (! $error && $db->connected && $action == "set")
$check1=$newdb->getDefaultCharacterSetDatabase();
$check2=$newdb->getDefaultCollationDatabase();
dolibarr_install_syslog('etape1: Note that default server was charset='.$check1.' collation='.$check2, LOG_DEBUG);
dolibarr_install_syslog('step1: note that default server was charset=' . $check1 . ' collation=' . $check2);
// If values differs, we save conf file again
//if ($check1 != $dolibarr_main_db_character_set) dolibarr_install_syslog('etape1: Value for character_set is not the one asked for database creation', LOG_WARNING);
//if ($check2 != $dolibarr_main_db_collation) dolibarr_install_syslog('etape1: Value for collation is not the one asked for database creation', LOG_WARNING);
//if ($check1 != $dolibarr_main_db_character_set) dolibarr_install_syslog('step1: value for character_set is not the one asked for database creation', LOG_WARNING);
//if ($check2 != $dolibarr_main_db_collation) dolibarr_install_syslog('step1: value for collation is not the one asked for database creation', LOG_WARNING);
}
else
{
@ -603,7 +605,7 @@ if (! $error && $db->connected && $action == "set")
print '<br>';
print '</td></tr>';
dolibarr_install_syslog('etape1: Failed to create database '.$dolibarr_main_db_name.' '.$newdb->lasterrno().' '.$newdb->lasterror(), LOG_ERR);
dolibarr_install_syslog('step1: failed to create database ' . $dolibarr_main_db_name . ' ' . $newdb->lasterrno() . ' ' . $newdb->lasterror(), LOG_ERR);
$error++;
}
$newdb->close();
@ -632,14 +634,14 @@ if (! $error && $db->connected && $action == "set")
// We test access with dolibarr database user (not admin)
if (! $error)
{
dolibarr_install_syslog("etape1: connexion de type=".$conf->db->type." sur host=".$conf->db->host." port=".$conf->db->port." user=".$conf->db->user." name=".$conf->db->name, LOG_DEBUG);
dolibarr_install_syslog("step1: connection type=" . $conf->db->type . " on host=" . $conf->db->host . " port=" . $conf->db->port . " user=" . $conf->db->user . " name=" . $conf->db->name);
//print "connexion de type=".$conf->db->type." sur host=".$conf->db->host." port=".$conf->db->port." user=".$conf->db->user." name=".$conf->db->name;
$db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port);
if ($db->connected)
{
dolibarr_install_syslog("etape1: connexion to server by user ".$conf->db->user." is ok", LOG_DEBUG);
dolibarr_install_syslog("step1: connection to server by user " . $conf->db->user . " ok");
print "<tr><td>";
print $langs->trans("ServerConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
print $dolibarr_main_db_host;
@ -650,7 +652,7 @@ if (! $error && $db->connected && $action == "set")
// si acces serveur ok et acces base ok, tout est ok, on ne va pas plus loin, on a meme pas utilise le compte root.
if ($db->database_selected)
{
dolibarr_install_syslog("etape1: connexion to database : ".$conf->db->name.", by user : ".$conf->db->user." is ok", LOG_DEBUG);
dolibarr_install_syslog("step1: connection to database " . $conf->db->name . " by user " . $conf->db->user . " ok");
print "<tr><td>";
print $langs->trans("DatabaseConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
print $dolibarr_main_db_name;
@ -662,7 +664,7 @@ if (! $error && $db->connected && $action == "set")
}
else
{
dolibarr_install_syslog("etape1: connexion to database ".$conf->db->name.", by user : ".$conf->db->user." has failed", LOG_ERR);
dolibarr_install_syslog("step1: connection to database " . $conf->db->name . " by user " . $conf->db->user . " failed", LOG_ERR);
print "<tr><td>";
print $langs->trans("DatabaseConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
print $dolibarr_main_db_name;
@ -682,7 +684,7 @@ if (! $error && $db->connected && $action == "set")
}
else
{
dolibarr_install_syslog("etape1: la connexion au serveur par le user ".$conf->db->user." est rate");
dolibarr_install_syslog("step1: connection to server by user " . $conf->db->user . " failed", LOG_ERR);
print "<tr><td>";
print $langs->trans("ServerConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
print $dolibarr_main_db_host;
@ -723,7 +725,7 @@ function jsinfo()
<?php
dolibarr_install_syslog("--- install/etape1.php end", LOG_INFO);
dolibarr_install_syslog("--- step1: end");
pFooter($error,$setuplang,'jsinfo',1);
@ -744,7 +746,6 @@ function write_main_file($mainfile,$main_dir)
fputs($fp, '<?php'."\n");
fputs($fp, "// Wrapper to include main into htdocs\n");
fputs($fp, "include_once '".$main_dir."/main.inc.php';\n");
fputs($fp, '?>');
fclose($fp);
}
}
@ -766,7 +767,6 @@ function write_master_file($masterfile,$main_dir)
fputs($fp, '<?php'."\n");
fputs($fp, "// Wrapper to include master into htdocs\n");
fputs($fp, "include_once '".$main_dir."/master.inc.php';\n");
fputs($fp, '?>');
fclose($fp);
}
}
@ -928,7 +928,6 @@ function write_conf_file($conffile)
fputs($fp, '$dolibarr_font_DOL_DEFAULT_TTF_BOLD=\''.$force_dolibarr_font_DOL_DEFAULT_TTF_BOLD.'\';');
fputs($fp,"\n");
fputs($fp, '?>');
fclose($fp);
if (file_exists("$conffile"))

View File

@ -1,7 +1,8 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2015 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.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
@ -18,8 +19,8 @@
*/
/**
* \file htdocs/install/etape2.php
* \ingroup install
* \file htdocs/install/step2.php
* \ingroup install
* \brief Create tables, primary keys, foreign keys, indexes and functions into database and then load reference data
*/
@ -27,7 +28,7 @@ include 'inc.php';
require_once $dolibarr_main_document_root.'/core/class/conf.class.php';
require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php';
$etape = 2;
$step = 2;
$ok = 0;
@ -54,7 +55,7 @@ if ($dolibarr_main_db_type == "mssql") $choix=3;
if ($dolibarr_main_db_type == "sqlite") $choix=4;
if ($dolibarr_main_db_type == "sqlite3") $choix=5;
//if (empty($choix)) dol_print_error('','Database type '.$dolibarr_main_db_type.' not supported into etape2.php page');
//if (empty($choix)) dol_print_error('','Database type '.$dolibarr_main_db_type.' not supported into step2.php page');
// Now we load forced value from install.forced.php file.
$useforcedwizard=false;
@ -62,14 +63,14 @@ $forcedfile="./install.forced.php";
if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php";
if (@file_exists($forcedfile)) { $useforcedwizard=true; include_once $forcedfile; }
dolibarr_install_syslog("--- etape2: Entering etape2.php page");
dolibarr_install_syslog("--- step2: entering step2.php page");
/*
* View
*/
pHeader($langs->trans("CreateDatabaseObjects"),"etape4");
pHeader($langs->trans("CreateDatabaseObjects"),"step4");
// Test if we can run a first install process
if (! is_writable($conffile))
@ -103,11 +104,11 @@ if ($action == "set")
{
if($db->database_selected)
{
dolibarr_install_syslog("etape2: Connexion successful to database : ".$conf->db->name);
dolibarr_install_syslog("step2: successful connection to database: " . $conf->db->name);
}
else
{
dolibarr_install_syslog("etape2: Connexion failed to database : ".$conf->db->name);
dolibarr_install_syslog("step2: failed connection to database :" . $conf->db->name, LOG_ERR);
print "<tr><td>Failed to select database ".$conf->db->name.'</td><td><img src="../theme/eldy/img/error.png" alt="Error"></td></tr>';
$ok = 0 ;
}
@ -131,7 +132,7 @@ if ($action == "set")
$requestnb=0;
// To disable some code, so you can call step2 with url like
// http://localhost/dolibarrnew/install/etape2.php?action=set&createtables=0&createkeys=0&createfunctions=0&createdata=llx_20_c_departements
// http://localhost/dolibarrnew/install/step2.php?action=set&createtables=0&createkeys=0&createfunctions=0&createdata=llx_20_c_departements
$createtables=isset($_GET['createtables'])?GETPOST('createtables'):1;
$createkeys=isset($_GET['createkeys'])?GETPOST('createkeys'):1;
$createfunctions=isset($_GET['createfunctions'])?GETPOST('createfunction'):1;
@ -155,7 +156,7 @@ if ($action == "set")
$ok = 0;
$handle=opendir($dir);
dolibarr_install_syslog("Open tables directory ".$dir." handle=".$handle,LOG_DEBUG);
dolibarr_install_syslog("step2: open tables directory " . $dir . " handle=" . $handle);
$tablefound = 0;
$tabledata=array();
if (is_resource($handle))
@ -211,7 +212,7 @@ if ($action == "set")
//print "<tr><td>Creation de la table $name/td>";
$requestnb++;
dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG);
dolibarr_install_syslog("step2: request: " . $buffer);
$resql=$db->query($buffer,0,'dml');
if ($resql)
{
@ -241,7 +242,7 @@ if ($action == "set")
print "</td>";
print '<td><font class="error">'.$langs->trans("Error").' Failed to open file '.$dir.$file.'</td></tr>';
$error++;
dolibarr_install_syslog("Failed to open file ".$dir.$file,LOG_ERR);
dolibarr_install_syslog("step2: failed to open file " . $dir . $file, LOG_ERR);
}
}
@ -257,7 +258,7 @@ if ($action == "set")
else
{
print '<tr><td>'.$langs->trans("ErrorFailedToFindSomeFiles",$dir).'</td><td><img src="../theme/eldy/img/error.png" alt="Error"></td></tr>';
dolibarr_install_syslog("Failed to find files to create database in directory ".$dir,LOG_ERR);
dolibarr_install_syslog("step2: failed to find files to create database in directory " . $dir, LOG_ERR);
}
}
@ -275,7 +276,7 @@ if ($action == "set")
$okkeys = 0;
$handle=opendir($dir);
dolibarr_install_syslog("Open keys directory ".$dir." handle=".$handle,LOG_DEBUG);
dolibarr_install_syslog("step2: open keys directory " . $dir . " handle=" . $handle);
$tablefound = 0;
$tabledata=array();
if (is_resource($handle))
@ -354,7 +355,7 @@ if ($action == "set")
//print "<tr><td>Creation des cles et index de la table $name: '$buffer'</td>";
$requestnb++;
dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG);
dolibarr_install_syslog("step2: request: " . $buffer);
$resql=$db->query($buffer,0,'dml');
if ($resql)
{
@ -390,7 +391,7 @@ if ($action == "set")
print "</td>";
print '<td><font class="error">'.$langs->trans("Error")." Failed to open file ".$dir.$file."</font></td></tr>";
$error++;
dolibarr_install_syslog("Failed to open file ".$dir.$file,LOG_ERR);
dolibarr_install_syslog("step2: failed to open file " . $dir . $file, LOG_ERR);
}
}
@ -421,7 +422,7 @@ if ($action == "set")
if (file_exists($dir.$file))
{
$fp = fopen($dir.$file,"r");
dolibarr_install_syslog("Open function file ".$dir.$file." handle=".$fp,LOG_DEBUG);
dolibarr_install_syslog("step2: open function file " . $dir . $file . " handle=" . $fp);
if ($fp)
{
$buffer='';
@ -444,7 +445,7 @@ if ($action == "set")
$buffer=trim($buffer);
if ($buffer)
{
dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG);
dolibarr_install_syslog("step2: request: " . $buffer);
print "<!-- Insert line : ".$buffer."<br>-->\n";
$resql=$db->query($buffer,0,'dml');
if ($resql)
@ -500,7 +501,7 @@ if ($action == "set")
// Insert data
$handle=opendir($dir);
dolibarr_install_syslog("Open directory data ".$dir." handle=".$handle,LOG_DEBUG);
dolibarr_install_syslog("step2: open directory data " . $dir . " handle=" . $handle);
$tablefound = 0;
$tabledata=array();
if (is_resource($handle))
@ -526,7 +527,7 @@ if ($action == "set")
{
$name = substr($file, 0, dol_strlen($file) - 4);
$fp = fopen($dir.$file,"r");
dolibarr_install_syslog("Open data file ".$dir.$file." handle=".$fp,LOG_DEBUG);
dolibarr_install_syslog("step2: open data file " . $dir . $file . " handle=" . $fp);
if ($fp)
{
$arrayofrequests=array();
@ -555,7 +556,7 @@ if ($action == "set")
}
fclose($fp);
dolibarr_install_syslog("Found ".$linefound." records, defined ".count($arrayofrequests)." group(s).",LOG_DEBUG);
dolibarr_install_syslog("step2: found " . $linefound . " records, defined " . count($arrayofrequests) . " group(s).");
$okallfile=1;
$db->begin();
@ -569,7 +570,7 @@ if ($action == "set")
$buffer=preg_replace('/llx_/i',$dolibarr_main_db_prefix,$buffer);
}
//dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG);
//dolibarr_install_syslog("step2: request: " . $buffer);
$resql=$db->query($buffer,1);
if ($resql)
{
@ -613,7 +614,7 @@ else
print 'Parameter action=set not defined';
}
dolibarr_install_syslog("--- install/etape2.php end", LOG_INFO);
dolibarr_install_syslog("--- step2: end");
pFooter(!$ok,$setuplang);

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Sebastien DiCintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.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
@ -19,7 +20,7 @@
*/
/**
* \file htdocs/install/etape4.php
* \file htdocs/install/step4.php
* \ingroup install
* \brief Ask login and password of Dolibarr admin user
*/
@ -42,7 +43,7 @@ $forcedfile="./install.forced.php";
if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php";
if (@file_exists($forcedfile)) { $useforcedwizard=true; include_once $forcedfile; }
dolibarr_install_syslog("--- etape4: Entering etape4.php page");
dolibarr_install_syslog("--- step4: entering step4.php page");
$err=0;
$ok = 0;
@ -53,7 +54,7 @@ $ok = 0;
* View
*/
pHeader($langs->trans("AdminAccountCreation"),"etape5");
pHeader($langs->trans("AdminAccountCreation"),"step5");
// Test if we can run a first install process
if (! is_writable($conffile))
@ -106,7 +107,7 @@ if ($db->ok)
}
dolibarr_install_syslog("--- install/etape4.php end", LOG_INFO);
dolibarr_install_syslog("--- step4: end");
pFooter($err,$setuplang);

View File

@ -1,9 +1,10 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Sebastien DiCintio <sdicintio@ressource-toi.org>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Sebastien DiCintio <sdicintio@ressource-toi.org>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.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
@ -20,8 +21,8 @@
*/
/**
* \file htdocs/install/etape5.php
* \ingroup install
* \file htdocs/install/step5.php
* \ingroup install
* \brief Last page of upgrade or install process
*/
@ -68,7 +69,7 @@ $forcedfile="./install.forced.php";
if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php";
if (@file_exists($forcedfile)) { $useforcedwizard=true; include_once $forcedfile; }
dolibarr_install_syslog("--- etape5: Entering etape5.php page", LOG_INFO);
dolibarr_install_syslog("--- step5: entering step5.php page");
/*
@ -80,19 +81,19 @@ if ($action == "set")
{
if ($_POST["pass"] <> $_POST["pass_verif"])
{
header("Location: etape4.php?error=1&selectlang=$setuplang".(isset($_POST["login"])?'&login='.$_POST["login"]:''));
header("Location: step4.php?error=1&selectlang=$setuplang".(isset($_POST["login"])?'&login='.$_POST["login"]:''));
exit;
}
if (dol_strlen(trim($_POST["pass"])) == 0)
{
header("Location: etape4.php?error=2&selectlang=$setuplang".(isset($_POST["login"])?'&login='.$_POST["login"]:''));
header("Location: step4.php?error=2&selectlang=$setuplang".(isset($_POST["login"])?'&login='.$_POST["login"]:''));
exit;
}
if (dol_strlen(trim($_POST["login"])) == 0)
{
header("Location: etape4.php?error=3&selectlang=$setuplang".(isset($_POST["login"])?'&login='.$_POST["login"]:''));
header("Location: step4.php?error=3&selectlang=$setuplang".(isset($_POST["login"])?'&login='.$_POST["login"]:''));
exit;
}
}
@ -102,7 +103,7 @@ if ($action == "set")
* View
*/
pHeader($langs->trans("SetupEnd"),"etape5");
pHeader($langs->trans("SetupEnd"),"step5");
print '<br>';
// Test if we can run a first install process
@ -153,7 +154,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
// Active module user
$modName='modUser';
$file = $modName . ".class.php";
dolibarr_install_syslog('install/etape5.php Load module user '.DOL_DOCUMENT_ROOT ."/core/modules/".$file, LOG_INFO);
dolibarr_install_syslog('step5: load module user ' . DOL_DOCUMENT_ROOT . "/core/modules/" . $file, LOG_INFO);
include_once DOL_DOCUMENT_ROOT ."/core/modules/".$file;
$objMod = new $modName($db);
$result=$objMod->init();
@ -188,13 +189,13 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
{
if ($newuser->error == 'ErrorLoginAlreadyExists')
{
dolibarr_install_syslog('install/etape5.php AdminLoginAlreadyExists', LOG_WARNING);
dolibarr_install_syslog('step5: AdminLoginAlreadyExists', LOG_WARNING);
print '<br><div class="warning">'.$langs->trans("AdminLoginAlreadyExists",$_POST["login"])."</div><br>";
$success = 1;
}
else
{
dolibarr_install_syslog('install/etape5.php FailedToCreateAdminLogin '.$newuser->error, LOG_ERR);
dolibarr_install_syslog('step5: FailedToCreateAdminLogin ' . $newuser->error, LOG_ERR);
print '<br><div class="error">'.$langs->trans("FailedToCreateAdminLogin").' '.$newuser->error.'</div><br><br>';
}
}
@ -203,7 +204,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
{
$db->begin();
dolibarr_install_syslog('install/etape5.php set MAIN_VERSION_LAST_INSTALL const to '.$targetversion, LOG_DEBUG);
dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_INSTALL const to ' . $targetversion, LOG_DEBUG);
$resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_VERSION_LAST_INSTALL'");
if (! $resql) dol_print_error($db,'Error in setup program');
$resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_LAST_INSTALL',1).",".$db->encrypt($targetversion,1).",'chaine',0,'Dolibarr version when install',0)");
@ -212,7 +213,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
if ($useforcedwizard)
{
dolibarr_install_syslog('install/etape5.php set MAIN_REMOVE_INSTALL_WARNING const to 1', LOG_DEBUG);
dolibarr_install_syslog('step5: set MAIN_REMOVE_INSTALL_WARNING const to 1', LOG_DEBUG);
$resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_REMOVE_INSTALL_WARNING'");
if (! $resql) dol_print_error($db,'Error in setup program');
$resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_REMOVE_INSTALL_WARNING',1).",".$db->encrypt(1,1).",'chaine',1,'Disable install warnings',0)");
@ -232,7 +233,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
print $langs->trans("ActivateModule",$modtoactivatenew).'<br>';
$file=$modtoactivatenew.'.class.php';
dolibarr_install_syslog('install/etape5.php Activate module file='.$file);
dolibarr_install_syslog('step5: activate module file=' . $file);
$res=dol_include_once("/core/modules/".$file);
$res=activateModule($modtoactivatenew,1);
@ -240,7 +241,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
}
}
dolibarr_install_syslog('install/etape5.php Remove MAIN_NOT_INSTALLED const', LOG_DEBUG);
dolibarr_install_syslog('step5: remove MAIN_NOT_INSTALLED const');
$resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_NOT_INSTALLED'");
if (! $resql) dol_print_error($db,'Error in setup program');
@ -271,7 +272,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
if ($tagdatabase)
{
dolibarr_install_syslog('install/etape5.php set MAIN_VERSION_LAST_UPGRADE const to value '.$targetversion, LOG_DEBUG);
dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_UPGRADE const to value ' . $targetversion);
$resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_VERSION_LAST_UPGRADE'");
if (! $resql) dol_print_error($db,'Error in setup program');
$resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) VALUES (".$db->encrypt('MAIN_VERSION_LAST_UPGRADE',1).",".$db->encrypt($targetversion,1).",'chaine',0,'Dolibarr version for last upgrade',0)");
@ -280,7 +281,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
}
else
{
dolibarr_install_syslog('install/etape5.php We run an upgrade to version '.$targetversion.' but database was already upgraded to '.$conf->global->MAIN_VERSION_LAST_UPGRADE.'. We keep MAIN_VERSION_LAST_UPGRADE as it is.', LOG_DEBUG);
dolibarr_install_syslog('step5: we run an upgrade to version ' . $targetversion . ' but database was already upgraded to ' . $conf->global->MAIN_VERSION_LAST_UPGRADE . '. We keep MAIN_VERSION_LAST_UPGRADE as it is.');
}
}
else
@ -290,7 +291,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
}
else
{
dol_print_error('','install/etape5.php Unknown choice of action');
dol_print_error('','step5.php: unknown choice of action');
}
// May fail if parameter already defined
@ -404,7 +405,7 @@ elseif (empty($action) || preg_match('/upgrade/i',$action))
}
else
{
dol_print_error('','install/etape5.php Unknown choice of action');
dol_print_error('','step5.php: unknown choice of action');
}
@ -413,6 +414,6 @@ else
clearstatcache();
dolibarr_install_syslog("--- install/etape5.php Dolibarr setup finished", LOG_INFO);
dolibarr_install_syslog("--- step5: Dolibarr setup finished");
pFooter(1,$setuplang);

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.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
@ -41,7 +42,7 @@ require_once $conffile; if (! isset($dolibarr_main_db_type)) $dolibarr_main_db_t
require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php';
$grant_query='';
$etape = 2;
$step = 2;
$ok = 0;
@ -70,8 +71,8 @@ if ($dolibarr_main_db_type == "pgsql") $choix=2;
if ($dolibarr_main_db_type == "mssql") $choix=3;
dolibarr_install_syslog("upgrade: Entering upgrade.php page");
if (! is_object($conf)) dolibarr_install_syslog("upgrade2: conf file not initialized",LOG_ERR);
dolibarr_install_syslog("--- upgrade: Entering upgrade.php page");
if (! is_object($conf)) dolibarr_install_syslog("upgrade2: conf file not initialized", LOG_ERR);
/*
@ -145,13 +146,13 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
{
print '<tr><td class="nowrap">';
print $langs->trans("ServerConnection")." : $dolibarr_main_db_host</td><td align=\"right\">".$langs->trans("OK")."</td></tr>\n";
dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ServerConnection")." : $dolibarr_main_db_host ".$langs->transnoentities("OK"));
dolibarr_install_syslog("upgrade: " . $langs->transnoentities("ServerConnection") . ": $dolibarr_main_db_host " . $langs->transnoentities("OK"));
$ok = 1;
}
else
{
print "<tr><td>".$langs->trans("ErrorFailedToConnectToDatabase",$dolibarr_main_db_name)."</td><td align=\"right\">".$langs->transnoentities("Error")."</td></tr>\n";
dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ErrorFailedToConnectToDatabase",$dolibarr_main_db_name));
dolibarr_install_syslog("upgrade: " . $langs->transnoentities("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name));
$ok = 0;
}
@ -161,13 +162,13 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
{
print '<tr><td class="nowrap">';
print $langs->trans("DatabaseConnection")." : ".$dolibarr_main_db_name."</td><td align=\"right\">".$langs->trans("OK")."</td></tr>\n";
dolibarr_install_syslog("upgrade: Database connection successfull : $dolibarr_main_db_name");
dolibarr_install_syslog("upgrade: Database connection successful: " . $dolibarr_main_db_name);
$ok=1;
}
else
{
print "<tr><td>".$langs->trans("ErrorFailedToConnectToDatabase",$dolibarr_main_db_name)."</td><td align=\"right\">".$langs->trans("Error")."</td></tr>\n";
dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ErrorFailedToConnectToDatabase",$dolibarr_main_db_name));
dolibarr_install_syslog("upgrade: " . $langs->transnoentities("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name));
$ok=0;
}
}
@ -179,7 +180,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
$versionarray=$db->getVersionArray();
print '<tr><td>'.$langs->trans("ServerVersion").'</td>';
print '<td align="right">'.$version.'</td></tr>';
dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ServerVersion")." : $version");
dolibarr_install_syslog("upgrade: " . $langs->transnoentities("ServerVersion") . ": " .$version);
// Test database version requirement
$versionmindb=$db::VERSIONMIN;
@ -189,7 +190,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
{
// Warning: database version too low.
print "<tr><td>".$langs->trans("ErrorDatabaseVersionTooLow",join('.',$versionarray),join('.',$versionmindb))."</td><td align=\"right\">".$langs->trans("Error")."</td></tr>\n";
dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ErrorDatabaseVersionTooLow",join('.',$versionarray),join('.',$versionmindb)));
dolibarr_install_syslog("upgrade: " . $langs->transnoentities("ErrorDatabaseVersionTooLow", join('.', $versionarray), join('.', $versionmindb)));
$ok=0;
}
@ -216,7 +217,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
{
// Warning: database version too low.
print '<tr><td><div class="warning">'.$langs->trans("ErrorDatabaseVersionForbiddenForMigration",join('.',$versionarray),$listofforbiddenversion)."</div></td><td align=\"right\">".$langs->trans("Error")."</td></tr>\n";
dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ErrorDatabaseVersionForbiddenForMigration",join('.',$versionarray),$listofforbiddenversion));
dolibarr_install_syslog("upgrade: " . $langs->transnoentities("ErrorDatabaseVersionForbiddenForMigration", join('.', $versionarray), $listofforbiddenversion));
$ok=0;
break;
}
@ -246,7 +247,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
$filles=array();
$sql = "SELECT fk_categorie_mere, fk_categorie_fille";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_association";
dolibarr_install_syslog("upgrade: search duplicate", LOG_DEBUG);
dolibarr_install_syslog("upgrade: search duplicate");
$resql = $db->query($sql);
if ($resql)
{
@ -263,7 +264,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
}
}
dolibarr_install_syslog("upgrade: result is num=".$num." count(couples)=".count($couples));
dolibarr_install_syslog("upgrade: result is num=" . $num . " count(couples)=" . count($couples));
// If there is duplicates couples or child with two parents
if (count($couples) > 0 && $num > count($couples))
@ -274,7 +275,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
// We delete all
$sql="DELETE FROM ".MAIN_DB_PREFIX."categorie_association";
dolibarr_install_syslog("upgrade: delete association", LOG_DEBUG);
dolibarr_install_syslog("upgrade: delete association");
$resqld=$db->query($sql);
if ($resqld)
{
@ -283,7 +284,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
{
$sql ="INSERT INTO ".MAIN_DB_PREFIX."categorie_association(fk_categorie_mere,fk_categorie_fille)";
$sql.=" VALUES(".$val['mere'].", ".$val['fille'].")";
dolibarr_install_syslog("upgrade: insert association", LOG_DEBUG);
dolibarr_install_syslog("upgrade: insert association");
$resqli=$db->query($sql);
if (! $resqli) $error++;
}
@ -481,6 +482,7 @@ $ret=0;
if (! $ok && isset($argv[1])) $ret=1;
dol_syslog("Exit ".$ret);
dolibarr_install_syslog("--- upgrade: end");
pFooter(((! $ok && empty($_GET["ignoreerrors"])) || $dirmodule),$setuplang);
if ($db->connected) $db->close();

View File

@ -3,6 +3,7 @@
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.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
@ -47,7 +48,7 @@ require_once $dolibarr_main_document_root . '/core/class/menubase.class.php';
require_once $dolibarr_main_document_root . '/core/lib/files.lib.php';
$grant_query='';
$etape = 2;
$step = 2;
$error = 0;
@ -74,8 +75,8 @@ if ($dolibarr_main_db_type == 'pgsql') $choix=2;
if ($dolibarr_main_db_type == 'mssql') $choix=3;
dolibarr_install_syslog("upgrade2: Entering upgrade2.php page");
if (! is_object($conf)) dolibarr_install_syslog("upgrade2: conf file not initialized",LOG_ERR);
dolibarr_install_syslog("--- upgrade2: entering upgrade2.php page");
if (! is_object($conf)) dolibarr_install_syslog("upgrade2: conf file not initialized", LOG_ERR);
@ -98,7 +99,7 @@ if (! $versionfrom && ! $versionto)
exit;
}
pHeader('','etape5',GETPOST("action")?GETPOST("action"):'upgrade','versionfrom='.$versionfrom.'&versionto='.$versionto);
pHeader('','step5',GETPOST("action")?GETPOST("action"):'upgrade','versionfrom='.$versionfrom.'&versionto='.$versionto);
if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
@ -137,7 +138,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
if (!$db->connected)
{
print '<tr><td colspan="4">'.$langs->trans("ErrorFailedToConnectToDatabase",$conf->db->name).'</td><td align="right">'.$langs->trans('Error').'</td></tr>';
dolibarr_install_syslog('upgrade2: Failed to connect to database : '.$conf->db->name.' on '.$conf->db->host.' for user '.$conf->db->user, LOG_ERR);
dolibarr_install_syslog('upgrade2: failed to connect to database :' . $conf->db->name . ' on ' . $conf->db->host . ' for user ' . $conf->db->user, LOG_ERR);
$error++;
}
@ -145,7 +146,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
{
if($db->database_selected)
{
dolibarr_install_syslog('upgrade2: Database connection successfull : '.$dolibarr_main_db_name);
dolibarr_install_syslog('upgrade2: database connection successful :' . $dolibarr_main_db_name);
}
else
{
@ -421,6 +422,7 @@ $ret=0;
if ($error && isset($argv[1])) $ret=1;
dol_syslog("Exit ".$ret);
dolibarr_install_syslog("--- upgrade2: end");
pFooter($error,$setuplang);
if ($db->connected) $db->close();
@ -455,7 +457,7 @@ function migrate_paiements($db,$langs,$conf)
$resql = $db->query($sql);
dolibarr_install_syslog("upgrade2::migrate_paiements", LOG_DEBUG);
dolibarr_install_syslog("upgrade2::migrate_paiements");
if ($resql)
{
$i = 0;
@ -555,7 +557,7 @@ function migrate_paiements_orphelins_1($db,$langs,$conf)
$resql = $db->query($sql);
dolibarr_install_syslog("upgrade2::migrate_paiements_orphelins_1", LOG_DEBUG);
dolibarr_install_syslog("upgrade2::migrate_paiements_orphelins_1");
$row = array();
if ($resql)
{
@ -681,7 +683,7 @@ function migrate_paiements_orphelins_2($db,$langs,$conf)
$resql = $db->query($sql);
dolibarr_install_syslog("upgrade2::migrate_paiements_orphelins_2", LOG_DEBUG);
dolibarr_install_syslog("upgrade2::migrate_paiements_orphelins_2");
$row = array();
if ($resql)
{
@ -821,7 +823,7 @@ function migrate_contracts_det($db,$langs,$conf)
$sql.= " WHERE cd.rowid IS NULL AND p.rowid IS NOT NULL";
$resql = $db->query($sql);
dolibarr_install_syslog("upgrade2::migrate_contracts_det", LOG_DEBUG);
dolibarr_install_syslog("upgrade2::migrate_contracts_det");
if ($resql)
{
$i = 0;
@ -917,7 +919,7 @@ function migrate_links_transfert($db,$langs,$conf)
$sql.= " AND bu.fk_bank IS NULL";
$resql = $db->query($sql);
dolibarr_install_syslog("upgrade2::migrate_links_transfert", LOG_DEBUG);
dolibarr_install_syslog("upgrade2::migrate_links_transfert");
if ($resql)
{
$i = 0;
@ -941,7 +943,7 @@ function migrate_links_transfert($db,$langs,$conf)
$sql.= ")";
print $sql.'<br>';
dolibarr_install_syslog("migrate_links_transfert", LOG_DEBUG);
dolibarr_install_syslog("migrate_links_transfert");
if (! $db->query($sql))
{
@ -992,7 +994,7 @@ function migrate_contracts_date1($db,$langs,$conf)
print '<b>'.$langs->trans('MigrationContractsEmptyDatesUpdate')."</b><br>\n";
$sql="update llx_contrat set date_contrat=tms where date_contrat is null";
dolibarr_install_syslog("upgrade2::migrate_contracts_date1", LOG_DEBUG);
dolibarr_install_syslog("upgrade2::migrate_contracts_date1");
$resql = $db->query($sql);
if (! $resql) dol_print_error($db);
if ($db->affected_rows($resql) > 0)
@ -1001,7 +1003,7 @@ function migrate_contracts_date1($db,$langs,$conf)
print $langs->trans('MigrationContractsEmptyDatesNothingToUpdate')."<br>\n";
$sql="update llx_contrat set datec=tms where datec is null";
dolibarr_install_syslog("upgrade2::migrate_contracts_date1", LOG_DEBUG);
dolibarr_install_syslog("upgrade2::migrate_contracts_date1");
$resql = $db->query($sql);
if (! $resql) dol_print_error($db);
if ($db->affected_rows($resql) > 0)
@ -1031,7 +1033,7 @@ function migrate_contracts_date2($db,$langs,$conf)
$sql.= " GROUP BY c.rowid, c.date_contrat";
$resql = $db->query($sql);
dolibarr_install_syslog("upgrade2::migrate_contracts_date2", LOG_DEBUG);
dolibarr_install_syslog("upgrade2::migrate_contracts_date2");
if ($resql)
{
$i = 0;
@ -1092,7 +1094,7 @@ function migrate_contracts_date3($db,$langs,$conf)
print '<b>'.$langs->trans('MigrationContractsIncoherentCreationDateUpdate')."</b><br>\n";
$sql="update llx_contrat set datec=date_contrat where datec is null or datec > date_contrat";
dolibarr_install_syslog("upgrade2::migrate_contracts_date3", LOG_DEBUG);
dolibarr_install_syslog("upgrade2::migrate_contracts_date3");
$resql = $db->query($sql);
if (! $resql) dol_print_error($db);
if ($db->affected_rows($resql) > 0)
@ -1120,7 +1122,7 @@ function migrate_contracts_open($db,$langs,$conf)
$sql = "SELECT c.rowid as cref FROM llx_contrat as c, llx_contratdet as cd";
$sql.= " WHERE cd.statut = 4 AND c.statut=2 AND c.rowid=cd.fk_contrat";
dolibarr_install_syslog("upgrade2::migrate_contracts_open", LOG_DEBUG);
dolibarr_install_syslog("upgrade2::migrate_contracts_open");
$resql = $db->query($sql);
if (! $resql) dol_print_error($db);
if ($db->affected_rows($resql) > 0) {
@ -1190,7 +1192,7 @@ function migrate_paiementfourn_facturefourn($db,$langs,$conf)
$select_sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn';
$select_sql.= ' WHERE fk_facture_fourn IS NOT NULL';
dolibarr_install_syslog("upgrade2::migrate_paiementfourn_facturefourn", LOG_DEBUG);
dolibarr_install_syslog("upgrade2::migrate_paiementfourn_facturefourn");
$select_resql = $db->query($select_sql);
if ($select_resql)
{
@ -1306,7 +1308,7 @@ function migrate_price_facture($db,$langs,$conf)
$sql.= " AND (((fd.total_ttc = 0 AND fd.remise_percent != 100) or fd.total_ttc IS NULL) or f.total_ttc IS NULL)";
//print $sql;
dolibarr_install_syslog("upgrade2::migrate_price_facture", LOG_DEBUG);
dolibarr_install_syslog("upgrade2::migrate_price_facture");
$resql=$db->query($sql);
if ($resql)
{
@ -1340,7 +1342,7 @@ function migrate_price_facture($db,$langs,$conf)
$facligne->total_tva = $total_tva;
$facligne->total_ttc = $total_ttc;
dolibarr_install_syslog("upgrade2: Line $rowid: facid=$obj->facid pu=$pu qty=$qty vatrate=$vatrate remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc");
dolibarr_install_syslog("upgrade2: line " . $rowid . ": facid=" . $obj->facid . " pu=" . $pu ." qty=" . $qty . " vatrate=" . $vatrate . " remise_percent=" . $remise_percent . " remise_global=" . $remise_percent_global . " -> " . $total_ht . ", " . $total_tva . ", " . $total_ttc);
print ". ";
$facligne->update_total();
@ -1419,7 +1421,7 @@ function migrate_price_propal($db,$langs,$conf)
$sql.= " WHERE pd.fk_propal = p.rowid";
$sql.= " AND ((pd.total_ttc = 0 AND pd.remise_percent != 100) or pd.total_ttc IS NULL)";
dolibarr_install_syslog("upgrade2::migrate_price_propal", LOG_DEBUG);
dolibarr_install_syslog("upgrade2::migrate_price_propal");
$resql=$db->query($sql);
if ($resql)
{
@ -1452,7 +1454,7 @@ function migrate_price_propal($db,$langs,$conf)
$propalligne->total_tva = $total_tva;
$propalligne->total_ttc = $total_ttc;
dolibarr_install_syslog("upgrade2: Line $rowid: propalid=$obj->rowid pu=$pu qty=$qty vatrate=$vatrate remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc");
dolibarr_install_syslog("upgrade2: Line " . $rowid . ": propalid=" . $obj->rowid . " pu=" . $pu . " qty=" . $qty . " vatrate=" . $vatrate . " remise_percent=" . $remise_percent . " remise_global=" . $remise_percent_global . " -> " . $total_ht . ", " . $total_tva. ", " . $total_ttc);
print ". ";
$propalligne->update_total();
@ -1528,7 +1530,7 @@ function migrate_price_contrat($db,$langs,$conf)
$sql.= " WHERE cd.fk_contrat = c.rowid";
$sql.= " AND ((cd.total_ttc = 0 AND cd.remise_percent != 100 AND cd.subprice > 0) or cd.total_ttc IS NULL)";
dolibarr_install_syslog("upgrade2::migrate_price_contrat", LOG_DEBUG);
dolibarr_install_syslog("upgrade2::migrate_price_contrat");
$resql=$db->query($sql);
if ($resql)
{
@ -1561,7 +1563,7 @@ function migrate_price_contrat($db,$langs,$conf)
$contratligne->total_tva = $total_tva;
$contratligne->total_ttc = $total_ttc;
dolibarr_install_syslog("upgrade2: Line $rowid: contratdetid=$obj->rowid pu=$pu qty=$qty vatrate=$vatrate remise_percent=$remise_percent -> $total_ht, $total_tva, $total_ttc");
dolibarr_install_syslog("upgrade2: Line " . $rowid . ": contratdetid=" . $obj->rowid . " pu=" . $pu . " qty=" . $qty . " vatrate=" . $vatrate . " remise_percent=" . $remise_percent. " -> " . $total_ht . ", " . $total_tva. " , " . $total_ttc);
print ". ";
$contratligne->update_total();
@ -1613,7 +1615,7 @@ function migrate_price_commande($db,$langs,$conf)
$sql.= " WHERE cd.fk_commande = c.rowid";
$sql.= " AND ((cd.total_ttc = 0 AND cd.remise_percent != 100) or cd.total_ttc IS NULL)";
dolibarr_install_syslog("upgrade2::migrate_price_commande", LOG_DEBUG);
dolibarr_install_syslog("upgrade2::migrate_price_commande");
$resql=$db->query($sql);
if ($resql)
{
@ -1646,7 +1648,7 @@ function migrate_price_commande($db,$langs,$conf)
$commandeligne->total_tva = $total_tva;
$commandeligne->total_ttc = $total_ttc;
dolibarr_install_syslog("upgrade2: Line $rowid: commandeid=$obj->rowid pu=$pu qty=$qty vatrate=$vatrate remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc");
dolibarr_install_syslog("upgrade2: Line " . $rowid . " : commandeid=" . $obj->rowid . " pu=" . $pu . " qty=" . $qty . " vatrate=" . $vatrate . " remise_percent=" . $remise_percent . " remise_global=" . $remise_percent_global. " -> " . $total_ht . ", " . $total_tva . ", " . $total_ttc);
print ". ";
$commandeligne->update_total();
@ -1727,7 +1729,7 @@ function migrate_price_commande_fournisseur($db,$langs,$conf)
$sql.= " WHERE cd.fk_commande = c.rowid";
$sql.= " AND ((cd.total_ttc = 0 AND cd.remise_percent != 100) or cd.total_ttc IS NULL)";
dolibarr_install_syslog("upgrade2::migrate_price_commande_fournisseur", LOG_DEBUG);
dolibarr_install_syslog("upgrade2::migrate_price_commande_fournisseur");
$resql=$db->query($sql);
if ($resql)
{
@ -1760,7 +1762,7 @@ function migrate_price_commande_fournisseur($db,$langs,$conf)
$commandeligne->total_tva = $total_tva;
$commandeligne->total_ttc = $total_ttc;
dolibarr_install_syslog("upgrade2: Line $rowid: commandeid=$obj->rowid pu=$pu qty=$qty vatrate=$vatrate remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc");
dolibarr_install_syslog("upgrade2: Line " . $rowid . ": commandeid=" . $obj->rowid . " pu=" . $pu . " qty=" . $qty . " vatrate=" . $vatrate . " remise_percent=" . $remise_percent . " remise_global=" . $remise_percent_global . " -> " . $total_ht . ", " . $total_tva . ", " . $total_ttc);
print ". ";
$commandeligne->update_total();
@ -2448,7 +2450,7 @@ function migrate_restore_missing_links($db,$langs,$conf)
$sql.= " (SELECT t2.rowid FROM ".MAIN_DB_PREFIX.$table2." as t2";
$sql.= " WHERE t1.rowid = t2.".$field2.")";
dolibarr_install_syslog("upgrade2:migrate_restore_missing_links DIRECTION 1", LOG_DEBUG);
dolibarr_install_syslog("upgrade2::migrate_restore_missing_links DIRECTION 1");
$resql = $db->query($sql);
if ($resql)
{
@ -2514,7 +2516,7 @@ function migrate_restore_missing_links($db,$langs,$conf)
$sql.= " (SELECT t2.rowid FROM ".MAIN_DB_PREFIX.$table2." as t2";
$sql.= " WHERE t1.rowid = t2.".$field2.")";
dolibarr_install_syslog("upgrade2:migrate_restore_missing_links DIRECTION 2", LOG_DEBUG);
dolibarr_install_syslog("upgrade2::migrate_restore_missing_links DIRECTION 2");
$resql = $db->query($sql);
if ($resql)
{
@ -2779,7 +2781,7 @@ function migrate_relationship_tables($db,$langs,$conf,$table,$fk_source,$sourcet
if ($db->DDLInfoTable(MAIN_DB_PREFIX.$table))
{
dolibarr_install_syslog("upgrade2::migrate_relationship_tables table = ".MAIN_DB_PREFIX.$table);
dolibarr_install_syslog("upgrade2::migrate_relationship_tables table = " . MAIN_DB_PREFIX . $table);
$db->begin();
@ -3304,7 +3306,7 @@ function migrate_actioncomm_element($db,$langs,$conf)
$obj = $db->fetch_object($result);
if ($obj)
{
dolibarr_install_syslog("upgrade2::migrate_actioncomm_element field=".$field);
dolibarr_install_syslog("upgrade2::migrate_actioncomm_element field=" . $field);
$db->begin();
@ -3367,7 +3369,7 @@ function migrate_mode_reglement($db,$langs,$conf)
{
$error=0;
dolibarr_install_syslog("upgrade2::migrate_mode_reglement code=".$elements['code'][$key]);
dolibarr_install_syslog("upgrade2::migrate_mode_reglement code=" . $elements['code'][$key]);
$sqlSelect = "SELECT id";
$sqlSelect.= " FROM ".MAIN_DB_PREFIX."c_paiement";
@ -3624,7 +3626,7 @@ function migrate_directories($db,$langs,$conf,$oldname,$newname)
if (is_dir(DOL_DATA_ROOT.$oldname) && ! file_exists(DOL_DATA_ROOT.$newname))
{
dolibarr_install_syslog("upgrade2::migrate_directories move ".DOL_DATA_ROOT.$oldname.' into '.DOL_DATA_ROOT.$newname);
dolibarr_install_syslog("upgrade2::migrate_directories move " . DOL_DATA_ROOT . $oldname . ' into ' . DOL_DATA_ROOT . $newname);
@rename(DOL_DATA_ROOT.$oldname,DOL_DATA_ROOT.$newname);
}
}
@ -3774,7 +3776,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array())
if ($moduletoreload == 'MAIN_MODULE_AGENDA')
{
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Agenda");
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Agenda module");
$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modAgenda.class.php';
if ($res) {
$mod=new modAgenda($db);
@ -3784,7 +3786,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array())
}
if ($moduletoreload == 'MAIN_MODULE_BARCODE')
{
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Barcode");
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Barcode module");
$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modBarcode.class.php';
if ($res) {
$mod=new modBarcode($db);
@ -3794,7 +3796,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array())
}
if ($moduletoreload == 'MAIN_MODULE_CRON')
{
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Cron");
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Cron module");
$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modCron.class.php';
if ($res) {
$mod=new modCron($db);
@ -3804,7 +3806,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array())
}
if ($moduletoreload == 'MAIN_MODULE_SOCIETE')
{
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Societe");
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Societe module");
$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modSociete.class.php';
if ($res) {
$mod=new modSociete($db);
@ -3814,7 +3816,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array())
}
if ($moduletoreload == 'MAIN_MODULE_PRODUIT') // Permission has changed into 2.7
{
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Produit");
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Produit module");
$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modProduct.class.php';
if ($res) {
$mod=new modProduct($db);
@ -3824,7 +3826,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array())
}
if ($moduletoreload == 'MAIN_MODULE_SERVICE') // Permission has changed into 2.7
{
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Service");
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Service module");
$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modService.class.php';
if ($res) {
@ -3835,7 +3837,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array())
}
if ($moduletoreload == 'MAIN_MODULE_COMMANDE') // Permission has changed into 2.9
{
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Commande");
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Commande module");
$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modCommande.class.php';
if ($res) {
@ -3846,7 +3848,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array())
}
if ($moduletoreload == 'MAIN_MODULE_FACTURE') // Permission has changed into 2.9
{
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Facture");
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Facture module");
$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modFacture.class.php';
if ($res) {
$mod=new modFacture($db);
@ -3856,7 +3858,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array())
}
if ($moduletoreload == 'MAIN_MODULE_FOURNISSEUR') // Permission has changed into 2.9
{
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Fournisseur");
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Fournisseur module");
$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modFournisseur.class.php';
if ($res) {
$mod=new modFournisseur($db);
@ -3866,7 +3868,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array())
}
if ($moduletoreload == 'MAIN_MODULE_DEPLACEMENT') // Permission has changed into 3.0
{
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Deplacement");
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Deplacement module");
$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modDeplacement.class.php';
if ($res) {
$mod=new modDeplacement($db);
@ -3876,7 +3878,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array())
}
if ($moduletoreload == 'MAIN_MODULE_DON') // Permission has changed into 3.0
{
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Don");
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Don module");
$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modDon.class.php';
if ($res) {
$mod=new modDon($db);
@ -3886,7 +3888,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array())
}
if ($moduletoreload == 'MAIN_MODULE_ECM') // Permission has changed into 3.0 and 3.1
{
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module ECM");
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate ECM module");
$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modECM.class.php';
if ($res) {
$mod=new modECM($db);
@ -3896,7 +3898,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array())
}
if ($moduletoreload == 'MAIN_MODULE_PAYBOX') // Permission has changed into 3.0
{
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Paybox");
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Paybox module");
$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modPaybox.class.php';
if ($res) {
$mod=new modPaybox($db);
@ -3906,7 +3908,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array())
}
if ($moduletoreload == 'MAIN_MODULE_OPENSURVEY') // Permission has changed into 3.0
{
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Opensurvey");
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Opensurvey module");
$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modOpenSurvey.class.php';
if ($res) {
$mod=new modOpenSurvey($db);
@ -3916,7 +3918,7 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array())
}
if ($moduletoreload == 'MAIN_MODULE_USER') // Permission has changed into 3.0
{
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module User");
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate User module");
$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modUser.class.php';
if ($res) {
$mod=new modUser($db);

View File

@ -48,6 +48,7 @@ NewAccount=New accounting account
Update=Update
List=List
Create=Create
CreateMvts=Create movement
UpdateAccount=Modification of an accounting account
UpdateMvts=Modification of a movement
WriteBookKeeping=Record accounts in general ledger
@ -83,6 +84,8 @@ ACCOUNTING_LIST_SORT_VENTILATION_DONE=Begin the sorting of the breakdown pages "
AccountLength=Length of the accounting accounts shown in Dolibarr
AccountLengthDesc=Function allowing to feign a length of accounting account by replacing spaces by the zero figure. This function touches only the display, it does not modify the accounting accounts registered in Dolibarr. For the export, this function is necessary to be compatible with certain software.
ACCOUNTING_LENGTH_DESCRIPTION=Length for displaying product & services description in listings (Best = 50)
ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT=Length for displaying product & services account description form in listings (Best = 50)
ACCOUNTING_LENGTH_GACCOUNT=Length of the general accounts
ACCOUNTING_LENGTH_AACCOUNT=Length of the third party accounts

View File

@ -69,7 +69,7 @@ function llxHeaderPaypal($title, $head = "")
// JQuery. Must be before other includes
print '<!-- Includes JS for JQuery -->'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-latest.min'.$ext.'"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery.min'.$ext.'"></script>'."\n";
// jQuery jnotify
if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY))
{

View File

@ -30,14 +30,14 @@ if (empty($usedolheader))
<link rel="shortcut icon" type="image/x-icon" href="<?php echo DOL_URL_ROOT ?>/theme/eldy/img/favicon.ico"/>
<title>Test page</title>
<!-- Includes for JQuery (Ajax library) -->
<link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT ?>/includes/jquery/css/smoothness/jquery-ui-latest.custom.css" />
<link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT ?>/includes/jquery/css/smoothness/jquery-ui.custom.css" />
<link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/datatables/css/jquery.dataTables.css" />
<?php if ($_GET["dol_use_jmobile"] == 1) { ?>
<link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/mobile/jquery.mobile-latest.min.css" />
<?php } ?>
<link rel="stylesheet" type="text/css" title="default" href="<?php echo DOL_URL_ROOT ?>/theme/eldy/style.css.php<?php echo ($_GET["dol_use_jmobile"] == 1)?'?dol_use_jmobile=1&dol_optimize_smallscreen=1':''; ?>" />
<!-- Includes JS for JQuery -->
<script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/js/jquery-latest.min.js"></script>
<script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/js/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/tablednd/jquery.tablednd.0.6.min.js"></script>
<script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/datatables/js/jquery.dataTables.js"></script>
<?php if ($_GET["dol_use_jmobile"] == 1) { ?>