Qual: Move droitpret module into secondary repository

This commit is contained in:
Laurent Destailleur 2010-03-16 18:26:38 +00:00
parent 1d911571cb
commit c8179af08b
34 changed files with 15 additions and 3075 deletions

View File

@ -1,124 +0,0 @@
<?php
/* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* \defgroup DroitPret Module droitpret
* \version $Id$
* \brief Module pour gerer le suivi des droits de prets
*/
/**
* \file htdocs/includes/modules/modDroitPret.class.php
* \ingroup don
* \brief Fichier de description et activation du module DroitPret
*/
include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
/**
* \class modDroitPret
* \brief Classe de description et activation du module DroitPret
*/
class modDroitPret extends DolibarrModules
{
/**
* \brief Constructeur. Definit les noms, constantes et boites
* \param DB handler d'acces base
*/
function modDroitPret($DB)
{
$this->db = $DB ;
$this->numero = 2200 ;
$this->family = "other";
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
$this->description = "Gestion du droit de prets";
$this->version = 'development'; // 'development' or 'experimental' or 'dolibarr' or version
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
$this->special = 3;
// Dir
$this->dirs = array('/smarty/cache/temp','/smarty/templates/temp');
// Dependances
$this->depends = array();
$this->requiredby = array();
$this->conflictwith = array();
$this->needleftmenu = array();
$this->needtotopmenu = array();
$this->langfiles = array("orders","bills","companies");
// Config pages
$this->config_page_url = array("droitpret.php");
// Constants
//Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',0),
// 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0) );
$this->const=array(1=>array('MAIN_MODULE_DROITPRET_NEEDSMARTY',"chaine",1,'Need smarty',0));
// Boxes
$this->boxes = array();
// Permissions
$this->rights = array();
$this->rights_class = 'droitpret';
$r=0;
$this->rights[$r][0] = 2200;
$this->rights[$r][1] = 'Lire les droits de prets';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1;
$this->rights[$r][4] = 'lire';
$r++;
$this->rights[$r][0] = 2201;
$this->rights[$r][1] = 'Creer/modifier les droits de prets';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'creer';
}
/**
* \brief Fonction appelee lors de l'activation du module. Insere en base les constantes, boites, permissions du module.
* Definit egalement les repertoires de donnees a creer pour ce module.
*/
function init()
{
$sql = array();
return $this->_init($sql);
}
/**
* \brief Fonction appelee lors de la desactivation d'un module.
* Supprime de la base les constantes, boites et permissions du module.
*/
function remove()
{
$sql = array();
return $this->_remove($sql);
}
}
?>

View File

@ -25,7 +25,7 @@
* \version $Id$
*/
require("./pre.inc.php");
require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php");
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
require_once(DOL_DOCUMENT_ROOT."/includes/barcode/html.formbarcode.class.php");

View File

@ -27,7 +27,7 @@
* \version $Id$
*/
require('./pre.inc.php');
require('../main.inc.php');
require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php");
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");

View File

@ -1,271 +0,0 @@
<?php
/* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
\file htdocs/product/droitpret/droitpret.class.php
\ingroup pret
\brief Fichier de la classe ddes droits de pr<EFBFBD>ts
\version $Id$
*/
/**
\class DroitPret
\brief Classe permettant la gestion des droits de prets
*/
class DroitPret
{
var $index;
var $dated;
var $datef;
var $dateEnvoie;
var $format;
var $refFile;
var $fp;
var $nbfact;
function DroitPret($DB,$dated,$datef)
{
global $conf;
$this->db=$DB;
$this->index = 0;
$this->dated = $dated;
$this->datef = $datef;
$this->dateEnvoie = getdate();
$this->format = "aa";
$this->refFile = $conf->global->MAIN_INFO_SOCIETE_GENCOD."_".date("dmY",mktime($this->dateEnvoie['hours'],$this->dateEnvoie['minutes'],$this->dateEnvoie['seconds'],$this->dateEnvoie['mon'],$this->dateEnvoie['mday'],$this->dateEnvoie['year'])).".csv";
}
function CreateNewRapport()
{
global $conf;
$this->nbfact = 0;
$dateEnvoie = date("Y-m-d H:i:s",mktime($this->dateEnvoie['hours'],$this->dateEnvoie['minutes'],$this->dateEnvoie['seconds'],$this->dateEnvoie['mon'],$this->dateEnvoie['mday'],$this->dateEnvoie['year']));
$sql = "INSERT INTO ".MAIN_DB_PREFIX."droitpret_rapport(date_envoie,format,date_debut,date_fin,fichier,nbfact) VALUES('".$dateEnvoie."','".$this->format."','".date("Y-m-d H:i:s",$this->dated)."','".date("Y-m-d H:i:s",$this->datef)."','".$this->refFile."',0)";
$this->db->query($sql);
$lien = $conf->droitpret->dir_temp."/".$this->refFile;
$ref = $this->db->last_insert_id(MAIN_DB_PREFIX."droitpret_rapport");
$this->fp = fopen($lien,"w");
$this->WriteDEB($ref);
$this->WriteTET();
$this->WriteFin();
fclose($this->fp);
$sql = "UPDATE ".MAIN_DB_PREFIX."droitpret_rapport SET nbfact = ".$this->nbfact." WHERE rowid = ".$ref;
$this->db->query($sql);
}
function WriteDEB($ref)
{
$dateEnvoie = date("Ymd",mktime($this->dateEnvoie['hours'],$this->dateEnvoie['minutes'],$this->dateEnvoie['seconds'],$this->dateEnvoie['mon'],$this->dateEnvoie['mday'],$this->dateEnvoie['year']));
$ligne = "DEB".$this->ComplChar($ref,"0",8).$dateEnvoie;
$ligne .= $this->ComplChar($this->format," ",10);
fwrite($this->fp,$ligne."\n");
}
function WriteTET()
{
global $conf;
$sql = "SELECT f.rowid, f.facnumber, f.datec, f.total_ttc, f.total ";
$sql.= "FROM llx_facture AS f, llx_facturedet AS d, llx_product AS p, llx_societe AS s, llx_categorie_societe AS c ";
$sql.= "WHERE f.fk_soc = s.rowid ";
$sql.= "AND c.fk_societe = s.rowid ";
$sql.= "AND d.fk_product = p.rowid ";
$sql.= "AND f.rowid = d.fk_facture ";
$sql.= "AND f.datec >= '".date("Y-m-d H:i:s",$this->dated)."' ";
$sql.= "AND f.datec < '".date("Y-m-d H:i:s",$this->datef)."' ";
$sql.= "AND c.fk_categorie = ".$conf->global->DROITPRET_CAT." ";
$sql.= "GROUP BY f.rowid";
$result = $this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows($result);
$i = 0;
while ($i < $num)
{
$obj = $this->db->fetch_object($result);
$ligne = "TET380".$this->ComplChar($obj->facnumber,"0",25);
$ligne.= $this->FormatDate($obj->datec);
$ligne.= $this->ComplChar("","",25).$this->ComplChar(str_replace(".","",$obj->total_ttc),"0",10);
$ligne.= $this->ComplChar(str_replace(".","",$obj->total),"0",10)."EUR";
fwrite($this->fp,$ligne."\n");
$this->WriteInt($obj->rowid);
$this->WriteLin($obj->rowid);
$this->nbfact++;
$i++;
}
}
}
function WriteINT($fac)
{
global $conf;
$sql = "SELECT f.rowid, s.rowid as socid ";
$sql.= "FROM llx_facture AS f, llx_societe AS s ";
$sql.= "WHERE f.fk_soc = s.rowid ";
$sql.= "AND f.rowid = ".$fac." ";
$result = $this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows($result);
$i = 0;
while ($i < $num)
{
$obj = $this->db->fetch_object($result);
$ligne = "INT".$this->ComplChar($conf->global->MAIN_INFO_SOCIETE_GENCOD,"0",13).$this->ComplChar($obj->socid,"0",13);
fwrite($this->fp,$ligne."\n");
$i++;
}
}
}
function WriteLIN($fac)
{
$sql = "SELECT p.gencode, d.total_ttc,d.qty ";
$sql.= "FROM llx_facture AS f, llx_facturedet AS d, llx_product AS p ";
$sql.= "WHERE d.fk_product = p.rowid ";
$sql.= "AND f.rowid = d.fk_facture ";
$sql.= "AND f.rowid = ".$fac." ";
$result = $this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows($result);
$i = 0;
while ($i < $num)
{
$obj = $this->db->fetch_object($result);
$ligne = "LIN01".$this->ComplChar($obj->gencode,"0",13);
$ligne.= $this->ComplChar(""," ",250).str_replace(".","",$obj->total_ttc);
$ligne.= $this->ComplChar($obj->qty,"0",4);
fwrite($this->fp,$ligne."\n");
$i++;
}
}
}
function WriteFIN()
{
$ligne = "FIN".$this->ComplChar($obj->nbfact,"0",8);
fwrite($this->fp,$ligne);
}
function EnvoiMail()
{
global $langs, $conf;
$subject = ":::EDLFDT01".$this->ComplChar($conf->global->MAIN_INFO_SOCIETE_GENCOD,"0",13);
$sendto = $conf->global->DROITPRET_MAIL;
$from = $conf->global->MAIN_INFO_SOCIETE_MAIL;
$message = "";
$filepath[0] = $conf->droitpret->dir_temp."/".$this->refFile;
$filename[0] = $this->refFile;
$mimetype[0] = 'text/csv';
$sendtocc = "";
$deliveryreceipt = "";
require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php');
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt);
if ($mailfile->error)
{
$mesg='<div class="error">'.$mailfile->error.'</div>';
echo $mesg;
}
else
{
$result=$mailfile->sendfile();
if ($result)
{
$mesg='<div class="ok">'.$langs->trans('MailSuccessfulySent',$from,$sendto).'.</div>';
}
else
{
$mesg='<div class="error">';
if ($mailfile->error)
{
$mesg.="error";
$mesg.='<br>'.$mailfile->error;
}
else
{
$mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
}
$mesg.='</div>';
}
}
return $mesg;
}
function ComplChar($chaine,$char,$size)
{
$chaineSize=strlen ($chaine);
$ComplChar = $chaine;
for ($i = $chaineSize; $i < $size;$i++)
{
$ComplChar = $char.$ComplChar;
}
return $ComplChar;
}
function FormatDate($datetime)
{
$FormatDate = str_replace("-","",$datetime);
$FormatDate = substr($FormatDate,0,8);
return $FormatDate;
}
}
?>

View File

@ -1,136 +0,0 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 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
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/
/**
\file htdocs/compta/dons/index.php
\ingroup don
\brief Page accueil espace don
\version $Revision$
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT ."/product/droitpret/droitpret.class.php");
require_once(DOL_DOCUMENT_ROOT ."/product/droitpret/modules_droitpret.php");
global $conf;
$html = new Form($db);
if($_GET['action'] && $_GET['action'] == 'create')
{
$dated = mktime($_POST['dhour'],$_POST['dmin'],0,$_POST['dmonth'],$_POST['dday'],$_POST['dyear']);
$datef = mktime($_POST['fhour'],$_POST['fmin'],0,$_POST['fmonth'],$_POST['fday'],$_POST['fyear']);
if($dated < $datef)
{
$droitpret = new DroitPret($db,$dated,$datef);
$droitpret->CreateNewRapport();
$mesg = $droitpret->EnvoiMail();
}
else
{
$mesg='<div class="error">'.$langs->trans("ErrorDate").'</div>';
}
}
/*
* Affichage
*/
llxHeader();
print_fiche_titre($langs->trans("DroitPretArea"));
if ($mesg) print "$mesg\n";
$sql = "SELECT MAX(date_fin) as lastRapport FROM ".MAIN_DB_PREFIX."droitpret_rapport";
$result = $db->query($sql);
$obj = $db->fetch_object($result);
$lastRapport = $obj->lastRapport;
print '<form action="index.php?action=create" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="border" width="100%">';
print '<tr><td>Date de début de période</td><td>';
$html->select_date($lastRapport,'d',1,1,'',"dated");
print '</td></tr>';
print '<tr><td>Date de fin de période</td><td>';
$html->select_date('','f',1,1,'',"datef");
print '</td></tr>';
print '</table>';
print '<br><center><input type="submit" class="button" value="Générer"></center>';
print '</form>';
print '<table width="100%" class="noborder">';
print '<tr class="liste_titre"><td>Document</td>';
print '<td>Date du rapport</td>';
print '<td>Début période</td>';
print '<td>Fin période</td>';
print '<td>Nb factures</td>';
print '</tr>';
$sql ="SELECT rowid, date_envoie, date_debut, date_fin, fichier, nbfact";
$sql.=" FROM ".MAIN_DB_PREFIX."droitpret_rapport";
$sql.=" ORDER BY rowid";
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$var = true;
while ($i < $num)
{
$var = !$var;
$obj = $db->fetch_object($resql);
print '<tr '.$bc[$var].'><td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=droitpret&amp;file='.$obj->fichier.'">'.$obj->fichier.'</a></td>';
print '<td>'.$obj->date_envoie.'</td>';
print '<td>'.$obj->date_debut.'</td>';
print '<td>'.$obj->date_fin.'</td>';
print '<td>'.$obj->nbfact.'</td></tr>';
$i++;
}
}
print '</table>';
?>

View File

@ -1,84 +0,0 @@
<?php
/* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* or see http://www.gnu.org/
*/
/**
\file htdocs/product/droitpret/modules_droipret.php
\ingroup droitpret
\brief Fichier contenant la classe m<EFBFBD>re de generation des exports de droits de prets
\version $Id$
*/
/**
\class ModeleDroitPret
\brief Classe m<EFBFBD>re des mod<EFBFBD>les de format d'export de droits de pr<EFBFBD>ts
*/
class ModeleDroitPret
{
/**
* \brief Constructeur
*/
function ModeleDroitPret()
{
}
/**
* \brief Charge en memoire et renvoie la liste des mod<EFBFBD>les actifs
* \param db Handler de base
*/
function liste_rapport($db)
{
$liste=array();
$sql ="SELECT rowid, fichier";
$sql.=" FROM ".MAIN_DB_PREFIX."droitpret_rapport";
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row($resql);
$liste[$row[0]]=$row[1];
$i++;
}
}
else
{
dol_print_error($db);
return -1;
}
return $liste;
}
}
?>

View File

@ -1,41 +0,0 @@
<?php
/* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
\file htdocs/compta/droitpret/pre.inc.php
\ingroup pret
\brief Fichier gestionnaire du menu de gauche de l'espace droitpret
\version $Id$
*/
require("../../main.inc.php");
function llxHeader($head = "", $title="", $help_url='')
{
global $langs;
top_menu($head, $title);
$menu = new Menu();
left_menu($menu->liste, $help_url);
}
?>

View File

@ -28,7 +28,7 @@
* \version $Id$
*/
require("./pre.inc.php");
require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formproduct.class.php");
require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php");
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");

View File

@ -26,7 +26,7 @@
* \version $Id$
*/
require("./pre.inc.php");
require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php");
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
require_once DOL_DOCUMENT_ROOT."/fourn/fournisseur.product.class.php";

View File

@ -25,7 +25,7 @@
* \version $Id$
*/
require("./pre.inc.php");
require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/product.class.php');
$type=isset($_GET["type"])?$_GET["type"]:(isset($_POST["type"])?$_POST["type"]:'');

View File

@ -25,7 +25,7 @@
* \version $Id$
*/
require("./pre.inc.php");
require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/product.class.php');
if ($conf->categorie->enabled) require_once(DOL_DOCUMENT_ROOT."/categories/categorie.class.php");

View File

@ -26,7 +26,7 @@
* \version $Id$
*/
require("./pre.inc.php");
require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php");
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");

View File

@ -20,12 +20,12 @@
*/
/** \file htdocs/product/popuprop.php
\ingroup propal, produit
\brief Liste des produits/services par popularite
\version $Id$
*/
* \ingroup propal, produit
* \brief Liste des produits/services par popularite
* \version $Id$
*/
require("./pre.inc.php");
require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/product.class.php');
// Security check

View File

@ -1,120 +0,0 @@
<?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Auguria SARL <info@auguria.org>
*
* 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
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* \file htdocs/product/pre.inc.php
* \ingroup product,service
* \brief Fichier gestionnaire du menu gauche des produits et services
* \version $Id$
*/
require("../main.inc.php");
$langs->load("products");
function llxHeader($head = '',$help_url='', $title='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='')
{
global $user, $conf, $langs;
top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
$menu = new Menu();
// Products
if ($conf->produit->enabled)
{
$menu->add(DOL_URL_ROOT."/product/index.php?type=0", $langs->trans("Products"));
$menu->add_submenu(DOL_URL_ROOT."/product/liste.php?type=0", $langs->trans("List"));
if ($user->societe_id == 0 && ($user->rights->produit->creer || $user->rights->service->creer))
{
$menu->add_submenu(DOL_URL_ROOT."/product/fiche.php?action=create&amp;type=0", $langs->trans("NewProduct"));
}
}
// Produit specifique
$dir = DOL_DOCUMENT_ROOT . "/product/templates/";
if(is_dir($dir) && ! empty($conf->droitpret->enabled))
{
if ($handle = opendir($dir))
{
while (($file = readdir($handle))!==false)
{
if (substr($file, strlen($file) -10) == '.class.php' && substr($file,0,8) == 'product.')
{
$parts = explode('.',$file);
$classname = 'Product'.ucfirst($parts[1]);
require_once($dir.$file);
$module = new $classname();
if ($module->active === '1' && $module->menu_add === 1)
{
$module->PersonnalizeMenu($menu);
$langs->load("products_".$module->canvas);
for ($j = 0 ; $j < sizeof($module->menus) ; $j++)
{
$menu->add_submenu($module->menus[$j][0], $langs->trans($module->menus[$j][1]));
}
}
}
}
closedir($handle);
}
}
$menu->add_submenu(DOL_URL_ROOT."/product/reassort.php?type=0", $langs->trans("Restock"));
// Services
if ($conf->service->enabled)
{
$menu->add(DOL_URL_ROOT."/product/index.php?type=1", $langs->trans("Services"));
$menu->add_submenu(DOL_URL_ROOT."/product/liste.php?type=1", $langs->trans("List"));
if ($user->societe_id == 0 && ($user->rights->produit->creer || $user->rights->service->creer))
{
$menu->add_submenu(DOL_URL_ROOT."/product/fiche.php?action=create&amp;type=1", $langs->trans("NewService"));
}
}
if ($conf->fournisseur->enabled)
{
$langs->load("suppliers");
$menu->add(DOL_URL_ROOT."/fourn/index.php", $langs->trans("Suppliers"));
}
$menu->add(DOL_URL_ROOT."/product/stats/", $langs->trans("Statistics"));
if ($conf->propal->enabled)
{
$menu->add_submenu(DOL_URL_ROOT."/product/popuprop.php", $langs->trans("Popularity"));
}
if ($conf->stock->enabled)
{
$menu->add(DOL_URL_ROOT."/product/stock/", $langs->trans("Stock"));
}
if ($conf->categorie->enabled)
{
$langs->load("categories");
$menu->add(DOL_URL_ROOT."/categories/index.php?type=0", $langs->trans("ProductsCategoriesShort"));
}
left_menu($menu->liste, $help_url);
}
?>

View File

@ -27,7 +27,7 @@
* \version $Id$
*/
require("./pre.inc.php");
require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php");
require_once(DOL_DOCUMENT_ROOT."/product.class.php");

View File

@ -25,7 +25,7 @@
* \version $Id$
*/
require("./pre.inc.php");
require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/product.class.php');
require_once(DOL_DOCUMENT_ROOT."/categories/categorie.class.php");

View File

@ -1,102 +0,0 @@
{* Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*}
<!-- BEGIN SMARTY TEMPLATE -->
<table width="100%" border="0" class="notopnoleftnoright" style="margin-bottom: 2px;">
<tr>
<td class="nobordernopadding" width="40" align="left" valign="middle">
{$title_picto}
</td>
<td class="nobordernopadding" valign="middle">
<div class="titre">{$title_text}</div>
</td>
</tr>
</table>
<form action="liste.php?canvas=default" method="post" name="formulaire">
<table class="liste" width="100%">
<tr class="liste_titre">
<td class="liste_titre">Référence
<a href="liste.php?sortfield=p.ref&amp;sortorder=asc&amp;begin=&amp;envente=&amp;canvas=default&amp;fourn_id=&amp;snom=&amp;sref=">
<img src="{$url_root}/theme/{$theme}/img/1downarrow.png" border="0" alt="A-Z" title="A-Z">
</a>
<a href="liste.php?sortfield=p.ref&amp;sortorder=desc&amp;begin=&amp;envente=&amp;canvas=default&amp;fourn_id=&amp;snom=&amp;sref=">
<img src="{$url_root}/theme/{$theme}/img/1uparrow.png" border="0" alt="Z-A" title="Z-A">
</a>
</td>
<td class="liste_titre">Libellé
<a href="liste.php?sortfield=p.label&amp;sortorder=asc&amp;canvas=default&amp;fourn_id=&amp;snom=&amp;sref=">
<img src="{$url_root}/theme/{$theme}/img/1downarrow.png" border="0" alt="A-Z" title="A-Z">
</a>
<a href="liste.php?sortfield=p.ref&amp;sortorder=desc&amp;begin=&amp;envente=&amp;canvas=default&amp;fourn_id=&amp;snom=&amp;sref=">
<img src="{$url_root}/theme/{$theme}/img/1uparrow.png" border="0" alt="Z-A" title="Z-A">
</a>
</td>
<td class="liste_titre">Code barre
<a href="liste.php?sortfield=p.label&amp;sortorder=asc&amp;canvas=default&amp;fourn_id=&amp;snom=&amp;sref=">
<img src="{$url_root}/theme/{$theme}/img/1downarrow.png" border="0" alt="A-Z" title="A-Z">
</a>
<a href="liste.php?sortfield=p.ref&amp;sortorder=desc&amp;begin=&amp;envente=&amp;canvas=default&amp;fourn_id=&amp;snom=&amp;sref=">
<img src="{$url_root}/theme/{$theme}/img/1uparrow.png" border="0" alt="Z-A" title="Z-A">
</a>
</td>
<td class="liste_titre" align="center">Date de modification</td>
<td class="liste_titre" align="right">Prix de vente</td>
<td class="liste_titre" align="right">Stock</td>
<td class="liste_titre" align="right">Etat</td>
</tr>
<tr class="liste_titre">
<td class="liste_titre"><input class="flat" type="text" name="sref" value=""></td>
<td class="liste_titre"><input class="flat" type="text" name="snom" value=""></td>
<td class="liste_titre"><input class="flat" type="text" name="sbarcode" value=""></td>
<td class="liste_titre">&nbsp;</td>
<td class="liste_titre">&nbsp;</td>
<td class="liste_titre">&nbsp;</td>
<td class="liste_titre" align="right">
<input type="image" class="liste_titre" name="button_search" src="{$url_root}/theme/{$theme}/img/search.png" alt="Rechercher">
<input type="image" class="liste_titre" name="button_removefilter" src="{$url_root}/theme/{$theme}/img/searchclear.png" alt="Supprimer filtre">
</td>
</tr>
{section name=mysec loop=$datas}
{strip}
<tr class="{cycle values="pair,impair"}">
<td><a href="fiche.php?id={$datas[mysec].id}">{$datas[mysec].ref}</a></td>
<td>{$datas[mysec].label}</td>
<td align="center">{$datas[mysec].barcode}</td>
<td align="center">{$datas[mysec].datem}</td>
<td align="right">{$datas[mysec].sellingprice}</td>
<td align="right">{$datas[mysec].stock}</td>
<td align="right">{$datas[mysec].status}</td>
</tr>
{/strip}
{/section}
</table>
</form>
<!-- END SMARTY TEMPLATE -->

View File

@ -1,109 +0,0 @@
{* Copyright (C) 2006-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2007 Auguria SARL <info@auguria.org>
*
* 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
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*}
<!-- BEGIN SMARTY TEMPLATE -->
<table width="100%" border="0" class="notopnoleftnoright" style="margin-bottom: 2px;">
<tr>
<td class="nobordernopadding" width="40" align="left" valign="middle">
{$title_picto}
</td>
<td class="nobordernopadding" valign="middle">
<div class="titre">{$langs->trans('Books')}</div>
</td>
</tr>
</table>
<form action="liste.php?canvas=livre" method="post" name="formulaire">
<table class="liste" width="100%">
<tr class="liste_titre">
<td class="liste_titre">{$langs->trans('Case')}
</td>
<td class="liste_titre">{$langs->trans('Ref')}
<a href="liste.php?sortfield=p.ref&amp;sortorder=asc&amp;begin=&amp;envente=&amp;canvas=livre&amp;fourn_id=&amp;snom=&amp;sref=">
<img src="{$url_root}/theme/{$theme}/img/1downarrow.png" border="0" alt="A-Z" title="A-Z">
</a>
<a href="liste.php?sortfield=p.ref&amp;sortorder=desc&amp;begin=&amp;envente=&amp;canvas=livre&amp;fourn_id=&amp;snom=&amp;sref=">
<img src="{$url_root}/theme/{$theme}/img/1uparrow.png" border="0" alt="Z-A" title="Z-A">
</a>
</td>
<td class="liste_titre">{$langs->trans('Title')}
<a href="liste.php?sortfield=p.label&amp;sortorder=asc&amp;canvas=livre&amp;fourn_id=&amp;snom=&amp;sref=">
<img src="{$url_root}/theme/{$theme}/img/1downarrow.png" border="0" alt="A-Z" title="A-Z">
</a>
<a href="liste.php?sortfield=p.ref&amp;sortorder=desc&amp;begin=&amp;envente=&amp;canvas=livre&amp;fourn_id=&amp;snom=&amp;sref=">
<img src="{$url_root}/theme/{$theme}/img/1uparrow.png" border="0" alt="Z-A" title="Z-A">
</a>
</td>
<td class="liste_titre" align="center">Casier</td>
<td class="liste_titre" align="center">Entrepot</td>
<td class="liste_titre" align="center">Ventes</td>
<td class="liste_titre">Stock</td>
<td class="liste_titre" align="center">Pages</td>
<td class="liste_titre" align="right">Prix</td>
<td class="liste_titre" align="right">Valorisation
</td>
<td class="liste_titre" align="right">Action
</td>
</tr>
<tr class="liste_titre">
<td class="liste_titre">&nbsp;</td>
<td class="liste_titre"><input class="flat" type="text" name="sref" value=""></td>
<td class="liste_titre"><input class="flat" type="text" name="snom" value=""></td>
<td class="liste_titre">&nbsp;</td>
<td class="liste_titre">&nbsp;</td>
<td class="liste_titre">&nbsp;</td>
<td class="liste_titre">&nbsp;</td>
<td class="liste_titre">&nbsp;</td>
<td class="liste_titre">&nbsp;</td>
<td class="liste_titre">&nbsp;</td>
<td class="liste_titre" align="right">
<input type="image" class="liste_titre" name="button_search" src="{$url_root}/theme/{$theme}/img/search.png" alt="Rechercher">
<input type="image" class="liste_titre" name="button_removefilter" src="{$url_root}/theme/{$theme}/img/searchclear.png" alt="Supprimer filtre">
</td>
</tr>
{section name=mysec loop=$datas}
{strip}
<tr class="{cycle values="pair,impair"}">
<td>$datas</td>
<td><a href="fiche.php?id={$datas[mysec].id}">{$datas[mysec].ref}</a></td>
<td>{$datas[mysec].titre}</td>
<td align="center">{$datas[mysec].casier}</td>
<td align="center">{$datas[mysec].entrepot}</td>
<td>{$datas[mysec].ventes}</td>
<td>{$datas[mysec].stock}</td>
<td align="center">{$datas[mysec].pages}</td>
<td align="right">{$datas[mysec].prix}</td>
<td align="right">{$datas[mysec].valo}</td>
</tr>
{/strip}
{/section}
</table>
</form>
<!-- END SMARTY TEMPLATE -->

View File

@ -1,227 +0,0 @@
{* Copyright (C) 2006-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2007 Auguria SARL <info@auguria.org>
*
* 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
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*}
<!-- BEGIN SMARTY TEMPLATE -->
<table width="100%" border="0" class="notopnoleftnoright" style="margin-bottom: 2px;">
<tr>
<td class="nobordernopadding" width="40" align="left" valign="middle">
{$title_picto}
</td>
<td class="nobordernopadding" valign="middle">
<div class="titre">{$title_text}</div>
</td>
</tr>
</table>
<form id="evolForm" action="fiche.php" method="post">
<input type="hidden" name="action" value="add">
<input type="hidden" name="type" value="0">
<input type="hidden" name="canvas" value="livre">
<input type="hidden" name="price_base_type" value="TTC">
<table class="border" width="100%">
<tr>
<td width="15%">Référence</td>
<td colspan="2">
<input name="ref" size="20" value="{$prod_ref}"
class="{$class_normal_ref}" onfocus="this.className='{$class_focus_ref}';" onblur="this.className='{$class_normal_ref}';">
</td>
</tr>
<tr>
<td width="15%">Titre</td>
<td width="85%" colspan="3">
<input name="libelle" size="40" value="{$prod_label}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
</tr>
<tr>
<td width="15%">ISBN</td>
<td width="35%">
<input name="isbna" size="2" maxlength="12" value="{$prod_isbna}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">-
<input name="isbnb" size="8" maxlength="7" value="{$prod_isbnb}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">-
<input name="isbnc" size="13" maxlength="12" class="normal" value="{$prod_isbnc}"
onfocus="this.className='focus';" onblur="this.className='normal';" >
{$prod_isbn}
</td>
<td width="15%">ISBN-13</td>
<td width="35%"><i>sera calculé</i>
</td>
</tr>
<tr>
<td width="15%">EAN</td>
<td colspan="3" width="85%"><i>sera calculé</i></td>
</tr>
<tr>
<td>Pages</td>
<td>
<input name="pages" size="6" maxlength="5" value="{$prod_pages}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
<td>Format</td>
<td>
<select class="flat" name="format">
{html_options values=$livre_available_formats output=$livre_available_formats selected="$prod_format"}
</select>
</td>
</tr>
<tr>
<td>Prix au feuillet</td>
<td>
<input name="px_feuillet" type="text" size="7" maxlength="6" value="{$prod_pxfeuil}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';"> HT
</td>
<td>Prix couverture</td>
<td>
<input name="px_couverture" type="text" size="7" maxlength="6" value="{$prod_pxcouv}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';"> HT
</td>
</tr>
<tr>
<td>Prix de revient</td>
<td><i>sera calculé</i></td>
<td>Prix reliure</td>
<td>
<input name="px_reliure" type="text" size="7" maxlength="6" value="{$prod_pxreliure}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
</tr>
<tr>
<td>Prix de vente</td>
<td>
<input name="price" type="text" size="7" maxlength="6" value="{$prod_price}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';"> TTC
</td>
<td>Taux TVA</td>
<td>
<select class="flat" name="tva_tx">
{html_options values=$tva_taux_value output=$tva_taux_libelle selected="5.5"}
</select>
</td>
</tr>
</table>
<br>
<table class="border" width="100%">
<tr>
<td width="15%">Seuil stock</td>
<td width="35%">
<input name="seuil_stock_alerte" size="4" value="{$prod_seuil_stock_alerte}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
<td width="15%">Emplacement Stock</td>
<td width="35%">
<input name="stock_loc" size="8" value="{$prod_stock_loc}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
</tr>
<tr>
<td>Statut</td>
<td>
<select class="flat" name="statut">
<option value="1" selected="true">En vente</option>
<option value="0">Hors vente</option>
</select>
</td>
<td>Poids</td>
<td>
<input name="weight" size="5" value="{$prod_weight}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">g
<input name="weight_units" type="hidden" value="-3">
</td>
</tr>
</table>
<br>
<table class="border" width="100%">
<tr>
<td>Auteur / Editeur</td>
<td>
<select class="flat" name="auteur">
{html_options options=$livre_available_auteurs selected=$livre_auteur_id}
</select>
</td>
<td>Saisi par</td>
<td>
{$user}
</td>
</tr>
<tr>
<td width="15%">Durée du contrat :</td>
<td width="35%">
<input name="contrat_duree" type="text" size="7" maxlength="6" value="{$livre_contrat_duree}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
<td width="15%">Date d'application</td>
<td width="35%">{html_select_date field_order='DMY' start_year='-10' reverse_years=True all_extra='class="flat"'}</td>
</tr>
<tr>
<td>Taux conclu</td>
<td>
<input name="contrat_taux" type="text" size="7" maxlength="6" value="{$livre_contrat_taux}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">%
</td>
<td>Quantité achetée</td>
<td>
<input name="contrat_quant" type="text" size="7" maxlength="6" value="{$livre_contrat_quant}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
</tr>
</table>
<br>
<table class="border" width="100%">
<tr>
<td width="15%" valign="top">Description</td>
<td width="85%" colspan="3">
<textarea name="desc" rows="6" cols="70"></textarea>
</td>
</tr>
<tr>
<td width="15%" valign="top">Note (non visible sur les factures, propals...)
</td>
<td width="85%" colspan="3">
<textarea name="note" rows="4" cols="70"></textarea>
</td>
</tr>
<tr>
<td colspan="4" align="center">
<input type="submit" class="button" value="Créer">
</td>
</tr>
</table>
</form>
<!-- END SMARTY TEMPLATE -->

View File

@ -1,267 +0,0 @@
{* Copyright (C) 2006-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2007 Auguria SARL <info@auguria.org>
*
* 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
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*}
<!-- BEGIN SMARTY TEMPLATE -->
<form id="evolForm" action="fiche.php" method="post">
<input type="hidden" name="action" value="update">
<input type="hidden" name="id" value="{$prod_id}">
<input type="hidden" name="canvas" value="{$prod_canvas}">
<input type="hidden" name="price_base_type" value="TTC">
<table width="100%" border="0" class="notopnoleftnoright">
<tr>
<td class="notopnoleftnoright" valign="middle">
<div class="titre">Éditer Livre</div>
</td>
</tr>
</table>
<table class="border" width="100%">
<tr>
<td width="15%">Réf.</td>
<td colspan="2">
<input name="ref" size="20" value="{$prod_ref}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
</tr>
<tr>
<td width="15%">Titre</td>
<td width="85%" colspan="3">
<input name="libelle" size="40" value="{$prod_label}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
</tr>
<tr>
<td width="15%">ISBN</td>
<td width="35%">
<input name="isbna" size="2" maxlength="12" value="{$prod_isbna}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">-
<input name="isbnb" size="8" maxlength="7" value="{$prod_isbnb}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">-
<input name="isbnc" size="13" maxlength="12" class="normal" value="{$prod_isbnc}"
onfocus="this.className='focus';" onblur="this.className='normal';" >
{$prod_isbn}
</td>
<td width="15%">ISBN-13</td>
<td width="35%">978-
<input name="isbn13" size="13" maxlength="12" class="normal"
onfocus="this.className='focus';" onblur="this.className='normal';" value="{$prod_isbn}">
</td>
</tr>
<tr>
<td width="15%">EAN</td>
<td width="35%">
<input class="normal" name="ean" size="16" maxlength="15" value="{$prod_ean}"
onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
<td>Code barre</td>
<td>{$prod_ean}</td>
</tr>
<tr>
<td>Pages</td>
<td>
<input name="pages" size="6" maxlength="5" value="{$prod_pages}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
<td>Format</td>
<td>
<select class="flat" name="format">
{html_options values=$livre_available_formats output=$livre_available_formats selected="$prod_format"}
</select>
</td>
</tr>
<tr>
<td>Poids</td>
<td colspan="3">
<input name="weight" size="5" value="{$prod_weight}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">g
<input name="weight_units" type="hidden" value="-3">
</td>
</tr>
<tr>
<td>Prix au feuillet</td>
<td>
<input name="px_feuillet" type="text" size="7" maxlength="6" value="{$prod_pxfeuil}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
<td>Prix couverture</td>
<td>
<input name="px_couverture" type="text" size="7" maxlength="6" value="{$prod_pxcouv}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
</tr>
<tr>
<td>Prix de revient</td>
<td>{$prod_pxrevient}</td>
<td>Prix reliure</td>
<td>
<input name="px_reliure" type="text" size="7" maxlength="6" value="{$prod_pxreliure}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
</tr>
</table>
<br>
<table class="border" width="100%">
<tr>
<td width="15%">Prix de vente</td>
<td width="35%">{$prod_pxvente} TTC</td>
<td width="15%">Taux TVA</td>
<td width="35%">
<select class="flat" name="tva_tx">
{html_options values=$tva_taux_value output=$tva_taux_libelle selected="$prod_tva_tx"}
</select>
</td>
</tr>
</table>
<br>
<table class="border" width="100%">
<tr>
<td width="15%">Stock disponible</td>
<td width="35%"><b>{$prod_stock_dispo}</b></td>
<td width="15%">Seuil d'alerte stock</td>
<td width="35%">
<input name="seuil_stock_alerte" size="4" value="{$prod_seuil_stock_alerte}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
</tr>
<tr>
<td width="15%">Emplacement Stock</td>
<td width="85%" colspan="3">
<input name="stock_loc" size="8" value="{$prod_stock_loc}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
</tr>
<tr>
<td>Statut</td>
<td colspan="3">
<select class="flat" name="statut">
{html_options values=$prod_statuts_id output=$prod_statuts_value selected="$prod_statut_id"}
</select>
</td>
</tr>
</table>
<br>
<table class="border" width="100%">
{if $livre_contrat_locked eq '0'}
<tr>
<td>Auteur / Editeur</td>
<td>
<select class="flat" name="auteur">
{html_options options=$livre_available_auteurs selected=$livre_auteur_id}
</select>
</td>
<td>Saisi par</td><td>{$livre_contrat_user_fullname}</td>
</tr>
<tr>
<td width="15%">Durée du contrat :</td>
<td width="35%">
<input name="contrat_duree" type="text" size="7" maxlength="6" value="{$livre_contrat_duree}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
<td width="15%">Date d'application</td>
<td width="35%">
{html_select_date field_order='DMY' start_year='-10' time=$livre_contrat_date_app reverse_years=True all_extra='class="flat"'}
</td>
</tr>
<tr>
<td>Taux conclu</td>
<td>
<input name="contrat_taux" type="text" size="7" maxlength="6" value="{$livre_contrat_taux}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">%
</td>
<td>Quantité achetée</td>
<td>
<input name="contrat_quant" type="text" size="7" maxlength="6" value="{$livre_contrat_quant}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
</tr>
<tr>
<td>Validation du contrat</td>
<td>
<input type="checkbox" name="locked" value="locked" />
</td>
<td colspan="2">En cochant la case vous interdisez toute modifications</td>
</tr>
{else}
<tr>
<td>Auteur / Editeur</td>
<td>{$livre_auteur}</td>
<td>Saisi par</td><td>{$livre_contrat_user_fullname}</td>
</tr>
<tr>
<td width="15%">Durée du contrat : </td>
<td width="35%">{$livre_contrat_duree}</td>
<td width="15%">Date d'application</td>
<td width="35%">{$livre_contrat_date_app|date_format:"%d %B %Y"}</td>
</tr>
<tr>
<td>Taux conclu</td>
<td>{$livre_contrat_taux} %</td>
<td>Quantité achetée</td>
<td>{$livre_contrat_quant}</td>
</tr>
{/if}
</table>
<br>
<table class="border" width="100%">
<tr>
<td valign="top">Description</td>
<td colspan="3">
<textarea name="desc" rows="6" cols="70"></textarea>
</td>
</tr>
<tr>
<td valign="top">Note (non visible sur les factures, propals...)
</td>
<td colspan="3">
<textarea name="note" rows="4" cols="70"></textarea>
</td>
</tr>
<tr>
<td colspan="4" align="center">
<input type="submit" class="button" value="Enregistrer">&nbsp;
<input type="submit" class="button" name="cancel" value="Annuler">
</td>
</tr>
</table>
</form>
<!-- END SMARTY TEMPLATE -->

View File

@ -1,157 +0,0 @@
{* Copyright (C) 2006-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2007 Auguria SARL <info@auguria.org>
*
* 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
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*}
<!-- BEGIN SMARTY TEMPLATE -->
<table class="border" width="100%">
<tr>
<td width="15%">Référence</td>
<td width="35%" style="font-weight: bold;">{$prod_ref}</td>
<td width="50%" colspan="2" align="right">
{$fiche_cursor_prev}{$fiche_cursor_next}
</td>
</tr>
<tr>
<td width="15%">Titre</td>
<td width="85%" colspan="3">{$prod_label}</td>
</tr>
<tr>
<td width="15%">ISBN</td>
<td width="35%">{$prod_isbn}</td>
<td width="15%">ISBN-13</td>
<td width="35%">{$prod_isbn13}</td>
</tr>
<tr>
<td width="15%">EAN</td>
<td width="35%">{$prod_ean}</td>
<td>Code barre</td>
<td>{$prod_ean}</td>
</tr>
<tr>
<td>Pages</td>
<td>{$prod_pages}</td>
<td>Format</td>
<td>{$prod_format}</td>
</tr>
<tr>
<td>Poids</td>
<td colspan="3">{$prod_weight}g</td>
</tr>
</table>
<br>
<table class="border" width="100%">
<tr>
<td width="15%">Prix au feuillet</td>
<td width="35%">{$prod_pxfeuil} HT</td>
<td width="15%"><a href="fiche.php?id={$livre_couverture_id}">Prix couverture</a></td>
<td width="35%">{$prod_pxcouv} HT</td>
</tr>
<tr>
<td width="15%">Prix de revient</td>
<td width="35%">{$prod_pxrevient} HT</td>
<td width="15%">Prix reliure</td>
<td width="35%">{$prod_pxreliure} HT</td>
</tr>
<tr>
<td>Prix de vente</td>
<td>{$prod_pxvente} TTC</td>
<td width="15%">Taux TVA</td>
<td width="35%">{$prod_tva_tx} %</td>
</tr>
</table>
<br>
<table class="border" width="100%">
<tr>
<td width="15%">Stock disponible</td>
<td width="35%" {$smarty_stock_dispo_class}>{$prod_stock_dispo}</td>
<td width="15%">Seuil d'alerte</td>
<td width="35%">{$prod_stock_alert}</td>
</tr>
<tr>
<td width="15%">Stock réel</td>
<td width="35%">{$prod_stock_reel}</td>
<td width="15%">Exemplaires en commande</td>
<td width="35%">{$prod_stock_in_command}</td>
</tr>
<tr>
<td>Emplacement Stock</td>
<td colspan="3">{$prod_stock_loc}</td>
</tr>
<tr>
<td>Statut</td>
<td colspan="3">{$prod_statut}</td>
</tr>
</table>
<br>
<table class="border" width="100%">
<tr>
<td>Auteur / Editeur</td>
<td>{$livre_auteur}</td>
<td>Saisi par</td>
<td>
{$livre_contrat_user_fullname}
</td>
</tr>
<tr>
<td width="15%">Durée du contrat : </td>
<td width="35%">{$livre_contrat_duree}</td>
<td width="15%">Date d'application</td>
<td width="35%">{$livre_contrat_date_app|date_format:"%d %B %Y"}</td>
</tr>
<tr>
<td>Taux conclu</td>
<td>{$livre_contrat_taux} %</td>
<td>Quantité achetée</td>
<td>{$livre_contrat_quant}</td>
</tr>
</table>
<br>
<table class="border" width="100%">
<tr>
<td width="15%" valign="top">Description</td>
<td width="85%">{$prod_description}</td>
</tr>
<tr>
<td width="15%" valign="top">Note (non visible sur les factures, propals...)</td>
<td width="85%">{$prod_note}</td>
</tr>
</table>
<!-- END SMARTY TEMPLATE -->

View File

@ -1,110 +0,0 @@
{* Copyright (C) 2006-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2007 Auguria SARL <info@auguria.org>
*
* 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
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*}
<!-- BEGIN SMARTY TEMPLATE -->
<form id="evolForm" action="fiche.php" method="post">
<input type="hidden" name="action" value="update">
<input type="hidden" name="id" value="{$prod_id}">
<input type="hidden" name="ref" value="{$prod_ref}">
<input type="hidden" name="libelle" value="{$prod_label}">
<input type="hidden" name="canvas" value="{$prod_canvas}">
<input type="hidden" name="statut" value="0">
<table class="border" width="100%">
<tr>
<td width="15%">Réf.</td>
<td >{$prod_ref}</td>
</tr>
<tr>
<td width="15%">Titre</td>
<td width="85%" >{$prod_label}</td>
</tr>
</table>
<br>
<table class="border" width="100%">
<tr>
<td width="15%">Stock</td>
<td width="35%"><b>{$prod_stock_dispo}</b></td>
<td width="15%">Seuil d'alerte stock</td>
<td width="35%">
<input name="seuil_stock_alerte" size="4" value="{$prod_seuil_stock_alerte}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
</tr>
</table>
<br>
<table class="border" width="100%">
<tr>
<td width="15%">Durée du contrat :</td>
<td width="35%">
<input name="contrat_duree" type="text" size="7" maxlength="6" value="{$prod_contrat_duree}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
<td width="15%">Date d'application</td>
<td width="35%">{html_select_date field_order='DMY' time=$prod_contrat_date_app start_year='-10' reverse_years=True}</td>
</tr>
<tr>
<td>Taux conclu</td>
<td>
<input name="contrat_taux" type="text" size="7" maxlength="6" value="{$prod_contrat_taux}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">%
</td>
<td>Quantité achetée</td>
<td>
<input name="contrat_quant" type="text" size="7" maxlength="6" value="{$prod_contrat_quant}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
</tr>
</table>
<br>
<table class="border" width="100%">
<tr>
<td width="15%" valign="top">Description</td>
<td width="85%">
<textarea name="desc" rows="6" cols="70">{$prod_description}</textarea>
</td>
</tr>
<tr>
<td width="15%" valign="top">Note (non visible sur les factures, propals...)
</td>
<td width="85%">
<textarea name="note" rows="4" cols="70">{$prod_note}</textarea>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" class="button" value="Enregistrer">&nbsp;
<input type="submit" class="button" name="cancel" value="Annuler">
</td>
</tr>
</table>
</form>
<!-- END SMARTY TEMPLATE -->

View File

@ -1,94 +0,0 @@
{* Copyright (C) 2006-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2007 Auguria SARL <info@auguria.org>
*
* 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
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*}
<!-- BEGIN SMARTY TEMPLATE -->
<table class="border" width="100%">
<tr>
<td width="15%">Référence</td>
<td width="35%" style="font-weight: bold;">{$prod_ref}</td>
<td width="50%" colspan="2" align="right">
{$fiche_cursor_prev}{$fiche_cursor_next}
</td>
</tr>
<tr>
<td width="15%">Titre</td>
<td width="85%" colspan="3">{$prod_label}</td>
</tr>
</table>
<br/>
<table class="border" width="100%">
<tr>
<td width="15%">Stock</td>
<td width="35%" {$smarty_stock_dispo_class}>
{$prod_stock_dispo}
</td>
<td width="15%">Seuil d'alerte</td>
<td width="35%">{$prod_stock_alert}</td>
</tr>
<tr>
<td width="15%">Stock réel</td>
<td width="35%">{$prod_stock_reel}</td>
<td width="15%">Exemplaires en commande</td>
<td width="35%">{$prod_stock_in_command}</td>
</tr>
</table>
<br>
<table class="border" width="100%">
<tr>
<td width="15%">Durée du contrat : </td>
<td width="35%">{$prod_contrat_duree}</td>
<td width="15%">Date d'application</td>
<td width="35%">{$prod_contrat_date_app|date_format:"%e %B %Y"}</td>
</tr>
<tr>
<td>Taux conclu</td>
<td>{$prod_contrat_taux}</td>
<td>Quantité achetée</td>
<td>{$prod_contrat_quant}</td>
</tr>
</table>
<br>
<table class="border" width="100%">
<tr>
<td width="15%" valign="top">Description</td>
<td width="85%">{$prod_description|nl2br}</td>
</tr>
<tr>
<td valign="top">Note (non visible sur les factures, propals...)</td>
<td>{$prod_note|nl2br}</td>
</tr>
</table>
<!-- END SMARTY TEMPLATE -->

View File

@ -1,212 +0,0 @@
{* Copyright (C) 2006-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2007 Auguria SARL <info@auguria.org>
*
* 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
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*}
<!-- BEGIN SMARTY TEMPLATE -->
<form id="evolForm" action="fiche.php" method="post">
<input type="hidden" name="action" value="update">
<input type="hidden" name="id" value="{$prod_id}">
<input type="hidden" name="canvas" value="{$prod_canvas}">
<table class="border" width="100%">
<tr>
<td width="15%">Réf.</td>
<td colspan="2">
<input name="ref" size="20" value="{$prod_ref}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
</tr>
<tr>
<td width="15%">Titre</td>
<td width="85%" colspan="3">
<input name="libelle" size="40" value="{$prod_label}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
</tr>
<tr>
<td width="15%">ISBN</td>
<td width="35%">
<input name="isbna" size="2" maxlength="12" value="{$prod_isbna}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">-
<input name="isbnb" size="8" maxlength="7" value="{$prod_isbnb}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">-
<input name="isbnc" size="13" maxlength="12" class="normal" value="{$prod_isbnc}"
onfocus="this.className='focus';" onblur="this.className='normal';" >
{$prod_isbn}
</td>
<td width="15%">ISBN-13</td>
<td width="35%">978-
<input name="isbn13" size="13" maxlength="12" class="normal"
onfocus="this.className='focus';" onblur="this.className='normal';" value="{$prod_isbn}">
</td>
</tr>
<tr>
<td width="15%">EAN</td>
<td width="35%">
<input class="normal" name="ean" size="16" maxlength="15" value="{$prod_ean}"
onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
<td>Code barre</td>
<td>{$prod_ean}</td>
</tr>
<tr>
<td>Pages</td>
<td>
<input name="pages" size="6" maxlength="5" value="{$prod_pages}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
<td>Format</td>
<td>
<input name="format" size="8" maxlength="7" value="{$prod_format}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
</tr>
<tr>
<td>Prix au feuillet</td>
<td>
<input name="px_feuillet" type="text" size="7" maxlength="6" value="{$prod_pxfeuil}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
<td>Prix couverture</td>
<td>
<input name="px_couverture" type="text" size="7" maxlength="6" value="{$prod_pxcouv}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
</tr>
<tr>
<td>Prix de revient</td>
<td colspan="3">{$prod_pxrevient}</td>
</tr>
</table>
<br>
<table class="border" width="100%">
<tr>
<td width="15%">Prix de vente</td>
<td width="35%">{$prod_pxvente}</td>
<td width="15%">Taux TVA</td>
<td width="35%">
<select class="flat" name="tva_tx">
<option value="0">0%</option>
<option value="5.5">5.5%</option>
<option value="19.6" selected="true">19.6%</option>
</select>
</td>
</tr>
</table>
<br>
<table class="border" width="100%">
<tr>
<td width="15%">Stock</td>
<td width="35%"><b>{$prod_stock_dispo}</b></td>
<td width="15%">Seuil d'alerte stock</td>
<td width="35%">
<input name="seuil_stock_alerte" size="4" value="{$prod_seuil_stock_alerte}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
</tr>
<tr>
<td width="15%">Emplacement Stock</td>
<td width="85%" colspan="3">
<input name="stock_loc" size="8" value=""
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
</tr>
<tr>
<td>Statut</td>
<td colspan="3">
<select class="flat" name="statut">
<option value="1" selected="true">En vente</option>
<option value="0">Hors vente</option>
</select>
</td>
</tr>
</table>
<br>
<table class="border" width="100%">
<tr>
<td width="15%">Durée du contrat :</td>
<td width="35%">
<input name="contrat_duree" type="text" size="7" maxlength="6" value="{$prod_contrat_duree}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
<td width="15%">Date d'application</td>
<td width="35%">
<input name="contrat_date_app" type="text" size="7" maxlength="6" value="{$prod_contrat_date_app}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
</tr>
<tr>
<td>Taux conclu</td>
<td>
<input name="contrat_taux" type="text" size="7" maxlength="6" value="{$prod_contrat_taux}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">%
</td>
<td>Quantité achetée</td>
<td>
<input name="contrat_quant" type="text" size="7" maxlength="6" value="{$prod_contrat_quant}"
class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
</td>
</tr>
<tr>
<td valign="top">Description</td>
<td colspan="3">
<textarea name="desc" rows="6" cols="70"></textarea>
</td>
</tr>
<tr>
<td valign="top">Note (non visible sur les factures, propals...)
</td>
<td colspan="3">
<textarea name="note" rows="4" cols="70"></textarea>
</td>
</tr>
<tr>
<td colspan="4" align="center">
<input type="submit" class="button" value="Enregistrer">&nbsp;
<input type="submit" class="button" name="cancel" value="Annuler">
</td>
</tr>
</table>
</form>
<!-- CUT HERE -->
<!-- END SMARTY TEMPLATE -->

View File

@ -1,59 +0,0 @@
{* Copyright (C) 2006-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2007 Auguria SARL <info@auguria.org>
*
* 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
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*}
<!-- BEGIN SMARTY TEMPLATE -->
<table class="border" width="100%">
<tr>
<td width="15%">Réf</td>
<td width="35%" style="font-weight: bold;">{$livre_ref}</td>
<td width="50%" align="right">
&nbsp;
</td>
</tr>
<tr>
<td width="15%">Couverture du livre</td>
<td width="85%" colspan="2"><a href="fiche.php?id={$livre_id}">{$livre_label}</a></td>
</tr>
</table>
<br>
<table class="border" width="100%">
<tr>
<td width="15%">Stock</td>
<td width="35%" {$smarty_stock_dispo_class}>{$prod_stock_dispo}</td>
<td width="15%">Seuil d'alerte</td>
<td width="35%">{$prod_stock_alert}</td>
</tr>
<tr>
<td width="15%">Stock réel</td>
<td width="35%">{$prod_stock_reel}</td>
<td width="15%">Exemplaires en commande</td>
<td width="35%">{$prod_stock_in_command}</td>
</tr>
</table>
<br>
<!-- END SMARTY TEMPLATE -->

View File

@ -1,615 +0,0 @@
<?php
/* Copyright (C) 2006-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2007 Auguria SARL <info@auguria.org>
*
* 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
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* \file htdocs/product/templates/product.livre.class.php
* \ingroup produit
* \brief Fichier de la classe des produits specifiques de type livre
* \version $Id$
*/
require_once(DOL_DOCUMENT_ROOT.'/product/templates/product.livrecontrat.class.php');
/**
* \class ProductLivre
* \brief Classe permettant la gestion des livres, cette classe surcharge la classe produit
*/
class ProductLivre extends Product
{
//! Numero d'erreur Plage 1280-1535
var $errno = 0;
/**
* \brief Constructeur de la classe
* \param DB Handler acces base de donnees
* \param id Id produit (0 par defaut)
*/
function ProductLivre($DB=0, $id=0, $user=0)
{
$this->db = $DB;
$this->id = $id ;
$this->user = $user;
$this->canvas = "livre";
$this->name = "livre";
$this->description = "Gestion des livres";
$this->active = PRODUIT_SPECIAL_LIVRE;
$this->menu_new = 'NewBook';
$this->menu_add = 1;
$this->menu_clear = 1;
$this->no_button_copy = 1;
$this->menus[0][0] = DOL_URL_ROOT."/product/fiche.php?action=create&amp;type=0&amp;canvas=livre";
$this->menus[0][1] = 'NewBook';
$this->menus[1][0] = DOL_URL_ROOT."/product/liste.php?canvas=livre";
$this->menus[1][1] = 'ListBook';
/*
$this->menus[2][0] = DOL_URL_ROOT."/product/liste.php?canvas=livrecontrat";
$this->menus[2][1] = 'ListContract';
$this->menus[3][0] = DOL_URL_ROOT."/product/liste.php?canvas=livrecouverture";
$this->menus[3][1] = 'ListCover';
*/
$this->next_prev_filter = "canvas='livre'";
$this->onglets[0][0] = 'URL';
$this->onglets[0][1] = 'Editeur';
$this->onglets[1][0] = 'URL';
$this->onglets[1][1] = 'Editeur1';
}
function GetListeTitre()
{
return 'Livres';
}
/**
* \brief Personnalise les menus
* \param menu Objet Menu
* \todo Rodo - faire plus propre c'est trop goret
*/
function PersonnalizeMenu(&$menu)
{
$menu->remove_last();
$menu->remove_last();
}
/**
* \brief Creation
* \param id Id livre
*/
function Create($user,$datas)
{
$this->db->begin();
$id = parent::Create($user);
$this->pages = abs(trim($datas["pages"]));
$this->px_feuillet = price2num($datas["px_feuillet"]);
$this->px_reliure = price2num($datas["px_reliure"]);
$this->px_couverture = price2num($datas["px_couverture"]);
$this->stock_loc = trim($datas["stock_loc"]);
if ($id > 0)
{
$this->errno = 0;
}
if ( $this->errno === 0 )
{
$sql = " INSERT INTO ".MAIN_DB_PREFIX."product_cnv_livre (rowid)";
$sql.= " VALUES ('".$id."');";
$result = $this->db->query($sql) ;
if ($result)
{
$this->errno = 0;
}
else
{
$this->_setErrNo("Create",1282);
}
}
// Creation du contrat associe
if ( $this->errno === 0 )
{
$this->contrat = new ProductLivreContrat($this->db);
$this->contrat->ref = $this->ref.'-CL';
$this->contrat->libelle = 'Contrat';
$this->contrat->price = 0;
$this->contrat->tva_tx = 0;
$this->contrat->type = 0;
$this->contrat->status = 0;
$this->contrat->description = 'Droits du livre';
$this->contrat->seuil_stock_alerte = $_POST["seuil_stock_alerte"];
$this->contrat->canvas = 'livrecontrat';
$contrat_id = $this->contrat->Create($user, $this->id, $datas);
if ($contrat_id > 0)
{
$this->add_subproduct($this->contrat->id);
}
}
// Creation du produit couverture
if ( $this->errno === 0 )
{
$this->couverture = new Product($this->db);
$this->couverture->ref = $this->ref.'-CO';
$this->couverture->libelle = 'Couverture';
$this->couverture->price = 0;
$this->couverture->tva_tx = 0;
$this->couverture->type = 0;
$this->couverture->status = 0;
$this->couverture->description = 'Couverture du livre';
$this->couverture->seuil_stock_alerte = $_POST["seuil_stock_alerte"];
$this->couverture->canvas = 'livrecouverture';
$this->couverture_id = $this->couverture->create($user);
if ($this->couverture_id > 0)
{
$this->add_subproduct($this->couverture_id);
}
}
if ( $this->errno === 0 )
{
$this->UpdateCanvas($datas);
}
if ( $this->errno === 0 )
{
$this->db->commit();
return $this->id;
}
else
{
$this->db->rollback();
dol_syslog("ProductLivre::Create ROLLBACK ERRNO (".$this->errno.")");
return -1;
}
}
/**
* \brief Supression
* \param id Id livre
*/
function DeleteCanvas($id)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_cnv_livre ";
$sql.= " WHERE rowid = '".$id."';";
$result = $this->db->query($sql) ;
return 0;
}
/**
* \brief Lecture des donnees dans la base
* \param id Id livre ('' par defaut)
* \param ref Reference du livre ('' par defaut)
*/
function FetchCanvas($id='', $ref='', $action='')
{
$result = $this->fetch($id,$ref);
if ($result >= 0)
{
$sql = "SELECT l.rowid,l.isbn,l.ean,l.pages,l.fk_couverture,l.format,l.fk_contrat";
$sql.= ",l.px_feuillet,l.px_revient,l.px_couverture,l.px_reliure, s.nom, s.rowid as socid";
$sql.= " FROM ".MAIN_DB_PREFIX."product_cnv_livre as l LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = l.fk_auteur";
if ($id) $sql.= " WHERE l.rowid = '".$id."'";
if ($ref) $sql.= " WHERE l.ref = '".addslashes($ref)."'";
$result = $this->db->query($sql) ;
if ( $result )
{
$result = $this->db->fetch_array();
$this->isbn = $result["isbn"];
$this->ean = $result["ean"];
$this->pages = $result["pages"];
$this->format = $result["format"];
$this->px_feuillet = $result["px_feuillet"];
$this->px_reliure = $result["px_reliure"];
$this->px_revient = $result["px_revient"];
$this->px_couverture = $result["px_couverture"];
$this->couverture_id = $result["fk_couverture"];
$this->auteur = stripslashes($result["nom"]);
$this->auteur_id = $result["socid"];
$this->db->free();
}
$this->contrat = new ProductLivreContrat($this->db);
$this->contrat->FetchCanvas($result["fk_contrat"]);
}
if ($action =='edit' or $action == 'create')
$this->GetAvailableAuteurs();
return $result;
}
/**
* \brief Mise a jour des donnees dans la base
* \param datas Tableau de donnees
*/
function UpdateCanvas($datas)
{
dol_syslog("ProductLivre::UpdateCanvas ID : ".$this->id, LOG_DEBUG);
$isbna = trim($datas["isbna"]);
$isbnb = trim($datas["isbnb"]);
$sp = 9 - (strlen($isbna) + strlen($isbnb) );
$isbnc = substr( str_repeat('0',10) . $datas["isbnc"], -$sp , $sp); // on complete a 10
$key = $this->calculate_isbn_key($isbna.$isbnb.$isbnc);
$isbn = $isbna.'-'.$isbnb.'-'.$isbnc.'-'.$key;
$ean = '978'.$isbna.$isbnb.$isbnc;
$ean = $ean . $this->calculate_ean_key($ean);
$this->pages = abs(trim($datas["pages"]));
$this->px_feuillet = price2num($datas["px_feuillet"]);
$this->px_reliure = price2num($datas["px_reliure"]);
$this->px_couverture = price2num($datas["px_couverture"]);
$price_ht = $this->price / (1 + ($this->tva_tx / 100));
$contrat_taux = price2num($datas["contrat_taux"]);
$this->px_revient = $this->_calculate_prix_revient($this->pages, $this->px_couverture, $this->px_feuillet, $price_ht, $this->px_reliure, $contrat_taux);
$this->stock_loc = trim($datas["stock_loc"]);
$format = trim($datas["format"]);
$sql = "UPDATE ".MAIN_DB_PREFIX."product_cnv_livre ";
$sql.= " SET isbn = '$isbn'";
$sql.= " , ean = '$ean'";
$sql.= " , pages = '".$this->pages."'";
$sql.= " , px_feuillet = ".($this->px_feuillet?price2num($this->px_feuillet):'null');
$sql.= " , px_revient = ".($this->px_revient?price2num($this->px_revient):'null');
$sql.= " , px_reliure = ".($this->px_reliure?price2num($this->px_reliure):'null');
$sql.= " , px_couverture = ".($this->px_couverture?price2num($this->px_couverture):'null');
$sql.= " , fk_couverture = '".$this->couverture->id."'";
$sql.= " , fk_contrat = '".$this->contrat->id."'";
$sql.= " , fk_auteur = '".$datas["auteur"]."'";
$sql.= " , format = '$format'";
$sql.= " WHERE rowid = " . $this->id;
dol_syslog("ProductLivre::UpdateCanvas sql=".$sql, LOG_DEBUG);
if ( $this->db->query($sql) )
{
$this->errno = 0;
$this->contrat->UpdateCanvas($datas);
return 0;
}
else
{
$this->error=$this->db->lasterror();
$this->_setErrNo("UpdateCanvas",1281);
return -1;
}
}
/**
\brief Calcule le prix de revient d'un livre
\param pages Nombre de pages
\param couv Prix de la couverture
\param feuil Prix d'un feuillet
\param price_ht Prix public HT
\param taux Taux du contrat
*/
function _calculate_prix_revient($pages, $couv, $feuil, $price_ht, $reliure, $taux)
{
dol_syslog("ProductLivre::UpdateCanvas $pages, $couv, $feuil, $price_ht, $taux", LOG_DEBUG);
$cost = ($pages / 2 * $feuil) + $couv + $reliure + ($price_ht * $taux / 100);
return $cost;
}
/**
* \brief Calcule la clef d'un numero ISBN
* \param isbn Clef International Standard Book Number
* \note source http://fr.wikipedia.org/wiki/ISBN
*/
function calculate_isbn_key($isbn)
{
$sum = 0;
for ($i = 0 ; $i < 9 ; $i++)
{
$sum += $isbn{$i} * (10 - $i);
}
$key = 11 - ($sum % 11);
if ($key == 0)
$key = 1;
if ($key == 11)
$key = 'X';
return $key;
}
/**
* \brief Calcule la clef d'un numero EAN 13
* \param ean Clef EAN
* \note source http://fr.wikipedia.org/wiki/ISBN
*/
function calculate_ean_key($ean)
{
$sum = 0;
for ($i = 0 ; $i < 12 ; $i = $i+2)
{
$sum += $ean{$i};
}
for ($i = 1 ; $i < 12 ; $i = $i+2)
{
$sum += 3 * $ean{$i};
}
$key = (10 - ($sum % 10));
return $key;
}
/**
* \brief Assigne les valeurs pour les templates Smarty
* \param smarty Instance de smarty
*/
function assign_smarty_values(&$smarty, $action='')
{
global $conf,$langs;
if ($action =='edit' or $action == 'create')
{
$this->GetAvailableFormat();
$this->GetAvailableAuteurs();
}
if ($this->errno == 257)
{
$smarty->assign('class_normal_ref', 'error');
$smarty->assign('class_focus_ref', 'focuserr');
}
else
{
$smarty->assign('class_normal_ref', 'normal');
$smarty->assign('class_focus_ref', 'focus');
}
$picto='title.png';
if (empty($conf->browser->firefox)) $picto='title.gif';
$smarty->assign('title_picto', img_picto('',$picto));
$smarty->assign('title_text', $langs->trans('NewBook'));
$smarty->assign('user', $this->user->prenom.' '.$this->user->nom);
$smarty->assign('prod_id', $this->id);
$smarty->assign('prod_ref', $this->ref);
$smarty->assign('prod_label', $this->libelle);
$smarty->assign('prod_note', $this->note);
$smarty->assign('prod_description', $this->description);
$smarty->assign('prod_canvas', $this->canvas);
$smarty->assign('prod_isbn', $this->isbn);
$isbn_parts = explode('-',$this->isbn);
$smarty->assign('prod_isbna', $isbn_parts[0]);
$smarty->assign('prod_isbnb', $isbn_parts[1]);
$smarty->assign('prod_isbnc', $isbn_parts[2]);
$smarty->assign('prod_ean', $this->ean);
$smarty->assign('prod_isbn13', '978-'.substr($this->isbn,0,12).substr($this->ean,-1,1));
$smarty->assign('prod_tva_tx', $this->tva_tx);
$smarty->assign('prod_pages', $this->pages);
$smarty->assign('prod_format', $this->format);
$smarty->assign('prod_pxfeuil', $this->px_feuillet);
$smarty->assign('prod_pxcouv', $this->px_couverture);
$smarty->assign('livre_couverture_id', $this->couverture_id);
$smarty->assign('prod_weight', $this->weight);
$smarty->assign('prod_weight_units', $this->weight_units);
$smarty->assign('prod_pxreliure', $this->px_reliure);
$smarty->assign('prod_pxrevient', price($this->px_revient));
$smarty->assign('prod_pxvente', price($this->price_ttc));
$smarty->assign('livre_contrat_locked', $this->contrat->locked);
$smarty->assign('livre_contrat_taux', $this->contrat->taux);
$smarty->assign('livre_contrat_duree', $this->contrat->duree);
$smarty->assign('livre_contrat_quant', $this->contrat->quantite);
$smarty->assign('livre_contrat_date_app', $this->contrat->date_app);
$smarty->assign('livre_contrat_user_fullname', $this->contrat->user_fullname);
$smarty->assign('livre_auteur', $this->auteur);
$smarty->assign('livre_auteur_id', $this->auteur_id);
$smarty->assign('prod_stock_loc', $this->stock_loc);
$smarty->assign('prod_stock_reel', $this->stock_reel);
$smarty->assign('prod_stock_dispo', ($this->stock_reel - $this->stock_in_command));
$smarty->assign('prod_stock_in_command', $this->stock_in_command);
$smarty->assign('prod_stock_alert', $this->seuil_stock_alerte);
$smarty->assign('prod_statut_id', $this->status);
$smarty->assign('prod_statuts_id', array(1,0) );
$smarty->assign('prod_statuts_value', array('En vente', 'Hors vente') );
$smarty->assign('livre_available_formats', $this->available_formats);
$smarty->assign('livre_available_auteurs', $this->available_auteurs);
if ($this->status==1)
{
$smarty->assign('prod_statut', 'En vente');
}
else
{
$smarty->assign('prod_statut', 'Hors vente');
}
if ($this->seuil_stock_alerte > ($this->stock_reel - $this->stock_in_command) && $this->status == 1)
{
$smarty->assign('smarty_stock_dispo_class', 'class="warning"');
}
}
/*
* Fetch Datas Liste
*
*
*/
function LoadListDatas($limit, $offset, $sortfield, $sortorder)
{
$sql = 'SELECT p.rowid, p.ref, p.label, pl.px_feuillet as price, ';
$sql.= ' p.duration, p.envente as statut, p.stock_loc';
$sql.= ',pl.pages';
$sql.= ',SUM(fd.qty) as ventes';
$sql.= ",sc.reel as casier, se.reel as entrepot";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as fd ON fd.fk_product = p.rowid';
$sql.= ','.MAIN_DB_PREFIX.'product_cnv_livre as pl';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as sc ON sc.fk_product = pl.rowid AND sc.fk_entrepot = 1';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as se ON se.fk_product = pl.rowid AND se.fk_entrepot = 2';
$sql .= " WHERE p.rowid=pl.rowid ";
if ($sall)
{
$sql .= " AND (p.ref like '%".$sall."%' OR p.label like '%".$sall."%' OR p.description like '%".$sall."%' OR p.note like '%".$sall."%')";
}
if ($sref)
{
$sql .= " AND p.ref like '%".$sref."%'";
}
if ($snom)
{
$sql .= " AND p.label like '%".$snom."%'";
}
if (isset($_GET["envente"]) && strlen($_GET["envente"]) > 0)
{
$sql .= " AND p.envente = ".$_GET["envente"];
}
$sql.= " GROUP BY p.rowid";
$sql.= " ORDER BY $sortfield $sortorder ";
$sql.= $this->db->plimit($limit + 1 ,$offset);
$this->list_datas = array();
$resql = $this->db->query($sql) ;
if ($resql)
{
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < min($num,$limit))
{
$datas = array();
$obj = $this->db->fetch_object($resql);
$datas["id"] = $obj->rowid;
$datas["ref"] = $obj->ref;
$datas["titre"] = $obj->label;
$datas["casier"] = $obj->casier;
$datas["entrepot"] = $obj->entrepot;
$datas["ventes"] = $obj->ventes;
$datas["stock"] = 0;
$datas["stock_loc"] = stripslashes($obj->stock_loc);
$datas["pages"] = $obj->pages;
$datas["prix"] = price($obj->price);
$datas["valo"] = 0;
array_push($this->list_datas,$datas);
$i++;
}
$this->db->free($resql);
}
else
{
print $sql;
}
}
function GetAvailableFormat()
{
global $conf;
$this->available_formats = array();
$sql = "SELECT";
$sql.= " rowid";
$sql.= ", ".$this->db->decrypt('value')." as value";
$sql.= " FROM ".MAIN_DB_PREFIX."const";
$sql.= " WHERE ".$this->db->decrypt('name');
$sql.= " LIKE 'EDITEUR_LIVRE_FORMAT_%'";
$resql = $this->db->query($sql);
while ($obj = $this->db->fetch_object($resql) )
{
$this->available_formats[$obj->rowid] = stripslashes($obj->value);
}
$this->db->free($resql);
return 0;
}
function GetAvailableAuteurs()
{
$this->available_auteurs = array();
$sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."societe ";
$resql = $this->db->query($sql);
while ($obj = $this->db->fetch_object($resql) )
{
$this->available_auteurs[$obj->rowid] = stripslashes($obj->nom);
}
$this->db->free($resql);
return 0;
}
}
?>

View File

@ -1,188 +0,0 @@
<?php
/* Copyright (C) 2006-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2007 Auguria SARL <info@auguria.org>
*
* 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
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
\file htdocs/product/templates/product.livre.class.php
\ingroup produit
\brief Fichier de la classe des produits specifiques de type livre
\version $Id$
*/
require_once(DOL_DOCUMENT_ROOT.'/product/templates/product.livre.class.php');
/**
\class ProductLivreContrat
\brief Classe permettant la gestion des livres, cette classe surcharge la classe produit
*/
class ProductLivreContrat extends Product
{
/**
* \brief Constructeur de la classe
* \param DB Handler acces base de donnees
* \param id Id produit (0 par defaut)
*/
function ProductLivreContrat($DB=0, $id=0)
{
$this->db = $DB;
$this->id = $id ;
$this->canvas = "livrecontrat";
$this->name = "livrecontrat";
$this->description = "Gestion des contrats des livres";
$this->active = PRODUIT_SPECIAL_LIVRECONTRAT;
$this->menu_new = '';
$this->menu_add = 0;
$this->menu_clear = 1;
}
/**
* \brief Creation
* \param id Id livre
*/
function Create($user,$livre_id,$datas)
{
$this->db->begin();
$id = parent::Create($user);
if ($id > 0)
{
$error = 0;
}
if ( $error === 0 )
{
$sql = " INSERT INTO ".MAIN_DB_PREFIX."product_cnv_livre_contrat (rowid,fk_cnv_livre)";
$sql.= " VALUES ('".$id."','".$livre_id."');";
$result = $this->db->query($sql) ;
if ($result)
{
$error = 0;
}
else
{
$error = -6;
}
}
if ( $error === 0 )
{
$error = $this->UpdateCanvas($datas);
}
if ( $error === 0 )
{
$this->db->commit();
return $this->id;
}
else
{
$this->db->rollback();
return -1;
}
}
/**
* \brief Supression
* \param id Id livre
*/
function DeleteCanvas($id)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_cnv_livre_contrat ";
$sql.= " WHERE rowid = '".$id."';";
$result = $this->db->query($sql) ;
return 0;
}
/**
* \brief Lecture des donnees dans la base
* \param id Id livre ('' par defaut)
* \param ref Reference du livre ('' par defaut)
* \todo Rodo Resoudre le probleme de boucle infinie avec le livre
*/
function FetchCanvas($id='', $ref='')
{
$result = $this->fetch($id,$ref);
if ($result >= 0)
{
$sql = "SELECT fk_cnv_livre,taux,quantite,duree,";
$sql.= $this->db->pdate('date_app') ." as date_app";
$sql.= " FROM ".MAIN_DB_PREFIX."product_cnv_livre_contrat";
if ($id) $sql.= " WHERE rowid = '".$id."'";
if ($ref) $sql.= " WHERE ref = '".addslashes($ref)."'";
$result = $this->db->query($sql) ;
if ( $result )
{
$result = $this->db->fetch_array();
$this->taux = $result["taux"];
$this->quantite = $result["quantite"];
$this->duree = $result["duree"];
$this->date_app = $result["date_app"];
$this->db->free();
}
}
return $result;
}
/**
* \brief Mise a jour des donnees dans la base
* \param datas Tableau de donnees
*/
function UpdateCanvas($datas)
{
dol_syslog("ProductLivreContrat::UpdateCanvas");
$taux = str_replace(',','.',trim($datas["contrat_taux"]));
$quant = trim($datas["contrat_quant"]);
$duree = trim($datas["contrat_duree"]);
$date_app = mktime(1,1,1,$datas["Date_Month"],$datas["Date_Day"],$datas["Date_Year"]);
$sql = "UPDATE ".MAIN_DB_PREFIX."product_cnv_livre_contrat ";
$sql .= " SET taux = '$taux'";
$sql .= " , quantite = '$quant'";
$sql .= " , duree = '$duree'";
$sql .= " , date_app = '".$this->db->idate($date_app)."'";
$sql .= " WHERE rowid = " . $this->id;
if ( $this->db->query($sql) )
{
$error = 0;
}
else
{
$error = -1;
}
return $error;
}
/**
* \brief Assigne les valeurs pour les templates Smarty
* \param smarty Instance de smarty
*/
function assign_values(&$smarty)
{
}
}
?>

View File

@ -1,144 +0,0 @@
<?php
/* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
\file htdocs/product/templates/product.livre.class.php
\ingroup produit
\brief Fichier de la classe des produits specifiques de type livre
\version $Id$
*/
require_once(DOL_DOCUMENT_ROOT.'/product/templates/product.livre.class.php');
/**
\class ProductLivreCouverture
\brief Classe permettant la gestion des livres, cette classe surcharge la classe produit
*/
class ProductLivreCouverture extends Product
{
/**
* \brief Constructeur de la classe
* \param DB Handler acces base de donnees
* \param id Id produit (0 par defaut)
*/
function ProductLivreCouverture($DB=0, $id=0)
{
$this->db = $DB;
$this->id = $id ;
$this->canvas = "livrecouverture";
$this->name = "livrecouverture";
$this->description = "Gestion des couvertures des livres";
$this->active = PRODUIT_SPECIAL_LIVRECOUVERTURE;
$this->menu_new = '';
$this->menu_add = 0;
$this->menu_clear = 1;
$this->no_button_copy = 1;
$this->no_button_edit = 1;
$this->no_button_delete = 1;
}
/**
* \brief Creation
* \param id Id livre
*/
function Create($user,$datas)
{
$this->db->begin();
$id = parent::Create($user);
return $this->id;
}
/**
* \brief Supression
* \param id Id livre
*/
function DeleteCanvas($id)
{
return 0;
}
/**
* \brief Lecture des donnees dans la base
* \param id Id livre ('' par defaut)
* \param ref Reference du livre ('' par defaut)
*/
function FetchCanvas($id='', $ref='')
{
$result = $this->fetch($id,$ref);
if ($result >= 0)
{
$sql = "SELECT p.rowid,p.ref,p.label";
$sql.= " FROM ".MAIN_DB_PREFIX."product_cnv_livre as pl,".MAIN_DB_PREFIX."product as p";
$sql.= " WHERE pl.rowid=p.rowid AND pl.fk_couverture = '".$id."'";
$result = $this->db->query($sql) ;
if ( $result )
{
$result = $this->db->fetch_array();
$this->livre_id = $result["rowid"];
$this->livre_ref = $result["ref"];
$this->livre_label = stripslashes($result["label"]);
$this->db->free();
}
}
return $result;
}
/**
* \brief Mise a jour des donnees dans la base
* \param datas Tableau de donnees
*/
function UpdateCanvas($datas)
{
$error = 0;
return $error;
}
/**
* \brief Assigne les valeurs pour les templates Smarty
* \param smarty Instance de smarty
*/
function assign_smarty_values(&$smarty)
{
$smarty->assign('prod_id', $this->id);
$smarty->assign('livre_id', $this->livre_id);
$smarty->assign('livre_ref', $this->livre_ref);
$smarty->assign('livre_label', $this->livre_label);
$smarty->assign('prod_note', $this->note);
$smarty->assign('prod_description', $this->description);
$smarty->assign('prod_canvas', $this->canvas);
$this->stock_dispo = ($this->stock_reel - $this->stock_in_command);
$smarty->assign('prod_stock_reel', $this->stock_reel);
$smarty->assign('prod_stock_dispo', $this->stock_dispo);
$smarty->assign('prod_stock_in_command', $this->stock_in_command);
$smarty->assign('prod_stock_alert', $this->seuil_stock_alerte);
if ( ($this->seuil_stock_alerte > $this->stock_dispo) && ($this->status == 1) )
{
$smarty->assign('smarty_stock_dispo_class', 'class="warning"');
}
}
}
?>

View File

@ -26,7 +26,7 @@
* \version $Id$
*/
require("./pre.inc.php");
require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
require_once(DOL_DOCUMENT_ROOT."/product.class.php");