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

This commit is contained in:
fhenry 2013-01-15 21:43:24 +01:00
commit d3ca82d984
54 changed files with 468 additions and 808 deletions

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
@ -28,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$langs->load("admin");
$langs->load("boxes");
if (! $user->admin) accessforbidden();
@ -211,8 +212,6 @@ if ($action == 'switch')
*/
$form=new Form($db);
$emptyuser=new User($db);
//$infobox=new InfoBox($db);
llxHeader('',$langs->trans("Boxes"));
@ -316,7 +315,7 @@ if ($resql)
// Available boxes
$boxtoadd=InfoBox::listBoxes($db,'available',-1,$emptyuser,$actives);
$boxtoadd=InfoBox::listBoxes($db,'available',-1,null,$actives);
print "<br>\n";
print_titre($langs->trans("BoxesAvailable"));
@ -346,8 +345,15 @@ foreach($boxtoadd as $box)
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<tr '.$bc[$var].'>';
print '<td>'.img_object("",$logo).' '.$box->boxlabel.'</td>';
print '<td>' . ($box->note?$box->note:'&nbsp;') . '</td>';
print '<td>'.img_object("",$logo).' '.$langs->transnoentitiesnoconv($box->boxlabel).'</td>';
print '<td>';
if ($box->note == '(WarningUsingThisBoxSlowDown)')
{
$langs->load("errors");
print $langs->trans("WarningUsingThisBoxSlowDown");
}
else print ($box->note?$box->note:'&nbsp;');
print '</td>';
print '<td>' . $box->sourcefile . '</td>';
// Pour chaque position possible, on affiche un lien d'activation si boite non deja active pour cette position
@ -366,7 +372,7 @@ print '</table>';
// Activated boxes
$boxactivated=InfoBox::listBoxes($db,'activated',-1,$emptyuser);
$boxactivated=InfoBox::listBoxes($db,'activated',-1,null);
print "<br>\n\n";
print_titre($langs->trans("BoxesActivated"));
@ -398,8 +404,15 @@ foreach($boxactivated as $key => $box)
print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
print '<tr '.$bc[$var].'>';
print '<td>'.img_object("",$logo).' '.$box->boxlabel.'</td>';
print '<td>' . ($box->note?$box->note:'&nbsp;') . '</td>';
print '<td>'.img_object("",$logo).' '.$langs->transnoentitiesnoconv($box->boxlabel).'</td>';
print '<td>';
if ($box->note == '(WarningUsingThisBoxSlowDown)')
{
$langs->load("errors");
print img_warning('',0).' '.$langs->trans("WarningUsingThisBoxSlowDown");
}
else print ($box->note?$box->note:'&nbsp;');
print '</td>';
print '<td align="center">' . (isset($pos_name[$box->position])?$pos_name[$box->position]:'') . '</td>';
$hasnext=($key < (count($boxactivated)-1));
$hasprevious=($key != 0);

View File

@ -55,12 +55,13 @@ print $langs->trans("SetupDescription2")."<br><br>";
print '<br>';
//print '<hr style="color: #DDDDDD;">';
print img_picto('','puce').' '.$langs->trans("SetupDescription3",DOL_URL_ROOT.'/admin/company.php?mainmenu=home');
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_PAYS))
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_PAYS)) $setupcompanynotcomplete=1;
print img_picto('','puce').' '.$langs->trans("SetupDescription3",DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete)?'':'&action=edit'));
if (! empty($setupcompanynotcomplete))
{
$langs->load("errors");
$warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"));
print '<br><a href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home">'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").'</a>';
print '<br><a href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete)?'':'&action=edit').'">'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").'</a>';
}
print '<br>';
print '<br>';

View File

@ -37,7 +37,7 @@ $action = GETPOST("action");
$syslogModules = array();
$activeModules = array();
if (defined('SYSLOG_HANDLERS')) $activeModules = json_decode(SYSLOG_HANDLERS);
if (defined('SYSLOG_HANDLERS')) $activeModules = json_decode(constant('SYSLOG_HANDLERS'));
$dir = dol_buildpath('/core/modules/syslog/');

View File

@ -49,6 +49,11 @@ print "<br>";
print info_admin($langs->trans("SystemAreaForAdminOnly")).'<br>';
print '<br><br>';
// Show logo
print '<center><div class="logo_setup"></div></center>';
llxFooter();
$db->close();

View File

@ -32,7 +32,7 @@ class box_actions extends ModeleBoxes
{
var $boxcode="lastactions";
var $boximg="object_action";
var $boxlabel;
var $boxlabel="BoxLastActions";
var $depends = array("agenda");
var $db;
@ -42,17 +42,6 @@ class box_actions extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*/
function __construct()
{
global $langs;
$langs->load("boxes");
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastActions");
}
/**
* Load data for box to show them later
*

View File

@ -1,5 +1,7 @@
<?php
/* Copyright (C) 2012 Charles-François BENKE <charles.fr@benke.fr>
/* Copyright (C) 2012 Charles-François BENKE <charles.fr@benke.fr>
* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
@ -29,28 +31,27 @@ class box_activity extends ModeleBoxes
{
var $boxcode="activity";
var $boximg="object_bill";
var $boxlabel;
var $boxlabel='BoxGlobalActivity';
var $depends = array("facture");
var $db;
var $param;
var $enabled = 1;
var $info_box_head = array();
var $info_box_contents = array();
/**
* Constructor
*/
function __construct()
function __construct($db)
{
global $langs;
$langs->load("boxes");
$langs->load("bills");
$langs->load("projects");
$langs->load("orders");
$this->boxlabel = $langs->transnoentitiesnoconv("BoxGlobalActivity");
$this->db = $db;
$this->enabled = 1;
// FIXME: Use a cache to save data because this slow down too much main home page. This box slow down too seriously software.
// FIXME: Removed number_format (not compatible with all languages)
// FIXME: Pb into some status
}
/**
@ -66,13 +67,7 @@ class box_activity extends ModeleBoxes
$totalMnt = 0;
$totalnb = 0;
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$facturestatic=new Facture($db);
$propalstatic=new Propal($db);
$commandestatic=new Commande($db);
$nbofyears=2;
if (! empty($conf->global->MAIN_BOX_ACTIVITY_DURATION)) $nbofyears=$conf->global->MAIN_BOX_ACTIVITY_DURATION;
@ -80,12 +75,15 @@ class box_activity extends ModeleBoxes
$this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead));
// compute the year limit to show
$tmpdate= dol_time_plus_duree(time(), -1*$nbofyears, "y");
$tmpdate= dol_time_plus_duree(dol_now(), -1*$nbofyears, "y");
// list the summary of the bills
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{
$sql = "SELECT f.paye, f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$facturestatic=new Facture($db);
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ")";
@ -94,7 +92,7 @@ class box_activity extends ModeleBoxes
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
$sql.= " AND f.fk_soc = s.rowid";
$sql.= " AND f.datef >= '".$db->idate($tmpdate)."' AND paye=1";
$sql.= " GROUP BY f.paye, f.fk_statut ";
$sql.= " GROUP BY f.fk_statut";
$sql.= " ORDER BY f.fk_statut DESC";
$result = $db->query($sql);
@ -107,7 +105,7 @@ class box_activity extends ModeleBoxes
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => 'bill');
$objp = $db->fetch_object($result);
$this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $langs->trans("Bills")."&nbsp;".$facturestatic->LibStatut($objp->paye,$objp->fk_statut,0)." ".$objp->annee);
$this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $langs->trans("Bills")."&nbsp;".$facturestatic->LibStatut(1,$objp->fk_statut,0)." ".$objp->annee);
$billurl="viewstatut=2&paye=1&year=".$objp->annee;
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
@ -123,19 +121,19 @@ class box_activity extends ModeleBoxes
$totalnb += $objp->nb;
$totalMnt += $objp->Mnttot;
}
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"', 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3) );
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"', 'text' => $facturestatic->LibStatut(1,$objp->fk_statut,3) );
$i++;
}
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedInvoices"));
}
else dol_print_error($db);
$sql = "SELECT f.paye, f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
$sql.= " WHERE f.entity = ".$conf->entity;
$sql.= " AND f.fk_soc = s.rowid";
$sql.= " AND paye=0";
$sql.= " GROUP BY f.paye, f.fk_statut ";
$sql.= " GROUP BY f.fk_statut";
$sql.= " ORDER BY f.fk_statut DESC";
$result = $db->query($sql);
@ -151,7 +149,7 @@ class box_activity extends ModeleBoxes
$objp = $db->fetch_object($result);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $langs->trans("Bills")."&nbsp;".$facturestatic->LibStatut($objp->paye,$objp->fk_statut,0));
'text' => $langs->trans("Bills")."&nbsp;".$facturestatic->LibStatut(0,$objp->fk_statut,0));
$billurl="viewstatut=".$objp->fk_statut."&paye=0";
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
@ -163,7 +161,7 @@ class box_activity extends ModeleBoxes
);
$totalMnt += $objp->Mnttot;
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3)
'text' => $facturestatic->LibStatut(0,$objp->fk_statut,3)
);
$i++;
}
@ -176,7 +174,10 @@ class box_activity extends ModeleBoxes
// list the summary of the orders
if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
{
$sql = "SELECT c.fk_statut,c.facture, sum(c.total_ttc) as Mnttot, count(*) as nb";
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$commandestatic=new Commande($db);
$sql = "SELECT c.fk_statut, sum(c.total_ttc) as Mnttot, count(*) as nb";
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ")";
@ -200,7 +201,7 @@ class box_activity extends ModeleBoxes
$objp = $db->fetch_object($result);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' =>$langs->trans("Orders")."&nbsp;".$commandestatic->LibStatut($objp->fk_statut,$objp->facture,0)
'text' =>$langs->trans("Orders")."&nbsp;".$commandestatic->LibStatut($objp->fk_statut,0,0)
);
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
@ -213,7 +214,7 @@ class box_activity extends ModeleBoxes
'text' => dol_trunc(number_format($objp->Mnttot, 0, ',', ' '),40)."&nbsp;".getCurrencySymbol($conf->currency)
);
$totalMnt += $objp->Mnttot;
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"', 'text' => $commandestatic->LibStatut($objp->fk_statut,$objp->facture,3));
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"', 'text' => $commandestatic->LibStatut($objp->fk_statut,0,3));
$i++;
}
@ -224,7 +225,10 @@ class box_activity extends ModeleBoxes
// list the summary of the propals
if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
{
$sql = "SELECT p.fk_statut, sum(p.total) as Mnttot, count(*) as nb";
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$propalstatic=new Propal($db);
$sql = "SELECT p.fk_statut, SUM(p.total) as Mnttot, COUNT(*) as nb";
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ")";

View File

@ -29,7 +29,7 @@ class box_bookmarks extends ModeleBoxes
{
var $boxcode="bookmarks";
var $boximg="object_bookmark";
var $boxlabel;
var $boxlabel="BoxMyLastBookmarks";
var $depends = array("bookmark");
var $db;
@ -38,16 +38,6 @@ class box_bookmarks extends ModeleBoxes
var $info_box_head = array();
var $info_box_contents = array();
/**
* Constructor
*/
function __construct()
{
global $langs;
$langs->load("boxes");
$this->boxlabel=$langs->transnoentitiesnoconv("BoxMyLastBookmarks");
}
/**
* Load data for box to show them later

View File

@ -33,7 +33,7 @@ class box_clients extends ModeleBoxes
{
var $boxcode="lastcustomers";
var $boximg="object_company";
var $boxlabel;
var $boxlabel="BoxLastCustomers";
var $depends = array("societe");
var $db;
@ -42,16 +42,6 @@ class box_clients extends ModeleBoxes
var $info_box_head = array();
var $info_box_contents = array();
/**
* Constructor
*/
function __construct()
{
global $langs;
$langs->load("boxes");
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastCustomers");
}
/**
* Load data for box to show them later
@ -83,8 +73,8 @@ class box_clients extends ModeleBoxes
$sql.= " ORDER BY s.tms DESC";
$sql.= $db->plimit($max, 0);
dol_syslog(get_class($this)."::loadBox sql=".$sql,LOG_DEBUG);
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);

View File

@ -33,7 +33,7 @@ class box_commandes extends ModeleBoxes
{
var $boxcode="lastcustomerorders";
var $boximg="object_order";
var $boxlabel;
var $boxlabel="BoxLastCustomerOrders";
var $depends = array("commande");
var $db;
@ -42,16 +42,6 @@ class box_commandes extends ModeleBoxes
var $info_box_head = array();
var $info_box_contents = array();
/**
* Constructor
*/
function __construct()
{
global $langs;
$langs->load("boxes");
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastCustomerOrders");
}
/**
* Load data for box to show them later

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005 Christophe
* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
@ -33,25 +33,29 @@ class box_comptes extends ModeleBoxes
{
var $boxcode="currentaccounts";
var $boximg="object_bill";
var $boxlabel;
var $boxlabel="BoxCurrentAccounts";
var $depends = array("banque"); // Box active if module banque active
var $db;
var $param;
var $enabled = 1;
var $info_box_head = array();
var $info_box_contents = array();
/**
* Constructor
*/
function __construct()
function __construct($db)
{
global $langs;
$langs->load("boxes");
$this->boxlabel=$langs->transnoentitiesnoconv('BoxCurrentAccounts');
global $conf, $user;
$this->db = $db;
// disable module for such cases
$listofmodulesforexternal=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL);
if (! in_array('banque',$listofmodulesforexternal) && ! empty($user->societe_id)) $this->enabled=0; // disabled for external users
}
/**

View File

@ -34,7 +34,7 @@ class box_contacts extends ModeleBoxes
{
var $boxcode="lastcontacts";
var $boximg="object_contact";
var $boxlabel;
var $boxlabel="BoxLastContacts";
var $depends = array("societe");
var $db;
@ -43,16 +43,6 @@ class box_contacts extends ModeleBoxes
var $info_box_head = array();
var $info_box_contents = array();
/**
* Constructor
*/
function __construct()
{
global $langs;
$langs->load("boxes");
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastContacts");
}
/**
* Load data into info_box_contents array to show array later.
@ -78,12 +68,11 @@ class box_contacts extends ModeleBoxes
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")";
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND sp.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($user->societe_id) $sql.= " AND sp.rowid = $user->societe_id";
if ($user->societe_id) $sql.= " AND sp.fk_soc = $user->societe_id";
$sql.= " ORDER BY sp.tms DESC";
$sql.= $db->plimit($max, 0);
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);

View File

@ -31,7 +31,7 @@ class box_contracts extends ModeleBoxes
{
var $boxcode="lastcontracts";
var $boximg="object_contract";
var $boxlabel;
var $boxlabel="BoxLastContracts";
var $depends = array("contrat"); // conf->contrat->enabled
var $db;
@ -41,18 +41,6 @@ class box_contracts extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*/
function __construct()
{
global $langs;
$langs->load("boxes");
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastContracts");
}
/**
* Load data for box to show them later
*

View File

@ -35,7 +35,7 @@ class box_external_rss extends ModeleBoxes
{
var $boxcode="lastrssinfos";
var $boximg="object_rss";
var $boxlabel;
var $boxlabel="BoxLastRssInfos";
var $depends = array("externalrss");
var $db;
@ -52,13 +52,8 @@ class box_external_rss extends ModeleBoxes
*/
function __construct($db,$param)
{
global $langs;
$langs->load("boxes");
$this->db=$db;
$this->param=$param;
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastRssInfos");
}
/**

View File

@ -32,7 +32,7 @@ class box_factures extends ModeleBoxes
{
var $boxcode="lastcustomerbills";
var $boximg="object_bill";
var $boxlabel;
var $boxlabel="BoxLastCustomerBills";
var $depends = array("facture");
var $db;
@ -41,16 +41,6 @@ class box_factures extends ModeleBoxes
var $info_box_head = array();
var $info_box_contents = array();
/**
* Constructor
*/
function __construct()
{
global $langs;
$langs->load("boxes");
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastCustomerBills");
}
/**
* Load data into info_box_contents array to show array later.

View File

@ -32,7 +32,7 @@ class box_factures_fourn extends ModeleBoxes
{
var $boxcode="lastsupplierbills";
var $boximg="object_bill";
var $boxlabel;
var $boxlabel="BoxLastSupplierBills";
var $depends = array("facture","fournisseur");
var $db;
@ -41,16 +41,6 @@ class box_factures_fourn extends ModeleBoxes
var $info_box_head = array();
var $info_box_contents = array();
/**
* Constructor
*/
function __construct()
{
global $langs;
$langs->load("boxes");
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastSupplierBills");
}
/**
* Load data into info_box_contents array to show array later.

View File

@ -31,7 +31,7 @@ class box_factures_fourn_imp extends ModeleBoxes
{
var $boxcode="oldestunpaidsupplierbills";
var $boximg="object_bill";
var $boxlabel;
var $boxlabel="BoxOldestUnpaidSupplierBills";
var $depends = array("facture","fournisseur");
var $db;
@ -41,17 +41,6 @@ class box_factures_fourn_imp extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*/
function __construct()
{
global $langs;
$langs->load("boxes");
$this->boxlabel=$langs->transnoentitiesnoconv("BoxOldestUnpaidSupplierBills");
}
/**
* Load data into info_box_contents array to show array later.
*

View File

@ -34,7 +34,7 @@ class box_factures_imp extends ModeleBoxes
{
var $boxcode="oldestunpaidcustomerbills";
var $boximg="object_bill";
var $boxlabel;
var $boxlabel="BoxOldestUnpaidCustomerBills";
var $depends = array("facture");
var $db;
@ -44,17 +44,6 @@ class box_factures_imp extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*/
function __construct()
{
global $langs;
$langs->load("boxes");
$this->boxlabel=$langs->transnoentitiesnoconv("BoxOldestUnpaidCustomerBills");
}
/**
* Load data into info_box_contents array to show array later.
*

View File

@ -32,7 +32,7 @@ class box_fournisseurs extends ModeleBoxes
{
var $boxcode="lastsuppliers";
var $boximg="object_company";
var $boxlabel;
var $boxlabel="BoxLastSuppliers";
var $depends = array("fournisseur");
var $db;
@ -41,16 +41,6 @@ class box_fournisseurs extends ModeleBoxes
var $info_box_head = array();
var $info_box_contents = array();
/**
* Constructor
*/
function __construct()
{
global $langs;
$langs->load("boxes");
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastSuppliers");
}
/**
* Load data into info_box_contents array to show array later.

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
@ -19,8 +19,8 @@
/**
* \file htdocs/core/boxes/box_members.php
* \ingroup societes
* \brief Module de generation de l'affichage de la box clients
* \ingroup adherent
* \brief Module to show box of members
*/
include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
@ -33,24 +33,29 @@ class box_members extends ModeleBoxes
{
var $boxcode="lastmembers";
var $boximg="object_user";
var $boxlabel;
var $boxlabel="BoxLastMembers";
var $depends = array("adherent");
var $db;
var $param;
var $enabled = 1;
var $info_box_head = array();
var $info_box_contents = array();
/**
* Constructor
*/
function __construct()
function __construct($db)
{
global $langs;
$langs->load("boxes");
global $conf, $user;
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastMembers");
$this->db = $db;
// disable module for such cases
$listofmodulesforexternal=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL);
if (! in_array('banque',$listofmodulesforexternal) && ! empty($user->societe_id)) $this->enabled=0; // disabled for external users
}
/**

View File

@ -32,7 +32,7 @@ class box_osc_clients extends ModeleBoxes
{
var $boxcode="nbofcustomers";
var $boximg="object_company";
var $boxlabel;
var $boxlabel="BoxNbOfCustomers";
var $depends = array("boutique");
var $db;
@ -41,16 +41,6 @@ class box_osc_clients extends ModeleBoxes
var $info_box_head = array();
var $info_box_contents = array();
/**
* Constructor
*/
function __construct()
{
global $langs;
$langs->load("boxes");
$this->boxlabel=$langs->transnoentitiesnoconv("BoxNbOfCustomers");
}
/**
* Load data into info_box_contents array to show array later.

View File

@ -34,7 +34,7 @@ class box_produits extends ModeleBoxes
{
var $boxcode="lastproducts";
var $boximg="object_product";
var $boxlabel;
var $boxlabel="BoxLastProducts";
var $depends = array("produit");
var $db;
@ -44,17 +44,6 @@ class box_produits extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*/
function __construct()
{
global $langs;
$langs->load("boxes");
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastProducts");
}
/**
* Load data into info_box_contents array to show array later.
*

View File

@ -35,7 +35,7 @@ class box_produits_alerte_stock extends ModeleBoxes
{
var $boxcode="productsalertstock";
var $boximg="object_product";
var $boxlabel;
var $boxlabel="BoxProductsAlertStock";
var $depends = array("produit");
var $db;
@ -45,17 +45,6 @@ class box_produits_alerte_stock extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*/
function __construct()
{
global $langs;
$langs->load("boxes");
$this->boxlabel=$langs->transnoentitiesnoconv("BoxProductsAlertStock");
}
/**
* Load data into info_box_contents array to show array later.
*

View File

@ -33,7 +33,7 @@ class box_propales extends ModeleBoxes
{
var $boxcode="lastpropals";
var $boximg="object_propal";
var $boxlabel;
var $boxlabel="BoxLastProposals";
var $depends = array("propal"); // conf->propal->enabled
var $db;
@ -43,17 +43,6 @@ class box_propales extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*/
function __construct()
{
global $langs;
$langs->load("boxes");
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastProposals");
}
/**
* Load data into info_box_contents array to show array later.
*

View File

@ -35,7 +35,7 @@ class box_prospect extends ModeleBoxes
{
var $boxcode="lastprospects";
var $boximg="object_company";
var $boxlabel;
var $boxlabel="BoxLastProspects";
var $depends = array("societe");
var $db;
@ -44,21 +44,6 @@ class box_prospect extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
global $langs;
$langs->load("boxes");
$this->db=$db;
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastProspects");
}
/**
* Load data into info_box_contents array to show array later.
*
@ -88,7 +73,7 @@ class box_prospect extends ModeleBoxes
$sql.= " ORDER BY s.tms DESC";
$sql.= $db->plimit($max, 0);
dol_syslog("box_prospect::loadBox sql=".$sql,LOG_DEBUG);
dol_syslog(get_class($this)."::loadBox sql=".$sql,LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{

View File

@ -33,7 +33,7 @@ class box_services_contracts extends ModeleBoxes
{
var $boxcode="lastproductsincontract";
var $boximg="object_product";
var $boxlabel;
var $boxlabel="BoxLastProductsInContract";
var $depends = array("service","contrat");
var $db;
@ -42,17 +42,7 @@ class box_services_contracts extends ModeleBoxes
var $info_box_head = array();
var $info_box_contents = array();
/**
* Constructor
*/
function __construct()
{
global $langs;
$langs->load("boxes");
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastProductsInContract");
}
/**
* Load data into info_box_contents array to show array later.
*

View File

@ -32,7 +32,7 @@ class box_services_expired extends ModeleBoxes
var $boxcode="expiredservices"; // id of box
var $boximg="object_contract";
var $boxlabel;
var $boxlabel="BoxOldestExpiredServices";
var $depends = array("contrat"); // conf->propal->enabled
var $db;
@ -42,18 +42,6 @@ class box_services_expired extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*/
function __construct()
{
global $langs;
$langs->load("contracts");
$this->boxlabel=$langs->transnoentitiesnoconv("BoxOldestExpiredServices");
}
/**
* Load data for box to show them later
*

View File

@ -33,23 +33,14 @@ class box_supplier_orders extends ModeleBoxes
var $boxcode = "latestsupplierorders";
var $boximg = "object_order";
var $boxlabel;
var $boxlabel="BoxLatestSupplierOrders";
var $depends = array("fournisseur");
var $db;
var $param;
var $info_box_head = array();
var $info_box_contents = array();
/**
* Constructor
*/
function __construct()
{
global $langs;
$langs->load("boxes");
$this->boxlabel = $langs->transnoentitiesnoconv("BoxLatestSupplierOrders");
}
/**
* Load data into info_box_contents array to show array later.

View File

@ -32,7 +32,8 @@ class ModeleBoxes // Can't be abtract as it is instanciated to build "empty"
var $db;
var $error='';
var $max=5;
var $enabled=1;
var $rowid;
var $id;
var $position;
@ -46,7 +47,7 @@ class ModeleBoxes // Can't be abtract as it is instanciated to build "empty"
/**
* Constructor
*
* @param DoliDB $db Database hanlder
* @param DoliDB $db Database handler
*/
function __construct($db)
{
@ -122,7 +123,7 @@ class ModeleBoxes // Can't be abtract as it is instanciated to build "empty"
$bcx[1] = 'class="box_impair"';
$var = false;
dol_syslog(get_Class($this));
dol_syslog(get_class($this).'::showBox');
// Define nbcol and nblines of the box to show
$nbcol=0;

View File

@ -147,7 +147,7 @@ class Conf
$value=$objp->value;
if ($key)
{
if (! defined("$key")) define("$key", $value); // In some cases, the constant might be already forced (Example: SYSLOG_FILE_ON and SYSLOG_FILE during install)
if (! defined("$key")) define("$key", $value); // In some cases, the constant might be already forced (Example: SYSLOG_HANDLERS during install)
$this->global->$key=$value;
if ($value && preg_match('/^MAIN_MODULE_/',$key))
@ -397,7 +397,7 @@ class Conf
$this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : $this->global->MAIN_UPLOAD_DOC * 1024);
// Define list of limited modules
if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='facture,commande,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda'; // '' means 'all'. Note that contact is added here as it should be a module later.
if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='facture,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda'; // '' means 'all'. Note that contact is added here as it should be a module later.
// Timeouts
if (empty($this->global->MAIN_USE_CONNECT_TIMEOUT)) $this->global->MAIN_USE_CONNECT_TIMEOUT=10;

View File

@ -467,16 +467,17 @@ class ExtraFields
* Load array this->attribute_label
*
* @param string $elementtype Type of element
* @param boolean $forcecheck override test of MAIN_EXTRAFIELDS_DISABLED
* @return array Array of attributes for all extra fields
*/
function fetch_name_optionals_label($elementtype='member')
function fetch_name_optionals_label($elementtype='member',$forcecheck=false)
{
global $conf;
$array_name_label=array();
// For avoid conflicts with external modules
if (! empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && !$forcecheck)
return $array_name_label;
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired";

View File

@ -808,24 +808,28 @@ class FormOther
include_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
//$infobox=new InfoBox($db);
$boxactivated=InfoBox::listBoxes($db,'activated',$areacode,$user);
$arrayboxactivatedid=array();
foreach($boxactivated as $box) $arrayboxactivatedid[$box->id]=$box->id;
$selectboxlist='';
if (! empty($conf->use_javascript_ajax))
$confuserzone='MAIN_BOXES_'.$areacode;
$boxactivated=InfoBox::listBoxes($db,'activated',$areacode,(empty($user->conf->$confuserzone)?null:$user)); // Search boxes of user (or everybody if user has no specific setup)
$boxidactivatedforuser=array();
foreach($boxactivated as $box)
{
$emptyuser=new User($db);
$boxavailable=InfoBox::listBoxes($db,'activated',$areacode,$emptyuser,$arrayboxactivatedid); // Get list of box available for empty user (minus already activated for user)
$arrayboxtoactivatelabel=array();
foreach($boxavailable as $box)
{
$arrayboxtoactivatelabel[$box->id]=$box->boxlabel;
}
$form=new Form($db);
if (empty($user->conf->$confuserzone) || $box->fk_user == $user->id) $boxidactivatedforuser[$box->id]=$box->id; // We keep only boxes to show for user
}
$selectboxlist='';
$arrayboxtoactivatelabel=array();
if (! empty($user->conf->$confuserzone))
{
$langs->load("boxes");
foreach($boxactivated as $box)
{
if (! empty($boxidactivatedforuser[$box->id])) continue; // Already visible for user
$arrayboxtoactivatelabel[$box->id]=$langs->transnoentitiesnoconv($box->boxlabel); // We keep only boxes not shown for user, to show into combo list
}
$form=new Form($db);
$selectboxlist=$form->selectarray('boxcombo', $arrayboxtoactivatelabel,'',1);
}
@ -852,12 +856,14 @@ class FormOther
</script>';
}
$nbboxactivated=count($boxactivated);
$nbboxactivated=count($boxidactivatedforuser);
print load_fiche_titre(($nbboxactivated?$langs->trans("OtherInformationsBoxes"):''),$selectboxlist,'','','otherboxes');
if ($nbboxactivated)
{
$emptybox=new ModeleBoxes($db);
print '<table width="100%" class="notopnoleftnoright">';
print '<tr><td class="notopnoleftnoright">'."\n";
@ -873,6 +879,7 @@ class FormOther
$ii=0;
foreach ($boxactivated as $key => $box)
{
if ((! empty($user->conf->$confuserzone) && $box->fk_user == 0) || (empty($user->conf->$confuserzone) && $box->fk_user != 0)) continue;
if (empty($box->box_order) && $ii < ($nbboxactivated / 2)) $box->box_order='A'.sprintf("%02d",($ii+1)); // When box_order was not yet set to Axx or Bxx and is still 0
if (preg_match('/^A/i',$box->box_order)) // column A
{
@ -885,7 +892,6 @@ class FormOther
}
}
$emptybox=new ModeleBoxes($db);
$emptybox->box_id='A';
$emptybox->info_box_head=array();
$emptybox->info_box_contents=array();
@ -902,7 +908,8 @@ class FormOther
$ii=0;
foreach ($boxactivated as $key => $box)
{
if (empty($box->box_order) && $ii < ($nbboxactivated / 2)) $box->box_order='B'.sprintf("%02d",($ii+1)); // When box_order was not yet set to Axx or Bxx and is still 0
if ((! empty($user->conf->$confuserzone) && $box->fk_user == 0) || (empty($user->conf->$confuserzone) && $box->fk_user != 0)) continue;
if (empty($box->box_order) && $ii < ($nbboxactivated / 2)) $box->box_order='B'.sprintf("%02d",($ii+1)); // When box_order was not yet set to Axx or Bxx and is still 0
if (preg_match('/^B/i',$box->box_order)) // colonne B
{
$ii++;
@ -914,7 +921,6 @@ class FormOther
}
}
$emptybox=new ModeleBoxes($db);
$emptybox->box_id='B';
$emptybox->info_box_head=array();
$emptybox->info_box_contents=array();

View File

@ -33,7 +33,7 @@ class InfoBox
* @param DoliDB $db Database handler
* @param string $mode 'available' or 'activated'
* @param string $zone Name or area (-1 for all, 0 for Homepage, 1 for xxx, ...)
* @param User $user Objet user to filter (used only if $zone >= 0)
* @param User $user Objet user to filter
* @param array $excludelist Array of box id (box.box_id = boxes_def.rowid) to exclude
* @return array Array of boxes
*/
@ -52,7 +52,7 @@ class InfoBox
$sql.= " WHERE b.box_id = d.rowid";
$sql.= " AND b.entity IN (0,".(! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")";
if ($zone >= 0) $sql.= " AND b.position = ".$zone;
if ($user->id && ! empty($user->conf->$confuserzone)) $sql.= " AND b.fk_user = ".$user->id;
if (is_object($user)) $sql.= " AND b.fk_user IN (0,".$user->id.")";
else $sql.= " AND b.fk_user = 0";
$sql.= " ORDER BY b.box_order";
}
@ -71,7 +71,7 @@ class InfoBox
}
}
dol_syslog(get_class()."::listBoxes get default box list sql=".$sql, LOG_DEBUG);
dol_syslog(get_class()."::listBoxes get default box list for mode=".$mode." userid=".(is_object($user)?$user->id:'')." sql=".$sql, LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{
@ -101,13 +101,13 @@ class InfoBox
$box=new $boxname($db,$obj->note);
// box properties
$box->rowid = (! empty($obj->rowid) ? $obj->rowid : '');
$box->id = (! empty($obj->box_id) ? $obj->box_id : '');
$box->position = (! empty($obj->position) ? $obj->position : '');
$box->box_order = (! empty($obj->box_order) ? $obj->box_order : '');
$box->fk_user = (! empty($obj->fk_user) ? $obj->fk_user : '');
$box->rowid = (empty($obj->rowid) ? '' : $obj->rowid);
$box->id = (empty($obj->box_id) ? '' : $obj->box_id);
$box->position = (empty($obj->position) ? '' : $obj->position);
$box->box_order = (empty($obj->box_order) ? '' : $obj->box_order);
$box->fk_user = (empty($obj->fk_user) ? 0 : $obj->fk_user);
$box->sourcefile=$relsourcefile;
if ($mode == 'activated' && (! $user->id || empty($user->conf->$confuserzone))) // List of activated box was not yet personalized into database
if ($mode == 'activated' && ! is_object($user)) // List of activated box was not yet personalized into database
{
if (is_numeric($box->box_order))
{
@ -116,18 +116,20 @@ class InfoBox
}
}
// box_def properties
$box->box_id = (! empty($obj->box_id) ? $obj->box_id : '');
$box->note = (! empty($obj->note) ? $obj->note : '');
$box->box_id = (empty($obj->box_id) ? '' : $obj->box_id);
$box->note = (empty($obj->note) ? '' : $obj->note);
$enabled=true;
$enabled=$box->enabled;
if (isset($box->depends) && count($box->depends) > 0)
{
foreach($box->depends as $module)
{
//print $boxname.'-'.$module.'<br>';
if (empty($conf->$module->enabled)) $enabled=false;
if (empty($conf->$module->enabled)) $enabled=0;
}
}
//print 'xx module='.$module.' enabled='.$enabled;
if ($enabled) $boxes[]=$box;
}
}
@ -137,9 +139,8 @@ class InfoBox
else
{
//dol_print_error($db);
$error=$db->error();
$error=$db->lasterror();
dol_syslog(get_class()."::listBoxes Error ".$error, LOG_ERR);
return array();
}
return $boxes;

View File

@ -59,13 +59,11 @@ class Menubase
*
* @param DoliDB $db Database handler
* @param string $menu_handler Menu handler
* @param string $type Type
*/
function __construct($db,$menu_handler='',$type='')
function __construct($db,$menu_handler='')
{
$this->db = $db;
$this->menu_handler = $menu_handler;
$this->type = $type;
return 1;
}
@ -434,7 +432,7 @@ class Menubase
$this->newmenu = $newmenu;
// Load datas from database into $tabMenu, later we will complete this->newmenu with values into $tabMenu
if (count($tabMenu) == 0)
if (count($tabMenu) == 0) // To avoid to read into database a second time
{
$this->menuLoad($mainmenu, $leftmenu, $type_user, $menu_handler, $tabMenu);
}
@ -535,7 +533,7 @@ class Menubase
// If type_user == 2, no test required
$sql.= " ORDER BY m.position, m.rowid";
dol_syslog(get_class($this)."::menuLeftCharger sql=".$sql);
dol_syslog(get_class($this)."::menuLoad mymainmenu=".$mymainmenu." myleftmenu=".$myleftmenu." type_user=".$type_user." menu_handler=".$menu_handler." tabMenu size=".count($tabMenu)." sql=".$sql);
$resql = $this->db->query($sql);
if ($resql)
{

View File

@ -169,7 +169,7 @@ class Translate
}
if ($this->defaultlang == 'none_NONE') return 0; // Special language code to not translate keys
//dol_syslog("Translate::Load Start domain=".$domain." alt=".$alt." forcelangdir=".$forcelangdir." this->defaultlang=".$this->defaultlang);
dol_syslog("Translate::Load Start domain=".$domain." alt=".$alt." forcelangdir=".$forcelangdir." this->defaultlang=".$this->defaultlang);
$newdomain = $domain;
$modulename = '';

View File

@ -473,8 +473,8 @@ function dol_strtoupper($utf8_string)
/**
* Write log message into outputs. Possible outputs can be:
* A file if SYSLOG_FILE_ON defined: file name is then defined by SYSLOG_FILE
* Syslog if SYSLOG_SYSLOG_ON defined: facility is then defined by SYSLOG_FACILITY
* SYSLOG_HANDLERS = ["mod_syslog_file"] file name is then defined by SYSLOG_FILE
* SYSLOG_HANDLERS = ["mod_syslog_syslog"] facility is then defined by SYSLOG_FACILITY
* Warning, syslog functions are bugged on Windows, generating memory protection faults. To solve
* this, use logging to files instead of syslog (see setup of module).
* Note: If SYSLOG_FILE_NO_ERROR defined, we never output any error message when writing to log fails.

View File

@ -42,8 +42,8 @@ function print_smartphone_menu($db,$atarget,$type_user,$limitmenuto)
$tabMenu=array();
$menutop = new Menubase($db,'smartphone','top');
$menuleft = new Menubase($db,'smartphone','left');
$menutop = new Menubase($db,'smartphone');
$menuleft = new Menubase($db,'smartphone');
$newTabMenu = $menutop->menuTopCharger('', '', $type_user, 'smartphone',$tabMenu);
$numTabMenu = count($newTabMenu);

View File

@ -46,7 +46,7 @@ function print_auguria_menu($db,$atarget,$type_user)
$listofmodulesforexternal=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL);
$tabMenu=array();
$menuArbo = new Menubase($db,'auguria','top');
$menuArbo = new Menubase($db,'auguria');
$newTabMenu = $menuArbo->menuTopCharger('', '', $type_user, 'auguria',$tabMenu);
print_start_menu_array_auguria();
@ -259,7 +259,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after)
require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
$tabMenu=array();
$menuArbo = new Menubase($db,'auguria','left');
$menuArbo = new Menubase($db,'auguria');
$newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,($user->societe_id?1:0),'auguria',$tabMenu);
//var_dump($newmenu);
}

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008-2013 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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,78 +31,49 @@
/**
* Classe permettant la gestion du menu du haut Auguria
*/
class MenuTop
class MenuManager
{
var $db;
var $require_left=array("auguria_backoffice"); // Si doit etre en phase avec un gestionnaire de menu gauche particulier
var $type_user=0; // Put 0 for internal users, 1 for external users
var $atarget=""; // Valeur du target a utiliser dans les liens
var $menu_array;
var $menu_array_after;
/**
/**
* Constructor
*
* @param DoliDb $db Database handler
*/
function __construct($db)
{
$this->db=$db;
}
/**
* Show menu
*
* @return void
*/
function showmenu()
{
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria.lib.php';
print_auguria_menu($this->db,$this->atarget,$this->type_user);
}
}
/**
* Classe permettant la gestion du menu du gauche Auguria
*/
class MenuLeft
{
var $db;
var $menu_array;
var $menu_array_after;
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param array &$menu_array Table of menu entries to show before entries of menu handler
* @param array &$menu_array_after Table of menu entries to show after entries of menu handler
*/
function __construct($db,&$menu_array,&$menu_array_after)
function __construct($db, &$menu_array, &$menu_array_after)
{
$this->db=$db;
$this->menu_array=$menu_array;
$this->menu_array_after=$menu_array_after;
}
/**
* Show menu
* Show menu
*
* @return int Number of menu entries shown
* @param string $mode 'top' or 'left'
* @return int Number of menu entries shown
*/
function showmenu()
function showmenu($mode)
{
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria.lib.php';
$res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after);
$res='ErrorBadParameterForMode';
if ($mode == 'top') $res=print_auguria_menu($this->db,$this->atarget,$this->type_user);
if ($mode == 'left') $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after);
return $res;
}
}
}
?>

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008-2013 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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,7 +31,7 @@
/**
* Classe permettant la gestion du menu du haut Auguria
*/
class MenuTop
class MenuManager
{
var $db;
var $require_left=array("auguria_backoffice"); // Si doit etre en phase avec un gestionnaire de menu gauche particulier
@ -39,43 +39,10 @@ class MenuTop
var $atarget=""; // Valeur du target a utiliser dans les liens
/**
* Constructor
*
* @param DoliDb $db Database handler
*/
function __construct($db)
{
$this->db=$db;
}
/**
* Show menu
*
* @return void
*/
function showmenu()
{
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria.lib.php';
print_auguria_menu($this->db,$this->atarget,$this->type_user);
}
}
/**
* Classe permettant la gestion du menu du gauche Auguria
*/
class MenuLeft
{
var $db;
var $menu_array;
var $menu_array_after;
var $menu_array;
var $menu_array_after;
/**
* Constructor
*
@ -83,27 +50,32 @@ class MenuLeft
* @param array &$menu_array Table of menu entries to show before entries of menu handler
* @param array &$menu_array_after Table of menu entries to show after entries of menu handler
*/
function __construct($db,&$menu_array,&$menu_array_after)
function __construct($db, &$menu_array, &$menu_array_after)
{
$this->db=$db;
$this->menu_array=$menu_array;
$this->menu_array_after=$menu_array_after;
}
/**
* Show menu
*
* @return int Number of menu entries shown
*/
function showmenu()
{
* @param string $mode 'top' or 'left'
* @return int Number of menu entries shown
*/
function showmenu($mode)
{
global $conf;
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria.lib.php';
$res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after);
$conf->global->MAIN_SEARCHFORM_SOCIETE=0;
$conf->global->MAIN_SEARCHFORM_CONTACT=0;
$res='ErrorBadParameterForMode';
if ($mode == 'top') $res=print_auguria_menu($this->db,$this->atarget,$this->type_user);
if ($mode == 'left') $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after);
return $res;
}

View File

@ -443,8 +443,8 @@ function print_eldy_menu($db,$atarget,$type_user)
require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
$tabMenu=array();
$menuArbo = new Menubase($db,'eldy','top');
$newTabMenu = $menuArbo->menuTopCharger('','',$type_user,'eldy',$tabMenu);
$menuArbo = new Menubase($db,'eldy');
$newTabMenu = $menuArbo->menuTopCharger('','',$type_user,'eldy',$tabMenu); // Return tabMenu with only top entries
$num = count($newTabMenu);
for($i = 0; $i < $num; $i++)
@ -1362,7 +1362,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
$tabMenu=array();
$menuArbo = new Menubase($db,'eldy','left');
$menuArbo = new Menubase($db,'eldy');
$newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,(empty($user->societe_id)?0:1),'eldy',$tabMenu);
}

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007-2010 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
@ -28,49 +28,15 @@
/**
* Class to manage top menu Eldy (for internal users)
* Classe to manage menu Eldy
*/
class MenuTop
class MenuManager
{
var $db;
var $require_left=array("eldy_backoffice"); // Si doit etre en phase avec un gestionnaire de menu gauche particulier
var $type_user=0; // Put 0 for internal users, 1 for external users
var $atarget=""; // Valeur du target a utiliser dans les liens
/**
* Constructor
*
* @param DoliDb $db Database handler
*/
function __construct($db)
{
$this->db=$db;
}
/**
* Show menu
*
* @return void
*/
function showmenu()
{
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy.lib.php';
print_eldy_menu($this->db,$this->atarget,$this->type_user);
}
}
/**
* \class MenuLeft
* \brief Classe permettant la gestion du menu du gauche Eldy
*/
class MenuLeft
{
var $db;
var $menu_array;
var $menu_array_after;
@ -82,7 +48,7 @@ class MenuLeft
* @param array &$menu_array Table of menu entries to show before entries of menu handler
* @param array &$menu_array_after Table of menu entries to show after entries of menu handler
*/
function __construct($db,&$menu_array,&$menu_array_after)
function __construct($db, &$menu_array, &$menu_array_after)
{
$this->db=$db;
$this->menu_array=$menu_array;
@ -93,13 +59,16 @@ class MenuLeft
/**
* Show menu
*
* @return int Number of menu entries shown
* @param string $mode 'top' or 'left'
* @return int Number of menu entries shown
*/
function showmenu()
function showmenu($mode)
{
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy.lib.php';
$res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after);
$res='ErrorBadParameterForMode';
if ($mode == 'top') $res=print_eldy_menu($this->db,$this->atarget,$this->type_user);
if ($mode == 'left') $res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after);
return $res;
}

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007-2009 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
@ -28,48 +28,15 @@
/**
* Class to manage top menu Eldy (for external users)
* Class to manage menu Eldy (for external users)
*/
class MenuTop
class MenuManager
{
var $db;
var $require_left=array("eldy_frontoffice"); // Si doit etre en phase avec un gestionnaire de menu gauche particulier
var $type_user=1; // Put 0 for internal users, 1 for external users
var $atarget=""; // Valeur du target a utiliser dans les liens
/**
* Constructor
*
* @param DoliDb $db Database handler
*/
function __construct($db)
{
$this->db=$db;
}
/**
* Show menu
*
* @return void
*/
function showmenu()
{
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy.lib.php';
print_eldy_menu($this->db,$this->atarget,$this->type_user);
}
}
/**
* Classe permettant la gestion du menu du gauche Eldy
*/
class MenuLeft
{
var $db;
var $menu_array;
var $menu_array_after;
@ -92,17 +59,22 @@ class MenuLeft
/**
* Show menu
*
* @param string $mode 'top' or 'left'
* @return int Number of menu entries shown
*/
function showmenu()
function showmenu($mode)
{
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy.lib.php';
global $conf;
$res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after);
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy.lib.php';
$conf->global->MAIN_SEARCHFORM_SOCIETE=0;
$conf->global->MAIN_SEARCHFORM_CONTACT=0;
$res='ErrorBadParameterForMode';
if ($mode == 'top') $res=print_eldy_menu($this->db,$this->atarget,$this->type_user);
if ($mode == 'left') $res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after);
return $res;
}

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -21,56 +21,156 @@
*/
/**
* \class MenuTop
* \brief Class for top empty menu
* Class to manage empty menu
*/
class MenuTop
class MenuManager
{
var $db;
var $require_left=array("empty"); // If this top menu handler must be used with a particular left menu handler
var $require_left=array("empty"); // If this top menu handler must be used with a particular left menu handler
var $type_user=0; // Put 0 for internal users, 1 for external users
var $atarget=""; // To store arget to use in menu links
var $atarget=""; // To store arget to use in menu links
var $menu_array;
var $menu_array_after;
/**
* Constructor
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
$this->db=$db;
}
* @param DoliDB $db Database handler
* @param array &$menu_array Table of menu entries to show before entries of menu handler
* @param array &$menu_array_after Table of menu entries to show after entries of menu handler
*/
function __construct($db, &$menu_array, &$menu_array_after)
{
$this->db=$db;
$this->menu_array=$menu_array;
$this->menu_array_after=$menu_array_after;
}
/**
* Show menu
*
* @return void
*/
function showmenu()
{
global $user,$conf,$langs,$dolibarr_main_db_name;
/**
* Show menu
*
* @param string $mode 'top' or 'left'
* @return void
*/
function showmenu($mode)
{
global $user,$conf,$langs,$dolibarr_main_db_name;
print_start_menu_array_empty();
if ($mode == 'top')
{
print_start_menu_array_empty();
$idsel='home';
$classname='class="tmenu"';
$idsel='home';
$classname='class="tmenu"';
print_start_menu_entry_empty($idsel);
print '<a class="tmenuimage" href="'.dol_buildpath('/index.php',1).'?mainmenu=home&amp;leftmenu="'.($this->atarget?' target="'.$this->atarget.'"':'').'>';
print '<div class="mainmenu '.$idsel.'"><span class="mainmenu_'.$idsel.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
print '</a>';
print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.DOL_URL_ROOT.'"'.($this->atarget?' target="'.$this->atarget.'"':'').'>';
print_text_menu_entry_empty($langs->trans("Home"));
print '</a>';
print_end_menu_entry_empty();
print_start_menu_entry_empty($idsel);
print '<a class="tmenuimage" href="'.dol_buildpath('/index.php',1).'?mainmenu=home&amp;leftmenu="'.($this->atarget?' target="'.$this->atarget.'"':'').'>';
print '<div class="mainmenu '.$idsel.'"><span class="mainmenu_'.$idsel.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
print '</a>';
print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.DOL_URL_ROOT.'"'.($this->atarget?' target="'.$this->atarget.'"':'').'>';
print_text_menu_entry_empty($langs->trans("Home"));
print '</a>';
print_end_menu_entry_empty();
print_end_menu_array_empty();
}
print_end_menu_array_empty();
}
if ($mode == 'left')
{
$newmenu = new Menu();
// Put here left menu entries
// ***** START *****
$langs->load("admin"); // Load translation file admin.lang
$newmenu->add("/admin/index.php?leftmenu=setup", $langs->trans("Setup"),0);
$newmenu->add("/admin/company.php", $langs->trans("MenuCompanySetup"),1);
$newmenu->add("/admin/modules.php", $langs->trans("Modules"),1);
$newmenu->add("/admin/menus.php", $langs->trans("Menus"),1);
$newmenu->add("/admin/ihm.php", $langs->trans("GUISetup"),1);
$newmenu->add("/admin/boxes.php", $langs->trans("Boxes"),1);
$newmenu->add("/admin/delais.php",$langs->trans("Alerts"),1);
$newmenu->add("/admin/proxy.php?mainmenu=home", $langs->trans("Security"),1);
$newmenu->add("/admin/limits.php?mainmenu=home", $langs->trans("MenuLimits"),1);
$newmenu->add("/admin/pdf.php?mainmenu=home", $langs->trans("PDF"),1);
$newmenu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails"),1);
$newmenu->add("/admin/sms.php?mainmenu=home", $langs->trans("SMS"),1);
$newmenu->add("/admin/dict.php?mainmenu=home", $langs->trans("DictionnarySetup"),1);
$newmenu->add("/admin/const.php?mainmenu=home", $langs->trans("OtherSetup"),1);
// ***** END *****
// do not change code after this
// override menu_array by value array in $newmenu
$this->menu_array=$newmenu->liste;
$alt=0;
$num=count($this->menu_array);
for ($i = 0; $i < $num; $i++)
{
$alt++;
if (empty($this->menu_array[$i]['level']))
{
if (($alt%2==0))
{
print '<div class="blockvmenuimpair">'."\n";
}
else
{
print '<div class="blockvmenupair">'."\n";
}
}
// Place tabulation
$tabstring='';
$tabul=($this->menu_array[$i]['level'] - 1);
if ($tabul > 0)
{
for ($j=0; $j < $tabul; $j++)
{
$tabstring.='&nbsp; &nbsp;';
}
}
if ($this->menu_array[$i]['level'] == 0) {
if ($this->menu_array[$i]['enabled'])
{
print '<div class="menu_titre">'.$tabstring.'<a class="vmenu" href="'.dol_buildpath($this->menu_array[$i]['url'],1).'"'.($this->menu_array[$i]['target']?' target="'.$this->menu_array[$i]['target'].'"':'').'>'.$this->menu_array[$i]['titre'].'</a></div>'."\n";
}
else
{
print '<div class="menu_titre">'.$tabstring.'<font class="vmenudisabled">'.$this->menu_array[$i]['titre'].'</font></div>'."\n";
}
print '<div class="menu_top"></div>'."\n";
}
if ($this->menu_array[$i]['level'] > 0) {
print '<div class="menu_contenu">';
if ($this->menu_array[$i]['enabled'])
print $tabstring.'<a class="vsmenu" href="'.dol_buildpath($this->menu_array[$i]['url'],1).'">'.$this->menu_array[$i]['titre'].'</a><br>';
else
print $tabstring.'<font class="vsmenudisabled">'.$this->menu_array[$i]['titre'].'</font><br>';
print '</div>'."\n";
}
// If next is a new block or end
if (empty($this->menu_array[$i+1]['level']))
{
print '<div class="menu_end"></div>'."\n";
print "</div>\n";
}
}
}
}
}
/**
* Output menu entry
*
@ -136,127 +236,4 @@ function print_end_menu_array_empty()
print "\n";
}
/**
* Class for left empty menu
*/
class MenuLeft
{
var $db;
var $menu_array;
var $menu_array_after;
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param array &$menu_array Table of menu entries to show before entries of menu handler
* @param array &$menu_array_after Table of menu entries to show after entries of menu handler
*/
function __construct($db,&$menu_array,&$menu_array_after)
{
$this->db=$db;
$this->menu_array=$menu_array;
$this->menu_array_after=$menu_array_after;
}
/**
* Show menu
*
* @return void
*/
function showmenu()
{
global $user,$conf,$langs,$dolibarr_main_db_name;
$newmenu = new Menu();
// Put here left menu entries
// ***** START *****
$langs->load("admin"); // Load translation file admin.lang
$newmenu->add("/admin/index.php?leftmenu=setup", $langs->trans("Setup"),0);
$newmenu->add("/admin/company.php", $langs->trans("MenuCompanySetup"),1);
$newmenu->add("/admin/modules.php", $langs->trans("Modules"),1);
$newmenu->add("/admin/menus.php", $langs->trans("Menus"),1);
$newmenu->add("/admin/ihm.php", $langs->trans("GUISetup"),1);
$newmenu->add("/admin/boxes.php", $langs->trans("Boxes"),1);
$newmenu->add("/admin/delais.php",$langs->trans("Alerts"),1);
$newmenu->add("/admin/perms.php", $langs->trans("Security"),1);
$newmenu->add("/admin/mails.php", $langs->trans("EMails"),1);
$newmenu->add("/admin/limits.php", $langs->trans("Limits"),1);
$newmenu->add("/admin/dict.php", $langs->trans("DictionnarySetup"),1);
$newmenu->add("/admin/const.php", $langs->trans("OtherSetup"),1);
// ***** END *****
// do not change code after this
// override menu_array by value array in $newmenu
$this->menu_array=$newmenu->liste;
$alt=0;
$num=count($this->menu_array);
for ($i = 0; $i < $num; $i++)
{
$alt++;
if (empty($this->menu_array[$i]['level']))
{
if (($alt%2==0))
{
print '<div class="blockvmenuimpair">'."\n";
}
else
{
print '<div class="blockvmenupair">'."\n";
}
}
// Place tabulation
$tabstring='';
$tabul=($this->menu_array[$i]['level'] - 1);
if ($tabul > 0)
{
for ($j=0; $j < $tabul; $j++)
{
$tabstring.='&nbsp; &nbsp;';
}
}
if ($this->menu_array[$i]['level'] == 0) {
if ($this->menu_array[$i]['enabled'])
{
print '<div class="menu_titre">'.$tabstring.'<a class="vmenu" href="'.dol_buildpath($this->menu_array[$i]['url'],1).'"'.($this->menu_array[$i]['target']?' target="'.$this->menu_array[$i]['target'].'"':'').'>'.$this->menu_array[$i]['titre'].'</a></div>'."\n";
}
else
{
print '<div class="menu_titre">'.$tabstring.'<font class="vmenudisabled">'.$this->menu_array[$i]['titre'].'</font></div>'."\n";
}
print '<div class="menu_top"></div>'."\n";
}
if ($this->menu_array[$i]['level'] > 0) {
print '<div class="menu_contenu">';
if ($this->menu_array[$i]['enabled'])
print $tabstring.'<a class="vsmenu" href="'.dol_buildpath($this->menu_array[$i]['url'],1).'">'.$this->menu_array[$i]['titre'].'</a><br>';
else
print $tabstring.'<font class="vsmenudisabled">'.$this->menu_array[$i]['titre'].'</font><br>';
print '</div>'."\n";
}
// If next is a new block or end
if (empty($this->menu_array[$i+1]['level']))
{
print '<div class="menu_end"></div>'."\n";
print "</div>\n";
}
}
}
}
?>

View File

@ -126,6 +126,7 @@ class modSociete extends DolibarrModules
$this->boxes[$r][1] = "box_contacts.php";
$r++;
$this->boxes[$r][1] = "box_activity.php";
$this->boxes[$r][2] = '(WarningUsingThisBoxSlowDown)';
$r++;
// Permissions

View File

@ -92,9 +92,9 @@ if (! empty($dolibarr_main_prod)) ini_set('display_errors','Off');
// Clean parameters
$dolibarr_main_data_root=trim($dolibarr_main_data_root);
$dolibarr_main_url_root=trim($dolibarr_main_url_root);
$dolibarr_main_url_root_alt=trim($dolibarr_main_url_root_alt);
$dolibarr_main_url_root_alt=(empty($dolibarr_main_url_root_alt)?'':trim($dolibarr_main_url_root_alt));
$dolibarr_main_document_root=trim($dolibarr_main_document_root);
$dolibarr_main_document_root_alt=trim($dolibarr_main_document_root_alt);
$dolibarr_main_document_root_alt=(empty($dolibarr_main_document_root_alt)?'':trim($dolibarr_main_document_root_alt));
if (empty($dolibarr_main_db_port)) $dolibarr_main_db_port=0; // Pour compatibilite avec anciennes configs, si non defini, on prend 'mysql'
if (empty($dolibarr_main_db_type)) $dolibarr_main_db_type='mysql'; // Pour compatibilite avec anciennes configs, si non defini, on prend 'mysql'

View File

@ -569,6 +569,8 @@ if ($user->admin && empty($conf->global->MAIN_REMOVE_INSTALL_WARNING))
}
}
//print 'mem='.memory_get_usage().' - '.memory_get_peak_usage();
llxFooter();
$db->close();

View File

@ -303,7 +303,7 @@ function conf($dolibarr_main_document_root)
// Force usage of log file for install and upgrades
$conf->syslog->enabled=1;
$conf->global->SYSLOG_LEVEL=constant('LOG_DEBUG');
if (! defined('SYSLOG_FILE_ON')) define('SYSLOG_FILE_ON',1);
if (! defined('SYSLOG_HANDLERS')) define('SYSLOG_HANDLERS','["mod_syslog_file"]');
if (! defined('SYSLOG_FILE')) // To avoid warning on systems with constant already defined
{
if (@is_writable('/tmp')) define('SYSLOG_FILE','/tmp/dolibarr_install.log');

View File

@ -85,6 +85,7 @@ INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ILS'
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'JMD', '[74,36]', 1, 'Jamaica Dollar');
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'JPY', '[165]', 1, 'Japan Yen');
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'JEP', '[163]', 1, 'Jersey Pound');
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KES', NULL, 1, 'Kenya Shilling');
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KZT', '[1083,1074]', 1, 'Kazakhstan Tenge');
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KPW', '[8361]', 1, 'Korea (North) Won');
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'KRW', '[8361]', 1, 'Korea (South) Won');

View File

@ -35,7 +35,7 @@ insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_N
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_FEATURES_LEVEL','0','chaine','Level of features to show (0=stable only, 1=stable+experimental, 2=stable+experimental+development',1,0);
-- Hidden and common to all entities
insert into llx_const (name, value, type, note, visible, entity) values ('SYSLOG_FILE_ON','1','chaine','Log to file Directory where to write log file',0,0);
insert into llx_const (name, value, type, note, visible, entity) values ('SYSLOG_HANDLERS','["mod_syslog_file"]','chaine','Which logger to use',0,0);
insert into llx_const (name, value, type, note, visible, entity) values ('SYSLOG_FILE','DOL_DATA_ROOT/dolibarr.log','chaine','Directory where to write log file',0,0);
insert into llx_const (name, value, type, note, visible, entity) values ('SYSLOG_LEVEL','7','chaine','Level of debug info to show',0,0);

View File

@ -129,4 +129,5 @@ WarningsOnXLines=Warnings on <b>%s</b> source lines
WarningNoDocumentModelActivated=No model, for document generation, has been activated. A model will be choosed by default until you check your module setup.
WarningLockFileDoesNotExists=Warning, once setup is finished, you must disable install/migrate tools by adding a file <b>install.lock</b> into directory <b>%s</b>. Missing this file is a security hole.
WarningUntilDirRemoved=All security warnings (visible by admin users only) will remain active as long as the vulnerability is present (or that constant MAIN_REMOVE_INSTALL_WARNING is added in Setup->Other setup).
WarningCloseAlways=Warning, closing is done even if amount differs between source and target elements. Enable this feature with caution.
WarningCloseAlways=Warning, closing is done even if amount differs between source and target elements. Enable this feature with caution.
WarningUsingThisBoxSlowDown=Warning, using this box slow down seriously all pages showing the box.

View File

@ -130,4 +130,5 @@ WarningsOnXLines=Alertes sur <b>%s</b> lignes sources
WarningNoDocumentModelActivated=Aucun modèle, pour la génération de document, n'a été activé. Un modèle sera pris par défaut en attendant la correction de configuration du module.
WarningLockFileDoesNotExists=Attention, une fois l'installation terminée, les outils d'installation/migration doivent être désactivés en ajoutant un fichier <b>install.lock</b> dans le répertoire <b>%s</b>. L'absence de ce fichier représente une faille de sécurité.
WarningUntilDirRemoved=Les alertes de sécurité sont visibles par les administrateurs uniquement et resteront actives tant que la vulnérabilité sera avérée (ou que la constante MAIN_REMOVE_INSTALL_WARNING aura été définie dans Configuration->Divers)
WarningCloseAlways=Attention, la fermeture se fait même lorsque le montant diffère. N'activez cette fonctionnalité qu'en connaissance de cause.
WarningCloseAlways=Attention, la fermeture se fait même lorsque le montant diffère. N'activez cette fonctionnalité qu'en connaissance de cause.
WarningUsingThisBoxSlowDown=Attention, l'utilisation de cette boite provoque de sérieux ralentissement des pages affichant cette boite.

View File

@ -1271,13 +1271,13 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
if (GETPOST('menu')) $top_menu=GETPOST('menu'); // menu=eldy_backoffice.php
// Load the top menu manager (only if not already done)
if (! class_exists('MenuTop'))
if (! class_exists('MenuManager'))
{
$menufound=0;
$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
foreach($dirmenus as $dirmenu)
{
$menufound=dol_include_once($dirmenu."standard/".$top_menu);
$menufound=dol_include_once($dirmenu."standard/".$top_menu);
if ($menufound) break;
}
if (! $menufound) // If failed to include, we try with standard
@ -1296,9 +1296,10 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
print '<div id="tmenu_tooltip" class="tmenu">'."\n";
// Show menu
$menutop = new MenuTop($db);
$dummy1=array();$dummy2=array();
$menutop = new MenuManager($db,$dummy1,$dummy2);
$menutop->atarget=$target;
$menutop->showmenu(); // This contains a \n
$menutop->showmenu('top'); // This contains a \n
print "</div>\n";
@ -1483,8 +1484,8 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
$left_menu=empty($conf->browser->phone)?$conf->top_menu:$conf->smart_menu;
if (GETPOST('menu')) $left_menu=GETPOST('menu'); // menu=eldy_backoffice.php
// Load the top menu manager (only if not already done)
if (! class_exists('MenuLeft'))
// Load the menu manager (only if not already done)
if (! class_exists('MenuManager'))
{
$menufound=0;
$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
@ -1505,8 +1506,8 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
print '<div class="vmenu">'."\n";
$menuleft=new MenuLeft($db,$menu_array_before,$menu_array_after);
$menuleft->showmenu(); // output menu_array and menu found in database
$menuleft=new MenuManager($db,$menu_array_before,$menu_array_after);
$menuleft->showmenu('left'); // output menu_array and menu found in database
// Show other forms

View File

@ -56,9 +56,14 @@ if (! empty($user->societe_id)) $socid=$user->societe_id;
$object = new Product($db);
$extrafields = new ExtraFields($db);
if ($id > 0 || ! empty($ref))
{
$object = new Product($db);
$object->fetch($id, $ref);
}
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$object->getCanvas($id,$ref);
$canvas = $object->canvas?$object->canvas:GETPOST("canvas");
$canvas = !empty($object->canvas)?$object->canvas:GETPOST("canvas");
$objcanvas='';
if (! empty($canvas))
{
@ -92,7 +97,6 @@ if (empty($reshook))
// Type
if ($action == 'setfk_product_type' && $user->rights->produit->creer)
{
$object->fetch($id);
$result = $object->setValueFrom('fk_product_type', GETPOST('fk_product_type'));
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
@ -101,7 +105,6 @@ if (empty($reshook))
// Barcode type
if ($action == 'setfk_barcode_type' && $user->rights->barcode->creer)
{
$object->fetch($id);
$result = $object->setValueFrom('fk_barcode_type', GETPOST('fk_barcode_type'));
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
@ -110,7 +113,6 @@ if (empty($reshook))
// Barcode value
if ($action == 'setbarcode' && $user->rights->barcode->creer)
{
$object->fetch($id);
//Todo: ajout verification de la validite du code barre en fonction du type
$result = $object->setValueFrom('barcode', GETPOST('barcode'));
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
@ -119,23 +121,17 @@ if (empty($reshook))
if ($action == 'setaccountancy_code_buy')
{
$object->fetch($id,$ref);
$result = $object->setValueFrom('accountancy_code_buy', GETPOST('accountancy_code_buy'));
if ($result < 0)
{
$mesg=join(',',$object->errors);
}
setEventMessage(join(',',$object->errors), 'errors');
$action="";
}
if ($action == 'setaccountancy_code_sell')
{
$object->fetch($id,$ref);
$result = $object->setValueFrom('accountancy_code_sell', GETPOST('accountancy_code_sell'));
if ($result < 0)
{
$mesg=join(',',$object->errors);
}
setEventMessage(join(',',$object->errors), 'errors');
$action="";
}
@ -146,13 +142,13 @@ if (empty($reshook))
if (! GETPOST('libelle'))
{
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Label')).'</div>';
setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('Label')), 'errors');
$action = "create";
$error++;
}
if (empty($ref))
{
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Ref')).'</div>';
setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('Ref')), 'errors');
$action = "create";
$error++;
}
@ -162,10 +158,16 @@ if (empty($reshook))
$object->ref = $ref;
$object->libelle = GETPOST('libelle');
$object->price_base_type = GETPOST('price_base_type');
if ($object->price_base_type == 'TTC') $object->price_ttc = GETPOST('price');
else $object->price = GETPOST('price');
if ($object->price_base_type == 'TTC') $object->price_min_ttc = GETPOST('price_min');
else $object->price_min = GETPOST('price_min');
if ($object->price_base_type == 'TTC')
$object->price_ttc = GETPOST('price');
else
$object->price = GETPOST('price');
if ($object->price_base_type == 'TTC')
$object->price_min_ttc = GETPOST('price_min');
else
$object->price_min = GETPOST('price_min');
$object->tva_tx = str_replace('*','',GETPOST('tva_tx'));
$object->tva_npr = preg_match('/\*/',GETPOST('tva_tx'))?1:0;
@ -230,7 +232,7 @@ if (empty($reshook))
}
else
{
$mesg='<div class="error">'.$langs->trans($object->error).'</div>';
setEventMessage($langs->trans($object->error), 'errors');
$action = "create";
}
}
@ -245,7 +247,7 @@ if (empty($reshook))
}
else
{
if ($object->fetch($id,$ref))
if ($object->id > 0)
{
$object->oldcopy=dol_clone($object);
@ -289,14 +291,14 @@ if (empty($reshook))
}
else
{
setEventMessage($langs->trans($object->error), 'errors');
$action = 'edit';
$mesg = $object->error;
}
}
else
{
setEventMessage($langs->trans("ErrorProductBadRefOrLabel"), 'errors');
$action = 'edit';
$mesg = $langs->trans("ErrorProductBadRefOrLabel");
}
}
@ -309,14 +311,14 @@ if (empty($reshook))
{
if (! GETPOST('clone_content') && ! GETPOST('clone_prices') )
{
$mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>';
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
}
else
{
$db->begin();
$originalId = $id;
if ($object->fetch($id,$ref) > 0)
if ($object->id > 0)
{
$object->ref = GETPOST('clone_ref');
$object->status = 0;
@ -351,12 +353,13 @@ if (empty($reshook))
$mesg='<div class="error">'.$langs->trans("ErrorProductAlreadyExists",$object->ref);
$mesg.=' <a href="'.$_SERVER["PHP_SELF"].'?ref='.$object->ref.'">'.$langs->trans("ShowCardHere").'</a>.';
$mesg.='</div>';
setEventMessage($mesg, 'errors');
//dol_print_error($object->db);
}
else
{
$db->rollback();
$mesg=$object->error;
setEventMessage($langs->trans($object->error), 'errors');
dol_print_error($db,$object->error);
}
}
@ -374,10 +377,7 @@ if (empty($reshook))
if ($action == 'confirm_delete' && $confirm != 'yes') { $action=''; }
if ($action == 'confirm_delete' && $confirm == 'yes')
{
$object = new Product($db);
$object->fetch($id,$ref);
if ( ($object->type == 0 && $user->rights->produit->supprimer) || ($object->type == 1 && $user->rights->service->supprimer) )
if (($object->type == 0 && $user->rights->produit->supprimer) || ($object->type == 1 && $user->rights->service->supprimer))
{
$result = $object->delete($object->id);
}
@ -389,7 +389,7 @@ if (empty($reshook))
}
else
{
$mesg=$object->error;
setEventMessage($langs->trans($object->error), 'errors');
$reload = 0;
$action='';
}
@ -397,7 +397,7 @@ if (empty($reshook))
// Add product into proposal
if ($action == 'addinpropal')
if ($object->id > 0 && $action == 'addinpropal')
{
$propal = new Propal($db);
$result=$propal->fetch(GETPOST('propalid'));
@ -415,35 +415,27 @@ if (empty($reshook))
exit;
}
$prod = new Product($db);
$result=$prod->fetch($id,$ref);
if ($result <= 0)
{
dol_print_error($db,$prod->error);
exit;
}
$desc = $object->description;
$desc = $prod->description;
$tva_tx = get_default_tva($mysoc, $soc, $prod->id);
$tva_tx = get_default_tva($mysoc, $soc, $object->id);
$localtax1_tx= get_localtax($tva_tx, 1, $soc);
$localtax2_tx= get_localtax($tva_tx, 2, $soc);
$pu_ht = $prod->price;
$pu_ttc = $prod->price_ttc;
$price_base_type = $prod->price_base_type;
$pu_ht = $object->price;
$pu_ttc = $object->price_ttc;
$price_base_type = $object->price_base_type;
// If multiprice
if ($conf->global->PRODUIT_MULTIPRICES && $soc->price_level)
{
$pu_ht = $prod->multiprices[$soc->price_level];
$pu_ttc = $prod->multiprices_ttc[$soc->price_level];
$price_base_type = $prod->multiprices_base_type[$soc->price_level];
$pu_ht = $object->multiprices[$soc->price_level];
$pu_ttc = $object->multiprices_ttc[$soc->price_level];
$price_base_type = $object->multiprices_base_type[$soc->price_level];
}
// On reevalue prix selon taux tva car taux tva transaction peut etre different
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
if ($tva_tx != $prod->tva_tx)
if ($tva_tx != $object->tva_tx)
{
if ($price_base_type != 'HT')
{
@ -463,7 +455,7 @@ if (empty($reshook))
$tva_tx,
$localtax1_tx, // localtax1
$localtax2_tx, // localtax2
$prod->id,
$object->id,
GETPOST('remise_percent'),
$price_base_type,
$pu_ttc
@ -474,11 +466,11 @@ if (empty($reshook))
return;
}
$mesg = $langs->trans("ErrorUnknown").": $result";
setEventMessage($langs->trans("ErrorUnknown").": $result", 'errors');
}
// Add product into order
if ($action == 'addincommande')
if ($object->id > 0 && $action == 'addincommande')
{
$commande = new Commande($db);
$result=$commande->fetch(GETPOST('commandeid'));
@ -496,36 +488,28 @@ if (empty($reshook))
exit;
}
$prod = new Product($db);
$result=$prod->fetch($id,$ref);
if ($result <= 0)
{
dol_print_error($db,$prod->error);
exit;
}
$desc = $object->description;
$desc = $prod->description;
$tva_tx = get_default_tva($mysoc, $soc, $prod->id);
$tva_tx = get_default_tva($mysoc, $soc, $object->id);
$localtax1_tx= get_localtax($tva_tx, 1, $soc);
$localtax2_tx= get_localtax($tva_tx, 2, $soc);
$pu_ht = $prod->price;
$pu_ttc = $prod->price_ttc;
$price_base_type = $prod->price_base_type;
$pu_ht = $object->price;
$pu_ttc = $object->price_ttc;
$price_base_type = $object->price_base_type;
// If multiprice
if ($conf->global->PRODUIT_MULTIPRICES && $soc->price_level)
{
$pu_ht = $prod->multiprices[$soc->price_level];
$pu_ttc = $prod->multiprices_ttc[$soc->price_level];
$price_base_type = $prod->multiprices_base_type[$soc->price_level];
$pu_ht = $object->multiprices[$soc->price_level];
$pu_ttc = $object->multiprices_ttc[$soc->price_level];
$price_base_type = $object->multiprices_base_type[$soc->price_level];
}
// On reevalue prix selon taux tva car taux tva transaction peut etre different
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
if ($tva_tx != $prod->tva_tx)
if ($tva_tx != $object->tva_tx)
{
if ($price_base_type != 'HT')
{
@ -545,7 +529,7 @@ if (empty($reshook))
$tva_tx,
$localtax1_tx, // localtax1
$localtax2_tx, // localtax2
$prod->id,
$object->id,
GETPOST('remise_percent'),
'',
'',
@ -561,7 +545,7 @@ if (empty($reshook))
}
// Add product into invoice
if ($action == 'addinfacture' && $user->rights->facture->creer)
if ($object->id > 0 && $action == 'addinfacture' && $user->rights->facture->creer)
{
$facture = New Facture($db);
$result=$facture->fetch(GETPOST('factureid'));
@ -579,35 +563,27 @@ if (empty($reshook))
exit;
}
$prod = new Product($db);
$result = $prod->fetch($id,$ref);
if ($result <= 0)
{
dol_print_error($db,$prod->error);
exit;
}
$desc = $object->description;
$desc = $prod->description;
$tva_tx = get_default_tva($mysoc, $soc, $prod->id);
$tva_tx = get_default_tva($mysoc, $soc, $object->id);
$localtax1_tx= get_localtax($tva_tx, 1, $soc);
$localtax2_tx= get_localtax($tva_tx, 2, $soc);
$pu_ht = $prod->price;
$pu_ttc = $prod->price_ttc;
$price_base_type = $prod->price_base_type;
$pu_ht = $object->price;
$pu_ttc = $object->price_ttc;
$price_base_type = $object->price_base_type;
// If multiprice
if ($conf->global->PRODUIT_MULTIPRICES && $soc->price_level)
{
$pu_ht = $prod->multiprices[$soc->price_level];
$pu_ttc = $prod->multiprices_ttc[$soc->price_level];
$price_base_type = $prod->multiprices_base_type[$soc->price_level];
$pu_ht = $object->multiprices[$soc->price_level];
$pu_ttc = $object->multiprices_ttc[$soc->price_level];
$price_base_type = $object->multiprices_base_type[$soc->price_level];
}
// On reevalue prix selon taux tva car taux tva transaction peut etre different
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
if ($tva_tx != $prod->tva_tx)
if ($tva_tx != $object->tva_tx)
{
if ($price_base_type != 'HT')
{
@ -627,7 +603,7 @@ if (empty($reshook))
$tva_tx,
$localtax1_tx,
$localtax2_tx,
$prod->id,
$object->id,
GETPOST('remise_percent'),
'',
'',
@ -649,7 +625,7 @@ if (empty($reshook))
if (GETPOST("cancel") == $langs->trans("Cancel"))
{
$action = '';
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id);
exit;
}
@ -677,15 +653,10 @@ $formproduct = new FormProduct($db);
if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
{
// -----------------------------------------
// When used with CANVAS
// When used with CANVAS (more simple)
// -----------------------------------------
if (empty($object->error) && ($id || $ref))
{
$object = new Product($db);
$object->fetch($id, $ref);
}
$objcanvas->assign_values($action, $object->id, $ref); // Set value for templates
$objcanvas->display_canvas($action); // Show template
$objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates
$objcanvas->display_canvas($action); // Show template
}
else
{
@ -717,8 +688,6 @@ else
else $title=$langs->trans("NewProduct");
print_fiche_titre($title);
dol_htmloutput_mesg($mesg);
print '<table class="border" width="100%">';
print '<tr>';
$tmpcode='';
@ -887,10 +856,8 @@ else
* Product card
*/
else if ($id || $ref)
else if ($object->id > 0)
{
$res=$object->fetch($id,$ref);
if ($res < 0) { dol_print_error($db,$object->error); exit; }
$res=$object->fetch_optionals($object->id,$extralabels);
// Fiche en mode edition
@ -903,8 +870,6 @@ else
if ($object->isservice()) $type = $langs->trans('Service');
print_fiche_titre($langs->trans('Modify').' '.$type.' : '.$object->ref, "");
dol_htmloutput_errors($mesg);
// Main official, simple, and not duplicated code
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">'."\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -1066,8 +1031,6 @@ else
// Fiche en mode visu
else
{
dol_htmloutput_mesg($mesg);
$head=product_prepare_head($object, $user);
$titre=$langs->trans("CardProduct".$object->type);
$picto=($object->type==1?'service':'product');

View File

@ -777,7 +777,7 @@ if (($action == 'create') || ($action == 'adduserldap'))
$password=$generated_password;
// Mot de passe
print '<tr><td valign="top">'.$langs->trans("Password").'</td>';
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Password").'</td>';
print '<td>';
if (! empty($ldap_sid))
{