Gestion auteurs

This commit is contained in:
Rodolphe Quiedeville 2007-05-15 15:09:51 +00:00
parent a50046b67b
commit cd6cb2a8f6
4 changed files with 138 additions and 14 deletions

View File

@ -1,5 +1,4 @@
<!--
* Copyright (C) 2006-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
{* 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
@ -18,7 +17,7 @@
*
* $Id$
* $Source$
-->
*}
<!-- BEGIN SMARTY TEMPLATE -->
<form id="evolForm" action="fiche.php" method="post">
@ -155,8 +154,8 @@
<tr>
<td>Auteur / Editeur</td>
<td>
<select class="flat" name="auteurs">
<select class="flat" name="auteur">
{html_options options=$livre_available_auteurs selected=$livre_auteur_id}
</select>
</td>
<td>Saisi par</td>

View File

@ -1,3 +1,23 @@
{* 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$
* $Source$
*}
<!-- BEGIN SMARTY TEMPLATE -->
<form id="evolForm" action="fiche.php" method="post">
@ -142,6 +162,17 @@
<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%">
@ -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"'}
</td>
</tr>
<tr>
<td>Taux conclu</td>
<td>
@ -166,6 +196,41 @@
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>

View File

@ -1,3 +1,25 @@
{*
* 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$
* $Source$
*}
<!-- BEGIN SMARTY TEMPLATE -->
<table class="border" width="100%">
@ -93,6 +115,14 @@
</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>

View File

@ -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;
}
}
?>