From cd6cb2a8f6c833fc3323050d541521a5b235a55f Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Tue, 15 May 2007 15:09:51 +0000 Subject: [PATCH] Gestion auteurs --- htdocs/product/canvas/livre/livre-create.tpl | 9 ++- htdocs/product/canvas/livre/livre-edit.tpl | 67 ++++++++++++++++++- htdocs/product/canvas/livre/livre-view.tpl | 30 +++++++++ htdocs/product/canvas/product.livre.class.php | 46 ++++++++++--- 4 files changed, 138 insertions(+), 14 deletions(-) diff --git a/htdocs/product/canvas/livre/livre-create.tpl b/htdocs/product/canvas/livre/livre-create.tpl index 8310fab3f24..8ad2351401c 100644 --- a/htdocs/product/canvas/livre/livre-create.tpl +++ b/htdocs/product/canvas/livre/livre-create.tpl @@ -1,5 +1,4 @@ - + *}
@@ -155,8 +154,8 @@ Auteur / Editeur - + {html_options options=$livre_available_auteurs selected=$livre_auteur_id} Saisi par diff --git a/htdocs/product/canvas/livre/livre-edit.tpl b/htdocs/product/canvas/livre/livre-edit.tpl index b37a85c023a..2c0267c3fa6 100644 --- a/htdocs/product/canvas/livre/livre-edit.tpl +++ b/htdocs/product/canvas/livre/livre-edit.tpl @@ -1,3 +1,23 @@ +{* 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$ + * $Source$ + *} @@ -142,6 +162,17 @@
+ +{if $livre_contrat_locked eq '0'} + + + + + - + + + + + + + +{else} + + + + + + + + + + + + + + + + + +{/if} + +
Auteur / Editeur + + Saisi par{$livre_contrat_user_fullname}
Durée du contrat : @@ -153,7 +184,6 @@ {html_select_date field_order='DMY' start_year='-10' time=$livre_contrat_date_app reverse_years=True all_extra='class="flat"'}
Taux conclu @@ -166,6 +196,41 @@ class="normal" onfocus="this.className='focus';" onblur="this.className='normal';">
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}
+ +
+ + + diff --git a/htdocs/product/canvas/livre/livre-view.tpl b/htdocs/product/canvas/livre/livre-view.tpl index 68a15a819c8..a5b07f8abb6 100644 --- a/htdocs/product/canvas/livre/livre-view.tpl +++ b/htdocs/product/canvas/livre/livre-view.tpl @@ -1,3 +1,25 @@ +{* + * 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$ + * $Source$ + *} +
Description
@@ -93,6 +115,14 @@

+ + + + + + diff --git a/htdocs/product/canvas/product.livre.class.php b/htdocs/product/canvas/product.livre.class.php index 63c1b0f603c..fae500c9952 100644 --- a/htdocs/product/canvas/product.livre.class.php +++ b/htdocs/product/canvas/product.livre.class.php @@ -70,7 +70,6 @@ class ProductLivre extends Product */ $this->next_prev_filter = "canvas='livre'"; - $this->onglets[0][0] = 'URL'; $this->onglets[0][1] = 'Editeur'; @@ -209,17 +208,17 @@ class ProductLivre extends Product * \param id Id livre ('' par defaut) * \param ref Reference du livre ('' par defaut) */ - function FetchCanvas($id='', $ref='') + function FetchCanvas($id='', $ref='', $action='') { $result = $this->fetch($id,$ref); if ($result >= 0) { - $sql = "SELECT rowid,isbn,ean,pages,fk_couverture,format,fk_contrat"; - $sql.= ",px_feuillet,px_revient,px_couverture,px_reliure"; - $sql.= " FROM ".MAIN_DB_PREFIX."product_cnv_livre"; - if ($id) $sql.= " WHERE rowid = '".$id."'"; - if ($ref) $sql.= " WHERE ref = '".addslashes($ref)."'"; + $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.idp"; + $sql.= " FROM ".MAIN_DB_PREFIX."product_cnv_livre as l LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.idp=l.fk_auteur"; + if ($id) $sql.= " WHERE l.rowid = '".$id."'"; + if ($ref) $sql.= " WHERE l.ref = '".addslashes($ref)."'"; $result = $this->db->query($sql) ; @@ -236,6 +235,8 @@ class ProductLivre extends Product $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["idp"]; $this->db->free(); } @@ -244,6 +245,9 @@ class ProductLivre extends Product $this->contrat->FetchCanvas($result["fk_contrat"]); } + if ($action =='edit' or $action == 'create') + $this->GetAvailableAuteurs(); + return $result; } /** @@ -292,6 +296,7 @@ class ProductLivre extends Product $sql.= " , px_couverture = '".ereg_replace(",",".",$this->px_couverture)."'"; $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; @@ -424,10 +429,15 @@ class ProductLivre extends Product $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); @@ -444,6 +454,7 @@ class ProductLivre extends Product $this->GetAvailableFormat(); $smarty->assign('livre_available_formats', $this->available_formats); + $smarty->assign('livre_available_auteurs', $this->available_auteurs); if ($this->status==1) { @@ -559,8 +570,27 @@ class ProductLivre extends Product $this->db->free($resql); return 0; - } + function GetAvailableAuteurs() + { + $this->available_auteurs = array(); + + $sql = "SELECT idp,nom FROM ".MAIN_DB_PREFIX."societe "; + + $resql = $this->db->query($sql); + + while ($obj = $this->db->fetch_object($resql) ) + { + $this->available_auteurs[$obj->idp] = stripslashes($obj->nom); + } + + $this->db->free($resql); + + return 0; + } + + + } ?>
Auteur / Editeur{$livre_auteur}Saisi par + {$livre_contrat_user_fullname} +
Durée du contrat :