Qual: Uniformize code (navigation on objects)

Qual: Code to support filter on entity on objects navigation is simpler.
This commit is contained in:
Laurent Destailleur 2009-10-04 12:16:45 +00:00
parent c1ab2cd23b
commit bbcefa8864
30 changed files with 320 additions and 191 deletions

View File

@ -18,11 +18,11 @@
*/ */
/** /**
\file htdocs/comm/propal/contact.php * \file htdocs/comm/propal/contact.php
\ingroup propal * \ingroup propal
\brief Onglet de gestion des contacts de propal * \brief Onglet de gestion des contacts de propal
\version $Id$ * \version $Id$
*/ */
require ("./pre.inc.php"); require ("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
@ -162,11 +162,12 @@ $contactstatic=new Contact($db);
/* *************************************************************************** */ /* *************************************************************************** */
if (isset($mesg)) print $mesg; if (isset($mesg)) print $mesg;
$id = $_GET["propalid"]; $id = $_GET['propalid'];
if ($id > 0) $ref= $_GET['ref'];
if ($id > 0 || ! empty($ref))
{ {
$propal = New Propal($db); $propal = New Propal($db);
if ( $propal->fetch($_GET['propalid']) > 0) if ( $propal->fetch($id,$ref) > 0)
{ {
$soc = new Societe($db, $propal->socid); $soc = new Societe($db, $propal->socid);
$soc->fetch($propal->socid); $soc->fetch($propal->socid);
@ -181,10 +182,12 @@ if ($id > 0)
*/ */
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
$linkback="<a href=\"".$_SERVER["PHP_SELF"]."?page=$page&socid=$socid&viewstatut=$viewstatut&sortfield=$sortfield&$sortorder\">".$langs->trans("BackToList")."</a>";
// Ref // Ref
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">'; print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
print $propal->ref; print $html->showrefnav($propal,'ref',$linkback,1,'ref','ref','');
print "</td></tr>"; print '</td></tr>';
// Ref client // Ref client
print '<tr><td>'; print '<tr><td>';

View File

@ -20,11 +20,11 @@
*/ */
/** /**
\file htdocs/comm/propal/document.php * \file htdocs/comm/propal/document.php
\ingroup propale * \ingroup propale
\brief Page de gestion des documents attach<EFBFBD>es <EFBFBD> une proposition commerciale * \brief Page de gestion des documents attach<EFBFBD>es <EFBFBD> une proposition commerciale
\version $Id$ * \version $Id$
*/ */
require('./pre.inc.php'); require('./pre.inc.php');
require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
@ -109,15 +109,19 @@ if ($action=='delete')
/* /*
* Affichage * View
*/ */
llxHeader(); llxHeader();
if ($propalid > 0) $html = new Form($db);
$id = $_GET['propalid'];
$ref= $_GET['ref'];
if ($id > 0 || ! empty($ref))
{ {
$propal = new Propal($db); $propal = new Propal($db);
if ($propal->fetch($propalid)) if ($propal->fetch($id,$ref))
{ {
$upload_dir = $conf->propale->dir_output.'/'.dol_sanitizeFileName($propal->ref); $upload_dir = $conf->propale->dir_output.'/'.dol_sanitizeFileName($propal->ref);
@ -139,11 +143,29 @@ if ($propalid > 0)
print '<table class="border"width="100%">'; print '<table class="border"width="100%">';
// Ref $linkback="<a href=\"".$_SERVER["PHP_SELF"]."?page=$page&socid=$socid&viewstatut=$viewstatut&sortfield=$sortfield&$sortorder\">".$langs->trans("BackToList")."</a>";
print '<tr><td width="30%">'.$langs->trans('Ref').'</td><td colspan="3">'.$propal->ref.'</td></tr>';
// Soci<63>t<EFBFBD> // Ref
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="5">'.$societe->getNomUrl(1).'</td></tr>'; print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
print $html->showrefnav($propal,'ref',$linkback,1,'ref','ref','');
print '</td></tr>';
// Ref client
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td nowrap>';
print $langs->trans('RefCustomer').'</td><td align="left">';
print '</td>';
print '</tr></table>';
print '</td><td colspan="3">';
print $propal->ref_client;
print '</td>';
print '</tr>';
// Customer
if ( is_null($propal->client) )
$propal->fetch_client();
print "<tr><td>".$langs->trans("Company")."</td>";
print '<td colspan="3">'.$propal->client->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.sizeof($filearray).'</td></tr>'; print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.sizeof($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>'; print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* *
@ -20,10 +20,10 @@
*/ */
/** /**
\file htdocs/comm/propal/note.php * \file htdocs/comm/propal/note.php
\ingroup propale * \ingroup propale
\brief Fiche d'information sur une proposition commerciale * \brief Fiche d'information sur une proposition commerciale
\version $Id$ * \version $Id$
*/ */
require('./pre.inc.php'); require('./pre.inc.php');
@ -94,14 +94,16 @@ llxHeader();
$html = new Form($db); $html = new Form($db);
if ($_GET['propalid']) $id = $_GET['propalid'];
$ref= $_GET['ref'];
if ($id > 0 || ! empty($ref))
{ {
if ($mesg) print $mesg; if ($mesg) print $mesg;
$now=gmmktime(); $now=gmmktime();
$propal = new Propal($db); $propal = new Propal($db);
if ( $propal->fetch($_GET['propalid']) ) if ($propal->fetch($id, $ref))
{ {
$societe = new Societe($db); $societe = new Societe($db);
if ( $societe->fetch($propal->socid) ) if ( $societe->fetch($propal->socid) )
@ -111,10 +113,29 @@ if ($_GET['propalid'])
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">'.$propal->ref.'</td></tr>'; $linkback="<a href=\"".$_SERVER["PHP_SELF"]."?page=$page&socid=$socid&viewstatut=$viewstatut&sortfield=$sortfield&$sortorder\">".$langs->trans("BackToList")."</a>";
// Societe // Ref
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="3">'.$societe->getNomUrl(1).'</td></tr>'; print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
print $html->showrefnav($propal,'ref',$linkback,1,'ref','ref','');
print '</td></tr>';
// Ref client
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td nowrap>';
print $langs->trans('RefCustomer').'</td><td align="left">';
print '</td>';
print '</tr></table>';
print '</td><td colspan="3">';
print $propal->ref_client;
print '</td>';
print '</tr>';
// Customer
if ( is_null($propal->client) )
$propal->fetch_client();
print "<tr><td>".$langs->trans("Company")."</td>";
print '<td colspan="3">'.$propal->client->getNomUrl(1).'</td></tr>';
// Ligne info remises tiers // Ligne info remises tiers
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">'; print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
@ -122,7 +143,7 @@ if ($_GET['propalid'])
else print $langs->trans("CompanyHasNoRelativeDiscount"); else print $langs->trans("CompanyHasNoRelativeDiscount");
$absolute_discount=$societe->getAvailableDiscounts(); $absolute_discount=$societe->getAvailableDiscounts();
print '. '; print '. ';
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie)); if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->monnaie));
else print $langs->trans("CompanyHasNoAbsoluteDiscount"); else print $langs->trans("CompanyHasNoAbsoluteDiscount");
print '.'; print '.';
print '</td></tr>'; print '</td></tr>';

View File

@ -42,6 +42,7 @@ class Commande extends CommonObject
var $table_element='commande'; var $table_element='commande';
var $table_element_line = 'commandedet'; var $table_element_line = 'commandedet';
var $fk_element = 'fk_commande'; var $fk_element = 'fk_commande';
var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id ; var $id ;

View File

@ -406,22 +406,29 @@ class CommonObject
/** /**
* \brief Load properties id_previous and id_next * \brief Load properties id_previous and id_next
* \param filter Optional filter * \param filter Optional filter
* \param fieldid Nom du champ a utiliser pour select next et previous * \param fieldid Name of field to use for the select MAX and MIN
* \return int <0 if KO, >0 if OK * \return int <0 if KO, >0 if OK
*/ */
function load_previous_next_ref($filter='',$fieldid) function load_previous_next_ref($filter='',$fieldid)
{ {
global $conf;
if (! $this->table_element) if (! $this->table_element)
{ {
dol_syslog("CommonObject::load_previous_next was called on objet with property table_element not defined", LOG_ERR); dol_syslog("CommonObject::load_previous_next was called on objet with property table_element not defined", LOG_ERR);
return -1; return -1;
} }
// this->ismultientitymanaged contains
// 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
$sql = "SELECT MAX(".$fieldid.")"; $sql = "SELECT MAX(".$fieldid.")";
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as te";
if ($this->table_optional) $sql.= ", ".MAIN_DB_PREFIX.$this->table_optional; if ($this->ismultientitymanaged == 2) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
$sql.= " WHERE ".$fieldid." < '".addslashes($this->ref)."'"; $sql.= " WHERE te.".$fieldid." < '".addslashes($this->ref)."'";
if (isset($filter)) $sql.=" AND ".$filter; if (isset($filter)) $sql.=" AND ".$filter;
if ($this->ismultientitymanaged == 2) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
if ($this->ismultientitymanaged > 0) $sql.= ' AND entity IN (0,'.$conf->entity.')';
//print $sql."<br>"; //print $sql."<br>";
$result = $this->db->query($sql) ; $result = $this->db->query($sql) ;
@ -435,11 +442,13 @@ class CommonObject
$sql = "SELECT MIN(".$fieldid.")"; $sql = "SELECT MIN(".$fieldid.")";
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as te";
if ($this->table_optional) $sql.= ", ".MAIN_DB_PREFIX.$this->table_optional; if ($this->ismultientitymanaged == 2) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
$sql.= " WHERE ".$fieldid." > '".addslashes($this->ref)."'"; $sql.= " WHERE te.".$fieldid." > '".addslashes($this->ref)."'";
if (isset($filter)) $sql.=" AND ".$filter; if (isset($filter)) $sql.=" AND ".$filter;
// Rem: Bug in some mysql version: SELECT rowid FROM llx_socpeople WHERE rowid > 1 when one row in database with rowid=1, returns 1 instead of null if ($this->ismultientitymanaged == 2) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
if ($this->ismultientitymanaged > 0) $sql.= ' AND entity IN (0,'.$conf->entity.')';
// Rem: Bug in some mysql version: SELECT MIN(rowid) FROM llx_socpeople WHERE rowid > 1 when one row in database with rowid=1, returns 1 instead of null
//print $sql."<br>"; //print $sql."<br>";
$result = $this->db->query($sql) ; $result = $this->db->query($sql) ;

View File

@ -1977,7 +1977,7 @@ else
$facstatic = new Facture($db); $facstatic = new Facture($db);
$fac = new Facture($db); $fac = new Facture($db);
$result=$fac->fetch($_GET['facid'],$_GET['ref']); $result=$fac->fetch($id,$ref);
if ($result > 0) if ($result > 0)
{ {
if ($user->societe_id>0 && $user->societe_id!=$fac->socid) accessforbidden('',0); if ($user->societe_id>0 && $user->societe_id!=$fac->socid) accessforbidden('',0);

View File

@ -27,6 +27,7 @@
require ("./pre.inc.php"); require ("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
require_once(DOL_DOCUMENT_ROOT.'/discount.class.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/invoice.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/invoice.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/html.formcompany.class.php'); require_once(DOL_DOCUMENT_ROOT.'/html.formcompany.class.php');
@ -159,11 +160,13 @@ $contactstatic=new Contact($db);
/* */ /* */
/* *************************************************************************** */ /* *************************************************************************** */
if (isset($mesg)) print $mesg; if (isset($mesg)) print $mesg;
$id = $_GET["facid"];
if ($id > 0) $id = $_GET['facid'];
$ref= $_GET['ref'];
if ($id > 0 || ! empty($ref))
{ {
$facture = New Facture($db); $facture = new Facture($db);
if ( $facture->fetch($_GET['facid'], $user->societe_id) > 0) if ($facture->fetch($id, $ref) > 0)
{ {
$facture->fetch_client(); $facture->fetch_client();
@ -176,10 +179,22 @@ if ($id > 0)
*/ */
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Reference du facture // Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">'; print '<tr><td width="20%">'.$langs->trans('Ref').'</td>';
print $facture->ref; print '<td colspan="3">';
print "</td></tr>"; $morehtmlref='';
$discount=new DiscountAbsolute($db);
$result=$discount->fetch(0,$facture->id);
if ($result > 0)
{
$morehtmlref=' ('.$langs->trans("CreditNoteConvertedIntoDiscount",$discount->getNomUrl(1,'discount')).')';
}
if ($result < 0)
{
dol_print_error('',$discount->error);
}
print $html->showrefnav($facture,'ref','',1,'facnumber','ref',$morehtmlref);
print '</td></tr>';
// Customer // Customer
print "<tr><td>".$langs->trans("Company")."</td>"; print "<tr><td>".$langs->trans("Company")."</td>";

View File

@ -20,14 +20,15 @@
*/ */
/** /**
\file htdocs/compta/facture/document.php * \file htdocs/compta/facture/document.php
\ingroup facture * \ingroup facture
\brief Page de gestion des documents attach<EFBFBD>es <EFBFBD> une facture * \brief Page for attached files on invoices
\version $Id$ * \version $Id$
*/ */
require('./pre.inc.php'); require('./pre.inc.php');
require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
require_once(DOL_DOCUMENT_ROOT.'/discount.class.php');
require_once(DOL_DOCUMENT_ROOT."/lib/invoice.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/invoice.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php"); require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
@ -109,15 +110,19 @@ if ($action=='delete')
} }
/* /*
* Affichage * View
*/ */
llxHeader(); llxHeader();
if ($facid > 0) $html = new Form($db);
$id = $_GET['facid'];
$ref= $_GET['ref'];
if ($id > 0 || ! empty($ref))
{ {
$facture = new Facture($db); $facture = new Facture($db);
if ($facture->fetch($facid)) if ($facture->fetch($id,$ref) > 0)
{ {
$upload_dir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($facture->ref); $upload_dir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($facture->ref);
@ -141,9 +146,23 @@ if ($facid > 0)
print '<table class="border"width="100%">'; print '<table class="border"width="100%">';
// Ref // Ref
print '<tr><td width="30%">'.$langs->trans('Ref').'</td><td colspan="3">'.$facture->ref.'</td></tr>'; print '<tr><td width="30%">'.$langs->trans('Ref').'</td>';
print '<td colspan="3">';
$morehtmlref='';
$discount=new DiscountAbsolute($db);
$result=$discount->fetch(0,$facture->id);
if ($result > 0)
{
$morehtmlref=' ('.$langs->trans("CreditNoteConvertedIntoDiscount",$discount->getNomUrl(1,'discount')).')';
}
if ($result < 0)
{
dol_print_error('',$discount->error);
}
print $html->showrefnav($facture,'ref','',1,'facnumber','ref',$morehtmlref);
print '</td></tr>';
// Soci<63>t<EFBFBD> // Company
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="3">'.$societe->getNomUrl(1).'</td></tr>'; print '<tr><td>'.$langs->trans('Company').'</td><td colspan="3">'.$societe->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.sizeof($filearray).'</td></tr>'; print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.sizeof($filearray).'</td></tr>';

View File

@ -18,13 +18,15 @@
*/ */
/** /**
\file htdocs/compta/facture/info.php * \file htdocs/compta/facture/info.php
\ingroup facture * \ingroup facture
\brief Page des informations d'une facture * \brief Page des informations d'une facture
\version $Id$ * \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
require_once(DOL_DOCUMENT_ROOT.'/discount.class.php');
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/lib/invoice.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/invoice.lib.php');

View File

@ -18,13 +18,15 @@
*/ */
/** /**
\file htdocs/compta/facture/note.php * \file htdocs/compta/facture/note.php
\ingroup facture * \ingroup facture
\brief Fiche de notes sur une facture * \brief Fiche de notes sur une facture
\version $Id$ * \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
require_once(DOL_DOCUMENT_ROOT.'/discount.class.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/invoice.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/invoice.lib.php');
$socid=isset($_GET["socid"])?$_GET["socid"]:isset($_POST["socid"])?$_POST["socid"]:""; $socid=isset($_GET["socid"])?$_GET["socid"]:isset($_POST["socid"])?$_POST["socid"]:"";
@ -93,9 +95,14 @@ llxHeader();
$html = new Form($db); $html = new Form($db);
if ($_GET["facid"]) $id = $_GET['facid'];
$ref= $_GET['ref'];
if ($id > 0 || ! empty($ref))
{ {
$soc = new Societe($db, $fac->socid); $fac = new Facture($db);
$fac->fetch($id,$ref);
$soc = new Societe($db, $fac->socid);
$soc->fetch($fac->socid); $soc->fetch($fac->socid);
$head = facture_prepare_head($fac); $head = facture_prepare_head($fac);
@ -104,10 +111,24 @@ if ($_GET["facid"])
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Reference // Ref
print '<tr><td width="20%">'.$langs->trans('Ref').'</td><td colspan="3">'.$fac->ref.'</td></tr>'; print '<tr><td width="20%">'.$langs->trans('Ref').'</td>';
print '<td colspan="3">';
$morehtmlref='';
$discount=new DiscountAbsolute($db);
$result=$discount->fetch(0,$fac->id);
if ($result > 0)
{
$morehtmlref=' ('.$langs->trans("CreditNoteConvertedIntoDiscount",$discount->getNomUrl(1,'discount')).')';
}
if ($result < 0)
{
dol_print_error('',$discount->error);
}
print $html->showrefnav($fac,'ref','',1,'facnumber','ref',$morehtmlref);
print '</td></tr>';
// Soci<63>t<EFBFBD> // Company
print '<tr><td>'.$langs->trans("Company").'</td>'; print '<tr><td>'.$langs->trans("Company").'</td>';
print '<td colspan="3">'.$soc->getNomUrl(1,'compta').'</td>'; print '<td colspan="3">'.$soc->getNomUrl(1,'compta').'</td>';

View File

@ -151,15 +151,14 @@ if ($id > 0 || ! empty($ref))
/* /*
* Fiche propal * Proposal card
*
*/ */
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
$linkback="<a href=\"propal.php?page=$page&socid=$socid&viewstatut=$viewstatut&sortfield=$sortfield&$sortorder\">".$langs->trans("BackToList")."</a>"; $linkback="<a href=\"".$_SERVER["PHP_SELF"]."?page=$page&socid=$socid&viewstatut=$viewstatut&sortfield=$sortfield&$sortorder\">".$langs->trans("BackToList")."</a>";
// Ref // Ref
print '<tr><td>'.$langs->trans('Ref').'</td><td colspan="5">'; print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="5">';
print $html->showrefnav($propal,'ref',$linkback,1,'ref','ref',''); print $html->showrefnav($propal,'ref',$linkback,1,'ref','ref','');
print '</td></tr>'; print '</td></tr>';

View File

@ -47,6 +47,7 @@ class Facture extends CommonObject
var $table_element='facture'; var $table_element='facture';
var $table_element_line = 'facturedet'; var $table_element_line = 'facturedet';
var $fk_element = 'fk_facture'; var $fk_element = 'fk_facture';
var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $table; var $table;
var $tabledetail; var $tabledetail;

View File

@ -478,7 +478,6 @@ if ($_GET["action"] == 'create')
llxHeader('',$langs->trans("OrderCard"),"CommandeFournisseur"); llxHeader('',$langs->trans("OrderCard"),"CommandeFournisseur");
$html = new Form($db); $html = new Form($db);
$formfile = new FormFile($db); $formfile = new FormFile($db);
$formorder = new FormOrder($db); $formorder = new FormOrder($db);
@ -501,7 +500,7 @@ if ($id > 0 || ! empty($ref))
$commande = new CommandeFournisseur($db); $commande = new CommandeFournisseur($db);
$result=$commande->fetch($_REQUEST['id'],$_REQUEST['ref']); $result=$commande->fetch($id,$ref);
if ($result >= 0) if ($result >= 0)
{ {
$soc = new Societe($db); $soc = new Societe($db);

View File

@ -144,110 +144,103 @@ if ( $societe->fetch($socid) )
print '<br>'; print '<br>';
/* /*
* Liste des commandes associees * Last orders
*/ */
$orderstatic = new CommandeFournisseur($db); $orderstatic = new CommandeFournisseur($db);
$sql = "SELECT p.rowid,p.ref,".$db->pdate("p.date_commande")." as dc, p.fk_statut"; if ($user->rights->fournisseur->commande->lire)
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p ";
$sql.= " WHERE p.fk_soc =".$societe->id;
$sql.= " ORDER BY p.date_commande DESC";
$sql.= " ".$db->plimit($MAXLIST);
$resql=$db->query($sql);
if ($resql)
{ {
$i = 0 ; $sql = "SELECT p.rowid,p.ref,".$db->pdate("p.date_commande")." as dc, p.fk_statut";
$num = $db->num_rows($resql); $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p ";
if ($num > 0) $sql.= " WHERE p.fk_soc =".$societe->id;
$sql.= " ORDER BY p.date_commande DESC";
$sql.= " ".$db->plimit($MAXLIST);
$resql=$db->query($sql);
if ($resql)
{ {
$i = 0 ;
$num = $db->num_rows($resql);
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="3">'; print '<td colspan="3">';
print '<table class="noborder" width="100%"><tr><td>'.$langs->trans("LastOrders",($num<$MAXLIST?$num:$MAXLIST)).'</td>'; print '<table class="noborder" width="100%"><tr><td>'.$langs->trans("LastOrders",($num<$MAXLIST?$num:$MAXLIST)).'</td>';
print '<td align="right"><a href="commande/liste.php?socid='.$societe->id.'">'.$langs->trans("AllOrders").' ('.$num.')</td></tr></table>'; print '<td align="right"><a href="commande/liste.php?socid='.$societe->id.'">'.$langs->trans("AllOrders").' ('.$num.')</td></tr></table>';
print '</td></tr>'; print '</td></tr>';
} while ($i < $num && $i <= $MAXLIST)
while ($i < $num && $i <= $MAXLIST) {
{ $obj = $db->fetch_object($resql);
$obj = $db->fetch_object($resql); $var=!$var;
$var=!$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print '<td><a href="commande/fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowOrder"),"order")." ".$obj->ref.'</a></td>'; print '<td><a href="commande/fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowOrder"),"order")." ".$obj->ref.'</a></td>';
print '<td align="center" width="80">'; print '<td align="center" width="80">';
if ($obj->dc) if ($obj->dc)
{ {
print dol_print_date($obj->dc,'day'); print dol_print_date($obj->dc,'day');
}
else
{
print "-";
}
print '</td>';
print '<td align="right" nowrap="nowrap">'.$orderstatic->LibStatut($obj->fk_statut,5).'</td>';
print '</tr>';
$i++;
} }
else $db->free($resql);
{
print "-";
}
print '</td>';
print '<td align="right" nowrap="nowrap">'.$orderstatic->LibStatut($obj->fk_statut,5).'</td>';
print '</tr>';
$i++;
}
$db->free($resql);
if ($num > 0)
{
print "</table>"; print "</table>";
} }
else
{
dol_print_error($db);
}
} }
else
{
dol_print_error($db);
}
/* /*
* Liste des factures associees * Last invoices
*/ */
$MAXLIST=5; $MAXLIST=5;
$langs->load('bills'); $langs->load('bills');
$facturestatic = new FactureFournisseur($db); $facturestatic = new FactureFournisseur($db);
$sql = 'SELECT p.rowid,p.libelle,p.facnumber,p.fk_statut,'.$db->pdate('p.datef').' as df, total_ttc as amount, paye'; if ($user->rights->fournisseur->facture->lire)
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as p';
$sql.= ' WHERE p.fk_soc = '.$societe->id;
$sql.= ' ORDER BY p.datef DESC';
$resql=$db->query($sql);
if ($resql)
{ {
$i = 0 ; $sql = 'SELECT p.rowid,p.libelle,p.facnumber,p.fk_statut,'.$db->pdate('p.datef').' as df, total_ttc as amount, paye';
$num = $db->num_rows($resql); $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as p';
if ($num > 0) $sql.= ' WHERE p.fk_soc = '.$societe->id;
$sql.= ' ORDER BY p.datef DESC';
$resql=$db->query($sql);
if ($resql)
{ {
$i = 0 ;
$num = $db->num_rows($resql);
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="4">'; print '<td colspan="4">';
print '<table class="noborder" width="100%"><tr><td>'.$langs->trans('LastSuppliersBills',($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="facture/index.php?socid='.$societe->id.'">'.$langs->trans('AllBills').' ('.$num.')</td></tr></table>'; print '<table class="noborder" width="100%"><tr><td>'.$langs->trans('LastSuppliersBills',($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="facture/index.php?socid='.$societe->id.'">'.$langs->trans('AllBills').' ('.$num.')</td></tr></table>';
print '</td></tr>'; print '</td></tr>';
} while ($i < min($num,$MAXLIST))
while ($i < min($num,$MAXLIST)) {
{ $obj = $db->fetch_object($resql);
$obj = $db->fetch_object($resql); $var=!$var;
$var=!$var; print '<tr '.$bc[$var].'>';
print '<tr '.$bc[$var].'>'; print '<td>';
print '<td>'; print '<a href="facture/fiche.php?facid='.$obj->rowid.'">';
print '<a href="facture/fiche.php?facid='.$obj->rowid.'">'; print img_object($langs->trans('ShowBill'),'bill').' '.$obj->facnumber.'</a> '.dol_trunc($obj->libelle,14).'</td>';
print img_object($langs->trans('ShowBill'),'bill').' '.$obj->facnumber.'</a> '.dol_trunc($obj->libelle,14).'</td>'; print '<td align="center" nowrap="nowrap">'.dol_print_date($obj->df,'day').'</td>';
print '<td align="center" nowrap="nowrap">'.dol_print_date($obj->df,'day').'</td>'; print '<td align="right" nowrap="nowrap">'.price($obj->amount).'</td>';
print '<td align="right" nowrap="nowrap">'.price($obj->amount).'</td>'; print '<td align="right" nowrap="nowrap">'.$facturestatic->LibStatut($obj->paye,$obj->fk_statut,5).'</td>';
print '<td align="right" nowrap="nowrap">'.$facturestatic->LibStatut($obj->paye,$obj->fk_statut,5).'</td>'; print '</tr>';
print '</tr>'; $i++;
$i++; }
} $db->free($resql);
$db->free($resql);
if ($num > 0)
{
print '</table>'; print '</table>';
} }
} else
else {
{ dol_print_error($db);
dol_print_error($db); }
} }
print '</td></tr>'; print '</td></tr>';

View File

@ -36,15 +36,17 @@ require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php");
*/ */
class CommandeFournisseur extends Commande class CommandeFournisseur extends Commande
{ {
var $id ;
var $db ; var $db ;
var $error; var $error;
var $element='order_supplier'; var $element='order_supplier';
var $table_element='commande_fournisseur'; var $table_element='commande_fournisseur';
var $table_element_line = 'commande_fournisseurdet'; var $table_element_line = 'commande_fournisseurdet';
var $fk_element = 'fk_commande'; var $fk_element = 'fk_commande';
var $table_optional = 'societe as s'; var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id ; var $ref;
var $brouillon; var $brouillon;
@ -120,8 +122,6 @@ class CommandeFournisseur extends Commande
$this->note_public = $obj->note_public; $this->note_public = $obj->note_public;
$this->modelpdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf;
$this->next_prev_filter = 'fk_soc = s.rowid AND s.entity = '.$conf->entity;
$this->db->free(); $this->db->free();
if ($this->statut == 0) $this->brouillon = 1; if ($this->statut == 0) $this->brouillon = 1;

View File

@ -38,11 +38,13 @@ class FactureFournisseur extends Facture
{ {
var $id; var $id;
var $db; var $db;
var $error;
var $element='facture_fourn'; var $element='facture_fourn';
var $table_element='facture_fourn'; var $table_element='facture_fourn';
var $table_element_line='facture_fourn_det'; var $table_element_line='facture_fourn_det';
var $fk_element='fk_facture_fourn'; var $fk_element='fk_facture_fourn';
var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $ref; var $ref;
var $ref_supplier; var $ref_supplier;
@ -212,6 +214,8 @@ class FactureFournisseur extends Facture
*/ */
function fetch($rowid) function fetch($rowid)
{ {
global $conf;
$sql = 'SELECT libelle, facnumber, amount, remise, '.$this->db->pdate(datef).'as df,'; $sql = 'SELECT libelle, facnumber, amount, remise, '.$this->db->pdate(datef).'as df,';
$sql.= ' total_ht, total_tva, total_ttc, fk_user_author,'; $sql.= ' total_ht, total_tva, total_ttc, fk_user_author,';
$sql.= ' fk_statut, fk_projet as fk_project, paye, f.note, f.note_public,'; $sql.= ' fk_statut, fk_projet as fk_project, paye, f.note, f.note_public,';

View File

@ -2826,6 +2826,7 @@ class Form
{ {
$ret=''; $ret='';
//print "$paramid,$morehtml,$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam";
$object->load_previous_next_ref($object->next_prev_filter,$fieldid); $object->load_previous_next_ref($object->next_prev_filter,$fieldid);
$previous_ref = $object->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'">'.img_previous().'</a>':''; $previous_ref = $object->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'">'.img_previous().'</a>':'';
$next_ref = $object->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'">'.img_next().'</a>':''; $next_ref = $object->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'">'.img_next().'</a>':'';

View File

@ -121,7 +121,7 @@ class FormFile
/** /**
* \brief Affiche la cartouche de la liste des documents d'une propale, facture... * \brief Show the box with list of available documents for object
* \param modulepart propal=propal, facture=facture, ... * \param modulepart propal=propal, facture=facture, ...
* \param filename Sub dir to scan (use '' if filedir already complete) * \param filename Sub dir to scan (use '' if filedir already complete)
* \param filedir Dir to scan * \param filedir Dir to scan
@ -130,8 +130,8 @@ class FormFile
* \param delallowed Remove is allowed (1/0) * \param delallowed Remove is allowed (1/0)
* \param modelselected Model to preselect by default * \param modelselected Model to preselect by default
* \param modelliste Tableau des modeles possibles. Use '' to hide combo select list. * \param modelliste Tableau des modeles possibles. Use '' to hide combo select list.
* \param forcenomultilang N'affiche pas option langue meme si MAIN_MULTILANGS defini * \param forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined)
* \param iconPDF N'affiche que l'icone PDF avec le lien (1/0) * \param iconPDF Show only PDF icon with link (1/0)
* \param maxfilenamelength Max length for filename shown * \param maxfilenamelength Max length for filename shown
* \param noform Do not output html form start and end * \param noform Do not output html form start and end
* \param param More param on http links * \param param More param on http links
@ -295,7 +295,7 @@ class FormFile
print '<input type="hidden" name="action" value="builddoc">'; print '<input type="hidden" name="action" value="builddoc">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print_titre($langs->trans("BuildDocuments")); print_titre($langs->trans("Documents"));
print '<table class="border" summary="listofdocumentstable" width="100%">'; print '<table class="border" summary="listofdocumentstable" width="100%">';
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';

View File

@ -112,10 +112,10 @@ insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`,
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->fournisseur->enabled', 'auguria', 'left', 3302__+MAX_llx_menu__, 'suppliers', '', 3300__+MAX_llx_menu__, '/fourn/liste.php', 'List', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 1, __ENTITY__); insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->fournisseur->enabled', 'auguria', 'left', 3302__+MAX_llx_menu__, 'suppliers', '', 3300__+MAX_llx_menu__, '/fourn/liste.php', 'List', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 1, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->fournisseur->enabled', 'auguria', 'left', 3303__+MAX_llx_menu__, 'suppliers', '', 3300__+MAX_llx_menu__, '/contact/index.php?leftmenu=supplier&type=f', 'Contacts', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 2, __ENTITY__); insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->fournisseur->enabled', 'auguria', 'left', 3303__+MAX_llx_menu__, 'suppliers', '', 3300__+MAX_llx_menu__, '/contact/index.php?leftmenu=supplier&type=f', 'Contacts', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 2, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->fournisseur->enabled', 'auguria', 'left', 3304__+MAX_llx_menu__, 'suppliers', '', 3300__+MAX_llx_menu__, '/fourn/stats.php', 'Statistics', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 3, __ENTITY__); insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->fournisseur->enabled', 'auguria', 'left', 3304__+MAX_llx_menu__, 'suppliers', '', 3300__+MAX_llx_menu__, '/fourn/stats.php', 'Statistics', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 3, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->fournisseur->enabled', 'auguria', 'left', 3400__+MAX_llx_menu__, 'suppliers', '', 4__+MAX_llx_menu__, '/fourn/facture/index.php', 'Bills', 0, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1, __ENTITY__); insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->fournisseur->enabled', 'auguria', 'left', 3400__+MAX_llx_menu__, 'suppliers', '', 3300__+MAX_llx_menu__, '/fourn/facture/index.php', 'Bills', 0, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 4, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->fournisseur->enabled', 'auguria', 'left', 3401__+MAX_llx_menu__, 'suppliers', '', 3400__+MAX_llx_menu__, '/fourn/facture/fiche.php?action=create', 'NewBill', 1, 'bills', '$user->rights->fournisseur->facture->creer', '', 2, 0, __ENTITY__); insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->fournisseur->enabled', 'auguria', 'left', 3401__+MAX_llx_menu__, 'suppliers', '', 3400__+MAX_llx_menu__, '/fourn/facture/fiche.php?action=create', 'NewBill', 1, 'bills', '$user->rights->fournisseur->facture->creer', '', 2, 0, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->fournisseur->enabled', 'auguria', 'left', 3402__+MAX_llx_menu__, 'suppliers', '', 3400__+MAX_llx_menu__, '/fourn/facture/paiement.php', 'Payments', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1, __ENTITY__); insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->fournisseur->enabled', 'auguria', 'left', 3402__+MAX_llx_menu__, 'suppliers', '', 3400__+MAX_llx_menu__, '/fourn/facture/paiement.php', 'Payments', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->fournisseur->enabled', 'auguria', 'left', 3500__+MAX_llx_menu__, 'suppliers', '', 4__+MAX_llx_menu__, '/fourn/commande/index.php?leftmenu=suppliers', 'Orders', 0, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 2, __ENTITY__); insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->fournisseur->enabled', 'auguria', 'left', 3500__+MAX_llx_menu__, 'suppliers', '', 3300__+MAX_llx_menu__, '/fourn/commande/index.php?leftmenu=suppliers', 'Orders', 0, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 5, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->fournisseur->enabled', 'auguria', 'left', 3501__+MAX_llx_menu__, 'suppliers', '', 3500__+MAX_llx_menu__, '/societe.php?leftmenu=supplier', 'NewOrder', 1, 'orders', '$user->rights->fournisseur->commande->creer', '', 2, 0, __ENTITY__); insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->fournisseur->enabled', 'auguria', 'left', 3501__+MAX_llx_menu__, 'suppliers', '', 3500__+MAX_llx_menu__, '/societe.php?leftmenu=supplier', 'NewOrder', 1, 'orders', '$user->rights->fournisseur->commande->creer', '', 2, 0, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->fournisseur->enabled', 'auguria', 'left', 3502__+MAX_llx_menu__, 'suppliers', '', 3500__+MAX_llx_menu__, '/fourn/commande/liste.php?leftmenu=suppliers', 'List', 1, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 1, __ENTITY__); insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->fournisseur->enabled', 'auguria', 'left', 3502__+MAX_llx_menu__, 'suppliers', '', 3500__+MAX_llx_menu__, '/fourn/commande/liste.php?leftmenu=suppliers', 'List', 1, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 1, __ENTITY__);
insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->fournisseur->enabled && $conf->categorie->enabled', 'auguria', 'left', 4900__+MAX_llx_menu__, 'suppliers', '', 4__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=1', 'Categories', 0, 'categories', '$user->rights->categorie>lire', '', 2, 3, __ENTITY__); insert into `llx_menu` (`enabled`, `menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position, entity) values ('$conf->fournisseur->enabled && $conf->categorie->enabled', 'auguria', 'left', 4900__+MAX_llx_menu__, 'suppliers', '', 4__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=1', 'Categories', 0, 'categories', '$user->rights->categorie>lire', '', 2, 3, __ENTITY__);

View File

@ -497,6 +497,7 @@ Canceled=Canceled
YouCanChangeValuesForThisListFromDictionnarySetup=You can change values for this list from menu setup - dictionnary YouCanChangeValuesForThisListFromDictionnarySetup=You can change values for this list from menu setup - dictionnary
Color=Color Color=Color
Documents=Linked files Documents=Linked files
DocumentsNb=Linked files (%s)
Documents2=Documents Documents2=Documents
BuildDocuments=Generated documents BuildDocuments=Generated documents
UploadDisabled=Upload disabled UploadDisabled=Upload disabled

View File

@ -496,6 +496,7 @@ Canceled=Annulé
YouCanChangeValuesForThisListFromDictionnarySetup=Vous pouvez changer ces valeurs depuis le menu configuration - dictionnaires YouCanChangeValuesForThisListFromDictionnarySetup=Vous pouvez changer ces valeurs depuis le menu configuration - dictionnaires
Color=Couleur Color=Couleur
Documents=Fichiers joints Documents=Fichiers joints
DocumentsNb=Fichiers joints (%s)
Documents2=Documents Documents2=Documents
BuildDocuments=Documents générés BuildDocuments=Documents générés
UploadDisabled=Transfert désactivé UploadDisabled=Transfert désactivé

View File

@ -32,7 +32,7 @@
* \param $exludefilter Regex for exclude filter (example: '\.meta$') * \param $exludefilter Regex for exclude filter (example: '\.meta$')
* \param $sortcriteria Sort criteria ("name","date","size") * \param $sortcriteria Sort criteria ("name","date","size")
* \param $sortorder Sort order (SORT_ASC, SORT_DESC) * \param $sortorder Sort order (SORT_ASC, SORT_DESC)
* \param $mode 0=Return array with only keys needed, 1=Force all keys to be loaded * \param $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower)
* \return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file') * \return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file')
*/ */
function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0) function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0)
@ -189,7 +189,7 @@ function dol_mimetype($file)
/** /**
* \brief Test if a folder is empty * \brief Test if a folder is empty
* \param folder Name of folder * \param folder Name of folder
* \return boolean True if dir is empty or non-existing, false if it contains files * \return boolean True if dir is empty or non-existing, False if it contains files
*/ */
function dol_dir_is_emtpy($folder) function dol_dir_is_emtpy($folder)
{ {
@ -210,7 +210,7 @@ function dol_dir_is_emtpy($folder)
closedir($handle); closedir($handle);
} }
else else
return true; // Le repertoire n'existe pas return true; // Dir does not exists
} }
/** /**

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2006 Marc Barilley / Ocebo <marc@ocebo.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -19,10 +19,10 @@
*/ */
/** /**
\file htdocs/lib/fourn.lib.php * \file htdocs/lib/fourn.lib.php
\brief Ensemble de fonctions de base pour le module fournisseur * \brief Ensemble de fonctions de base pour le module fournisseur
\version $Id$ * \version $Id$
*/ */
function facturefourn_prepare_head($fac) function facturefourn_prepare_head($fac)
{ {
@ -46,6 +46,10 @@ function facturefourn_prepare_head($fac)
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$fac->id; $head[$h][0] = DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$fac->id;
/*$filesdir = $conf->fournisseur->dir_output.'/facture/'.get_exdir($fac->id,2).$fac->id;
include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
$listoffiles=dol_dir_list($filesdir,'files',1);
$head[$h][1] = (sizeof($listoffiles)?$langs->trans('DocumentsNb',sizeof($listoffiles)):$langs->trans('Documents'));*/
$head[$h][1] = $langs->trans('Documents'); $head[$h][1] = $langs->trans('Documents');
$head[$h][2] = 'documents'; $head[$h][2] = 'documents';
$h++; $h++;
@ -107,7 +111,11 @@ function ordersupplier_prepare_head($commande)
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/document.php?id='.$commande->id; $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/document.php?id='.$commande->id;
$head[$h][1] = $langs->trans("Documents"); /*$filesdir = $conf->fournisseur->dir_output . "/commande/" . dol_sanitizeFileName($commande->ref);
include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
$listoffiles=dol_dir_list($filesdir,'files',1);
$head[$h][1] = (sizeof($listoffiles)?$langs->trans('DocumentsNb',sizeof($listoffiles)):$langs->trans('Documents'));*/
$head[$h][1] = $langs->trans('Documents');
$head[$h][2] = 'documents'; $head[$h][2] = 'documents';
$h++; $h++;

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -64,6 +64,10 @@ function facture_prepare_head($fac)
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$fac->id; $head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$fac->id;
/*$filesdir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($fac->ref);
include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
$listoffiles=dol_dir_list($filesdir,'files',1);
$head[$h][1] = (sizeof($listoffiles)?$langs->trans('DocumentsNb',sizeof($listoffiles)):$langs->trans('Documents'));*/
$head[$h][1] = $langs->trans('Documents'); $head[$h][1] = $langs->trans('Documents');
$head[$h][2] = 'documents'; $head[$h][2] = 'documents';
$h++; $h++;

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -53,7 +53,7 @@ function commande_prepare_head($commande)
$h++; $h++;
} }
// Commande à facturer // Commande a facturer
if ($conf->facture->enabled) if ($conf->facture->enabled)
{ {
$head[$h][0] = DOL_URL_ROOT.'/compta/commande/fiche.php?id='.$commande->id; $head[$h][0] = DOL_URL_ROOT.'/compta/commande/fiche.php?id='.$commande->id;
@ -76,6 +76,10 @@ function commande_prepare_head($commande)
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/commande/document.php?id='.$commande->id; $head[$h][0] = DOL_URL_ROOT.'/commande/document.php?id='.$commande->id;
/*$filesdir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($commande->ref);
include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
$listoffiles=dol_dir_list($filesdir,'files',1);
$head[$h][1] = (sizeof($listoffiles)?$langs->trans('DocumentsNb',sizeof($listoffiles)):$langs->trans('Documents'));*/
$head[$h][1] = $langs->trans('Documents'); $head[$h][1] = $langs->trans('Documents');
$head[$h][2] = 'documents'; $head[$h][2] = 'documents';
$h++; $h++;

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -77,6 +77,10 @@ function propal_prepare_head($propal)
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?propalid='.$propal->id; $head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?propalid='.$propal->id;
/*$filesdir = $conf->propale->dir_output . "/" . dol_sanitizeFileName($propal->ref);
include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
$listoffiles=dol_dir_list($filesdir,'files',1);
$head[$h][1] = (sizeof($listoffiles)?$langs->trans('DocumentsNb',sizeof($listoffiles)):$langs->trans('Documents'));*/
$head[$h][1] = $langs->trans('Documents'); $head[$h][1] = $langs->trans('Documents');
$head[$h][2] = 'document'; $head[$h][2] = 'document';
$h++; $h++;

View File

@ -42,6 +42,7 @@ class Product extends CommonObject
var $errno = 0; var $errno = 0;
var $element='product'; var $element='product';
var $table_element='product'; var $table_element='product';
var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
//! Identifiant unique //! Identifiant unique
var $id ; var $id ;
@ -971,8 +972,6 @@ class Product extends CommonObject
$this->import_key = $result["import_key"]; $this->import_key = $result["import_key"];
$this->next_prev_filter = 'entity = '.$conf->entity;
$this->db->free(); $this->db->free();
// multilangs // multilangs

View File

@ -48,6 +48,7 @@ class Propal extends CommonObject
var $table_element='propal'; var $table_element='propal';
var $table_element_line='propaldet'; var $table_element_line='propaldet';
var $fk_element='fk_propal'; var $fk_element='fk_propal';
var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id; var $id;

View File

@ -49,6 +49,7 @@ class User extends CommonObject
var $errors=array(); var $errors=array();
var $element='user'; var $element='user';
var $table_element='user'; var $table_element='user';
var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id=0; var $id=0;
var $ldap_sid; var $ldap_sid;
@ -211,8 +212,6 @@ class User extends CommonObject
$this->contact_id = $obj->fk_socpeople; $this->contact_id = $obj->fk_socpeople;
$this->fk_member = $obj->fk_member; $this->fk_member = $obj->fk_member;
$this->next_prev_filter = 'entity IN (0,'.$conf->entity.')';
if (! $this->lang) $this->lang='fr_FR'; if (! $this->lang) $this->lang='fr_FR';
$this->db->free($result); $this->db->free($result);

View File

@ -28,16 +28,16 @@ if ($conf->ldap->enabled) require_once (DOL_DOCUMENT_ROOT."/lib/ldap.class.php")
/** /**
\class UserGroup * \class UserGroup
\brief Classe permettant la gestion des groupes d'utilisateur * \brief Classe permettant la gestion des groupes d'utilisateur
*/ */
class UserGroup extends CommonObject class UserGroup extends CommonObject
{ {
var $db; // Database handler var $db; // Database handler
var $error; var $error;
var $errors=array(); var $errors=array();
var $table_element='usergroup'; var $table_element='usergroup';
var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id; // Group id var $id; // Group id
var $entity; // Entity of group var $entity; // Entity of group
@ -94,8 +94,6 @@ class UserGroup extends CommonObject
$this->datec = $obj->datec; $this->datec = $obj->datec;
$this->datem = $obj->datem; $this->datem = $obj->datem;
$this->next_prev_filter = 'entity IN (0,'.$conf->entity.')';
// Sav current LDAP Current DN // Sav current LDAP Current DN
//$this->ldap_dn = $this->_load_ldap_dn($this->_load_ldap_info(),0); //$this->ldap_dn = $this->_load_ldap_dn($this->_load_ldap_info(),0);
} }