diff --git a/htdocs/includes/modules/modDroitPret.class.php b/htdocs/includes/modules/modDroitPret.class.php deleted file mode 100644 index b288976ecd4..00000000000 --- a/htdocs/includes/modules/modDroitPret.class.php +++ /dev/null @@ -1,124 +0,0 @@ - - * Copyright (C) 2005-2009 Regis Houssin - * - * 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); - } -} -?> diff --git a/htdocs/product/barcode.php b/htdocs/product/barcode.php index 0b8337b9a43..2db48df8c25 100644 --- a/htdocs/product/barcode.php +++ b/htdocs/product/barcode.php @@ -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"); diff --git a/htdocs/product/document.php b/htdocs/product/document.php index f61b17b69ba..203288a4abb 100755 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -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"); diff --git a/htdocs/product/droitpret/droitpret.class.php b/htdocs/product/droitpret/droitpret.class.php deleted file mode 100644 index dc0954cb57c..00000000000 --- a/htdocs/product/droitpret/droitpret.class.php +++ /dev/null @@ -1,271 +0,0 @@ - - * - * 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�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='
'.$mailfile->error.'
'; - echo $mesg; - } - else - { - $result=$mailfile->sendfile(); - if ($result) - { - $mesg='
'.$langs->trans('MailSuccessfulySent',$from,$sendto).'.
'; - } - else - { - $mesg='
'; - if ($mailfile->error) - { - $mesg.="error"; - $mesg.='
'.$mailfile->error; - } - else - { - $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; - } - $mesg.='
'; - - } - } - 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; - } - -} - -?> \ No newline at end of file diff --git a/htdocs/product/droitpret/index.php b/htdocs/product/droitpret/index.php deleted file mode 100644 index 7b1e944a5db..00000000000 --- a/htdocs/product/droitpret/index.php +++ /dev/null @@ -1,136 +0,0 @@ - - * Copyright (C) 2004-2006 Laurent Destailleur - * - * 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='
'.$langs->trans("ErrorDate").'
'; - } - - - - - -} - - - -/* - * 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 '
'; -print ''; - - -print ''; -print ''; -print ''; -print '
Date de début de période'; - - -$html->select_date($lastRapport,'d',1,1,'',"dated"); -print '
Date de fin de période'; -$html->select_date('','f',1,1,'',"datef"); -print '
'; - -print '
'; - -print '
'; - - -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - -$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 ''; - print ''; - print ''; - print ''; - print ''; - $i++; - } -} - - - -print '
DocumentDate du rapportDébut périodeFin périodeNb factures
'.$obj->fichier.''.$obj->date_envoie.''.$obj->date_debut.''.$obj->date_fin.''.$obj->nbfact.'
'; - -?> diff --git a/htdocs/product/droitpret/modules_droitpret.php b/htdocs/product/droitpret/modules_droitpret.php deleted file mode 100644 index e72fc0442b1..00000000000 --- a/htdocs/product/droitpret/modules_droitpret.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * 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�re de generation des exports de droits de prets - \version $Id$ -*/ - - -/** - \class ModeleDroitPret - \brief Classe m�re des mod�les de format d'export de droits de pr�ts -*/ - -class ModeleDroitPret -{ - - - /** - * \brief Constructeur - */ - function ModeleDroitPret() - { - } - - /** - * \brief Charge en memoire et renvoie la liste des mod�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; - } - - - - - - -} - - -?> diff --git a/htdocs/product/droitpret/pre.inc.php b/htdocs/product/droitpret/pre.inc.php deleted file mode 100644 index 9f3df6168af..00000000000 --- a/htdocs/product/droitpret/pre.inc.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * 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); -} - -?> diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 281c690677c..fa37c865fff 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -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"); diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index b5b4d0f3a29..023cb9c010f 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -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"; diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 0b82e05bb59..88c4158617a 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -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"]:''); diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index a57ec2a58e6..6f86be698a3 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -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"); diff --git a/htdocs/product/photos.php b/htdocs/product/photos.php index 75d040df757..5e501e06aef 100644 --- a/htdocs/product/photos.php +++ b/htdocs/product/photos.php @@ -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"); diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php index 9ef1ca4ccb4..341ef69115d 100644 --- a/htdocs/product/popuprop.php +++ b/htdocs/product/popuprop.php @@ -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 diff --git a/htdocs/product/pre.inc.php b/htdocs/product/pre.inc.php deleted file mode 100644 index 07a06bc4eeb..00000000000 --- a/htdocs/product/pre.inc.php +++ /dev/null @@ -1,120 +0,0 @@ - - * Copyright (C) 2004-2010 Laurent Destailleur - * Copyright (C) 2007 Auguria SARL - * - * 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&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&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); -} -?> diff --git a/htdocs/product/price.php b/htdocs/product/price.php index a67f4318334..bd8cd65393f 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -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"); diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 817c53626f6..45048636ffb 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -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"); diff --git a/htdocs/product/templates/default/index.php b/htdocs/product/templates/default/index.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/product/templates/default/liste.tpl b/htdocs/product/templates/default/liste.tpl deleted file mode 100644 index 7bbcce22321..00000000000 --- a/htdocs/product/templates/default/liste.tpl +++ /dev/null @@ -1,102 +0,0 @@ -{* Copyright (C) 2009 Regis Houssin - * - * 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$ - *} - - - - - - - - -
- {$title_picto} - -
{$title_text}
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -{section name=mysec loop=$datas} -{strip} - - - - - - - - - -{/strip} -{/section} - -
Référence - - A-Z - - - Z-A - - Libellé - - A-Z - - - Z-A - - Code barre - - A-Z - - - Z-A - - Date de modificationPrix de venteStockEtat
    - - -
{$datas[mysec].ref}{$datas[mysec].label}{$datas[mysec].barcode}{$datas[mysec].datem}{$datas[mysec].sellingprice}{$datas[mysec].stock}{$datas[mysec].status}
-
- - \ No newline at end of file diff --git a/htdocs/product/templates/index.php b/htdocs/product/templates/index.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/product/templates/livre/index.php b/htdocs/product/templates/livre/index.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/product/templates/livre/liste.tpl b/htdocs/product/templates/livre/liste.tpl deleted file mode 100644 index 2f87c89c3e9..00000000000 --- a/htdocs/product/templates/livre/liste.tpl +++ /dev/null @@ -1,109 +0,0 @@ -{* Copyright (C) 2006-2007 Rodolphe Quiedeville - * Copyright (C) 2006-2007 Auguria SARL - * - * 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$ - *} - - - - - - - - -
- {$title_picto} - -
{$langs->trans('Books')}
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -{section name=mysec loop=$datas} -{strip} - - - - - - - - - - - - -{/strip} -{/section} - -
{$langs->trans('Case')} - {$langs->trans('Ref')} - - A-Z - - - Z-A - - {$langs->trans('Title')} - - A-Z - - - Z-A - - CasierEntrepotVentesStockPagesPrixValorisation - Action -
         - - -
$datas{$datas[mysec].ref}{$datas[mysec].titre}{$datas[mysec].casier}{$datas[mysec].entrepot}{$datas[mysec].ventes}{$datas[mysec].stock}{$datas[mysec].pages}{$datas[mysec].prix}{$datas[mysec].valo}
-
- - \ No newline at end of file diff --git a/htdocs/product/templates/livre/livre-create.tpl b/htdocs/product/templates/livre/livre-create.tpl deleted file mode 100644 index 11f93797cdf..00000000000 --- a/htdocs/product/templates/livre/livre-create.tpl +++ /dev/null @@ -1,227 +0,0 @@ -{* Copyright (C) 2006-2007 Rodolphe Quiedeville - * Copyright (C) 2006-2007 Auguria SARL - * - * 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$ - *} - - - - - - - - -
- {$title_picto} - -
{$title_text}
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Référence - -
Titre - -
ISBN - - - - - - {$prod_isbn} - ISBN-13sera calculé -
EANsera calculé
Pages - - Format - - - -
Prix au feuillet - HT - Prix couverture - HT -
Prix de revientsera calculéPrix reliure - -
Prix de vente - TTC - Taux TVA - -
- -
- - - - - - - - - - - - - - -
Seuil stock - - Emplacement Stock - -
Statut - - Poids - g - -
- -
- - - - - - - - - - - - - - - - - - - - - -
Auteur / Editeur - - Saisi par - {$user} -
Durée du contrat : - - Date d'application{html_select_date field_order='DMY' start_year='-10' reverse_years=True all_extra='class="flat"'}
Taux conclu - % - Quantité achetée - -
- -
- - - - - - - - - - - - - - - -
Description - -
Note (non visible sur les factures, propals...) - - -
- -
-
- - \ No newline at end of file diff --git a/htdocs/product/templates/livre/livre-edit.tpl b/htdocs/product/templates/livre/livre-edit.tpl deleted file mode 100644 index 366c0050632..00000000000 --- a/htdocs/product/templates/livre/livre-edit.tpl +++ /dev/null @@ -1,267 +0,0 @@ -{* Copyright (C) 2006-2007 Rodolphe Quiedeville - * Copyright (C) 2006-2007 Auguria SARL - * - * 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$ - *} - - - -
- - - - - - - - - -
-
Éditer Livre
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Réf. - -
Titre - -
ISBN - - - - - - {$prod_isbn} - ISBN-13978- - -
EAN - - Code barre{$prod_ean}
Pages - - Format - -
Poids - g - -
Prix au feuillet - - Prix couverture - -
Prix de revient{$prod_pxrevient}Prix reliure - -
- -
- - - - - - - - -
Prix de vente{$prod_pxvente} TTCTaux TVA - -
- -
- - - - - - - - - - - - - - - - - -
Stock disponible{$prod_stock_dispo}Seuil d'alerte stock - -
Emplacement Stock - -
Statut - -
- -
- - - -{if $livre_contrat_locked eq '0'} - - - - - - - - - - - - - - - - - - - - - - - - -{else} - - - - - - - - - - - - - - - - - -{/if} - -
Auteur / Editeur - - Saisi par{$livre_contrat_user_fullname}
Durée du contrat : - - Date d'application - {html_select_date field_order='DMY' start_year='-10' time=$livre_contrat_date_app reverse_years=True all_extra='class="flat"'} -
Taux conclu - % - Quantité achetée - -
Validation du contrat - - En cochant la case vous interdisez toute modifications
Auteur / Editeur{$livre_auteur}Saisi par{$livre_contrat_user_fullname}
Durée du contrat : {$livre_contrat_duree}Date d'application{$livre_contrat_date_app|date_format:"%d %B %Y"}
Taux conclu{$livre_contrat_taux} %Quantité achetée{$livre_contrat_quant}
- -
- - - - - - - - - - - - - - - - - -
Description - -
Note (non visible sur les factures, propals...) - - -
-   - -
-
- - \ No newline at end of file diff --git a/htdocs/product/templates/livre/livre-view.tpl b/htdocs/product/templates/livre/livre-view.tpl deleted file mode 100644 index 251b8f34391..00000000000 --- a/htdocs/product/templates/livre/livre-view.tpl +++ /dev/null @@ -1,157 +0,0 @@ -{* Copyright (C) 2006-2007 Rodolphe Quiedeville - * Copyright (C) 2006-2007 Auguria SARL - * - * 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$ - *} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Référence{$prod_ref} - {$fiche_cursor_prev}{$fiche_cursor_next} -
Titre{$prod_label}
ISBN{$prod_isbn}ISBN-13{$prod_isbn13}
EAN{$prod_ean}Code barre{$prod_ean}
Pages{$prod_pages}Format{$prod_format}
Poids{$prod_weight}g
- -
- - - - - - - - - - - - - - - - - - - - - - -
Prix au feuillet{$prod_pxfeuil} HTPrix couverture{$prod_pxcouv} HT
Prix de revient{$prod_pxrevient} HTPrix reliure{$prod_pxreliure} HT
Prix de vente{$prod_pxvente} TTCTaux TVA{$prod_tva_tx} %
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Stock disponible{$prod_stock_dispo}Seuil d'alerte{$prod_stock_alert}
Stock réel{$prod_stock_reel}Exemplaires en commande{$prod_stock_in_command}
Emplacement Stock{$prod_stock_loc}
Statut{$prod_statut}
-
- - - - - - - - - - - - - - - - - - - - - - -
Auteur / Editeur{$livre_auteur}Saisi par - {$livre_contrat_user_fullname} -
Durée du contrat : {$livre_contrat_duree}Date d'application{$livre_contrat_date_app|date_format:"%d %B %Y"}
Taux conclu{$livre_contrat_taux} %Quantité achetée{$livre_contrat_quant}
- -
- - - - - - - - - - - - - -
Description{$prod_description}
Note (non visible sur les factures, propals...){$prod_note}
- - \ No newline at end of file diff --git a/htdocs/product/templates/livrecontrat/index.php b/htdocs/product/templates/livrecontrat/index.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/product/templates/livrecontrat/livrecontrat-edit.tpl b/htdocs/product/templates/livrecontrat/livrecontrat-edit.tpl deleted file mode 100644 index 845c49be2bb..00000000000 --- a/htdocs/product/templates/livrecontrat/livrecontrat-edit.tpl +++ /dev/null @@ -1,110 +0,0 @@ -{* Copyright (C) 2006-2007 Rodolphe Quiedeville - * Copyright (C) 2006-2007 Auguria SARL - * - * 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$ - *} - - - -
- - - - - - - - - - - - - - - - - - -
Réf.{$prod_ref}
Titre{$prod_label}
- -
- - - - - - - - -
Stock{$prod_stock_dispo}Seuil d'alerte stock - -
- -
- - - - - - - - - - - - - - - -
Durée du contrat : - - Date d'application{html_select_date field_order='DMY' time=$prod_contrat_date_app start_year='-10' reverse_years=True}
Taux conclu - % - Quantité achetée - -
- -
- - - - - - - - - - - - - - -
Description - -
Note (non visible sur les factures, propals...) - - -
-   - -
-
- \ No newline at end of file diff --git a/htdocs/product/templates/livrecontrat/livrecontrat-view.tpl b/htdocs/product/templates/livrecontrat/livrecontrat-view.tpl deleted file mode 100644 index 980f6ad364f..00000000000 --- a/htdocs/product/templates/livrecontrat/livrecontrat-view.tpl +++ /dev/null @@ -1,94 +0,0 @@ -{* Copyright (C) 2006-2007 Rodolphe Quiedeville - * Copyright (C) 2006-2007 Auguria SARL - * - * 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$ - *} - - - - - - - - - - - - - -
Référence{$prod_ref} - {$fiche_cursor_prev}{$fiche_cursor_next} -
Titre{$prod_label}
- -
- - - - - - - - - - - - - - - - - -
Stock - {$prod_stock_dispo} - Seuil d'alerte{$prod_stock_alert}
Stock réel{$prod_stock_reel}Exemplaires en commande{$prod_stock_in_command}
- -
- - - - - - - - - - - - - - - - - -
Durée du contrat : {$prod_contrat_duree}Date d'application{$prod_contrat_date_app|date_format:"%e %B %Y"}
Taux conclu{$prod_contrat_taux}Quantité achetée{$prod_contrat_quant}
- -
- - - - - - - - - - - - - -
Description{$prod_description|nl2br}
Note (non visible sur les factures, propals...){$prod_note|nl2br}
- \ No newline at end of file diff --git a/htdocs/product/templates/livrecouverture/index.php b/htdocs/product/templates/livrecouverture/index.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/product/templates/livrecouverture/livrecouverture-edit.tpl b/htdocs/product/templates/livrecouverture/livrecouverture-edit.tpl deleted file mode 100644 index 6be048a553c..00000000000 --- a/htdocs/product/templates/livrecouverture/livrecouverture-edit.tpl +++ /dev/null @@ -1,212 +0,0 @@ -{* Copyright (C) 2006-2007 Rodolphe Quiedeville - * Copyright (C) 2006-2007 Auguria SARL - * - * 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$ - *} - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Réf. - -
Titre - -
ISBN - - - - - - {$prod_isbn} - ISBN-13978- - -
EAN - - Code barre{$prod_ean}
Pages - - Format - -
Prix au feuillet - - Prix couverture - -
Prix de revient{$prod_pxrevient}
- -
- - - - - - - - -
Prix de vente{$prod_pxvente}Taux TVA - -
- -
- - - - - - - - - - - - - - - - - -
Stock{$prod_stock_dispo}Seuil d'alerte stock - -
Emplacement Stock - -
Statut - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Durée du contrat : - - Date d'application - -
Taux conclu - % - Quantité achetée - -
Description - -
Note (non visible sur les factures, propals...) - - -
-   - -
-
- - - - - - - - - - - \ No newline at end of file diff --git a/htdocs/product/templates/livrecouverture/livrecouverture-view.tpl b/htdocs/product/templates/livrecouverture/livrecouverture-view.tpl deleted file mode 100644 index c17e6832961..00000000000 --- a/htdocs/product/templates/livrecouverture/livrecouverture-view.tpl +++ /dev/null @@ -1,59 +0,0 @@ -{* Copyright (C) 2006-2007 Rodolphe Quiedeville - * Copyright (C) 2006-2007 Auguria SARL - * - * 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$ - *} - - - - - - - - - - - - - -
Réf{$livre_ref} -   -
Couverture du livre{$livre_label}
- -
- - - - - - - - - - - - - - - - - -
Stock{$prod_stock_dispo}Seuil d'alerte{$prod_stock_alert}
Stock réel{$prod_stock_reel}Exemplaires en commande{$prod_stock_in_command}
- -
- - \ No newline at end of file diff --git a/htdocs/product/templates/product.livre.class.php b/htdocs/product/templates/product.livre.class.php deleted file mode 100644 index 814990ab01d..00000000000 --- a/htdocs/product/templates/product.livre.class.php +++ /dev/null @@ -1,615 +0,0 @@ - - * Copyright (C) 2006-2007 Auguria SARL - * - * 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&type=0&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; - } - -} -?> \ No newline at end of file diff --git a/htdocs/product/templates/product.livrecontrat.class.php b/htdocs/product/templates/product.livrecontrat.class.php deleted file mode 100644 index 1853435b011..00000000000 --- a/htdocs/product/templates/product.livrecontrat.class.php +++ /dev/null @@ -1,188 +0,0 @@ - - * Copyright (C) 2006-2007 Auguria SARL - * - * 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) - { - - } -} -?> diff --git a/htdocs/product/templates/product.livrecouverture.class.php b/htdocs/product/templates/product.livrecouverture.class.php deleted file mode 100644 index c4ffb1e6043..00000000000 --- a/htdocs/product/templates/product.livrecouverture.class.php +++ /dev/null @@ -1,144 +0,0 @@ - - * - * 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"'); - } - } -} -?> diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index f15a600c8f5..6a43e62da0c 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -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");