dolibarr-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dolibarr-cvs] dolibarr htdocs/commaddpropal.php htdocs/commpr...


From: Regis Houssin
Subject: [Dolibarr-cvs] dolibarr htdocs/commaddpropal.php htdocs/commpr...
Date: Tue, 13 Jun 2006 14:31:38 +0000

CVSROOT:        /cvsroot/dolibarr
Module name:    dolibarr
Changes by:     Regis Houssin <hregis>  06/06/13 14:31:37

Modified files:
        htdocs/comm    : addpropal.php propal.php 
        htdocs/commande: commande.class.php 
        htdocs         : propal.class.php 
        mysql/migration: 2.0.0-2.1.0.sql 
        mysql/tables   : llx_propal.sql 

Log message:
        Ajout possibilité d'attribuer une ref client sur une propale, utile 
pour les revendeurs

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/dolibarr/htdocs/comm/addpropal.php?cvsroot=dolibarr&r1=1.68&r2=1.69
http://cvs.savannah.gnu.org/viewcvs/dolibarr/htdocs/comm/propal.php?cvsroot=dolibarr&r1=1.226&r2=1.227
http://cvs.savannah.gnu.org/viewcvs/dolibarr/htdocs/commande/commande.class.php?cvsroot=dolibarr&r1=1.155&r2=1.156
http://cvs.savannah.gnu.org/viewcvs/dolibarr/htdocs/propal.class.php?cvsroot=dolibarr&r1=1.140&r2=1.141
http://cvs.savannah.gnu.org/viewcvs/dolibarr/mysql/migration/2.0.0-2.1.0.sql?cvsroot=dolibarr&r1=1.101&r2=1.102
http://cvs.savannah.gnu.org/viewcvs/dolibarr/mysql/tables/llx_propal.sql?cvsroot=dolibarr&r1=1.14&r2=1.15

Patches:
Index: htdocs/comm/addpropal.php
===================================================================
RCS file: /cvsroot/dolibarr/dolibarr/htdocs/comm/addpropal.php,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -b -r1.68 -r1.69
--- htdocs/comm/addpropal.php   12 Jun 2006 23:33:08 -0000      1.68
+++ htdocs/comm/addpropal.php   13 Jun 2006 14:31:37 -0000      1.69
@@ -18,7 +18,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  *
- * $Id: addpropal.php,v 1.68 2006/06/12 23:33:08 eldy Exp $
+ * $Id: addpropal.php,v 1.69 2006/06/13 14:31:37 hregis Exp $
  * $Source: /cvsroot/dolibarr/dolibarr/htdocs/comm/addpropal.php,v $
  */
 
@@ -26,7 +26,7 @@
            \file       htdocs/comm/addpropal.php
         \ingroup    propal
                \brief      Page d'ajout d'une proposition commmercial
-               \version    $Revision: 1.68 $
+               \version    $Revision: 1.69 $
 */
 
 require("./pre.inc.php");
@@ -102,6 +102,11 @@
     // Ref
     print '<tr><td>'.$langs->trans("Ref").'</td><td colspan="2"><input 
name="ref" value="'.$numpr.'"></td></tr>';
 
+    // Reference client
+         print '<tr><td>'.$langs->trans('RefCustomer').'</td><td>';
+               print '<input type="text" name="ref_client" value=""></td>';
+               print '</tr>';
+
        // Societe
        print '<tr><td>'.$langs->trans('Company').'</td><td 
colspan="2">'.$soc->getNomUrl(1);
        print '<input type="hidden" name="socidp" value="'.$soc->id.'">';
@@ -365,5 +370,5 @@
 
 $db->close();
 
-llxFooter('$Date: 2006/06/12 23:33:08 $ - $Revision: 1.68 $');
+llxFooter('$Date: 2006/06/13 14:31:37 $ - $Revision: 1.69 $');
 ?>

Index: htdocs/comm/propal.php
===================================================================
RCS file: /cvsroot/dolibarr/dolibarr/htdocs/comm/propal.php,v
retrieving revision 1.226
retrieving revision 1.227
diff -u -b -r1.226 -r1.227
--- htdocs/comm/propal.php      12 Jun 2006 22:48:59 -0000      1.226
+++ htdocs/comm/propal.php      13 Jun 2006 14:31:37 -0000      1.227
@@ -20,7 +20,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  *
- * $Id: propal.php,v 1.226 2006/06/12 22:48:59 eldy Exp $
+ * $Id: propal.php,v 1.227 2006/06/13 14:31:37 hregis Exp $
  * $Source: /cvsroot/dolibarr/dolibarr/htdocs/comm/propal.php,v $
  */
 
@@ -139,6 +139,14 @@
        if ($result < 0) dolibarr_print_error($db,$propal->error);
 }
 
+// Positionne ref client
+if ($_POST['action'] == 'set_ref_client' && $user->rights->propale->creer)
+{
+       $propal = new Propal($db);
+       $propal->fetch($_GET['id']);
+       $propal->set_ref_client($user, $_POST['ref_client']);
+}
+
 if ($_POST['action'] == 'add')
 {
     $propal = new Propal($db, $_POST['socidp']);
@@ -186,6 +194,7 @@
            $propal->modelpdf  = $_POST['model'];
            $propal->author    = $user->id;
            $propal->note      = $_POST['note'];
+           $propal->ref_client = $_POST['ref_client'];
 
            $propal->ref = $_POST['ref'];
 
@@ -591,6 +600,29 @@
                        // Ref
                        print '<tr><td>'.$langs->trans('Ref').'</td><td 
colspan="5">'.$propal->ref_url.'</td></tr>';
 
+                       // Ref client
+                       print '<tr><td>';
+                       print '<table class="nobordernopadding" 
width="100%"><tr><td nowrap>';
+                       print $langs->trans('RefCustomer').'</td><td 
align="left">';
+                       print '</td>';
+                       if ($_GET['action'] != 'refcdeclient' && 
$propal->brouillon) print '<td align="right"><a 
href="'.$_SERVER['PHP_SELF'].'?action=refcdeclient&amp;id='.$propal->id.'">'.img_edit($langs->trans('Edit')).'</a></td>';
+                       print '</tr></table>';
+                       print '</td><td colspan="3">';
+                       if ($user->rights->propale->creer && $_GET['action'] == 
'refcdeclient')
+                       {
+                               print '<form action="fiche.php?id='.$id.'" 
method="post">';
+                               print '<input type="hidden" name="action" 
value="set_ref_client">';
+                               print '<input type="text" class="flat" 
size="20" name="ref_client" value="'.$propal->ref_client.'">';
+                               print ' <input type="submit" class="button" 
value="'.$langs->trans('Modify').'">';
+                               print '</form>';
+                       }
+                       else
+                       {
+                               print $propal->ref_client;
+                       }
+                       print '</td>';
+                       print '</tr>';
+
                        $rowspan=9;
 
                        // Société
@@ -1627,6 +1659,6 @@
 }
 $db->close();
 
-llxFooter('$Date: 2006/06/12 22:48:59 $ - $Revision: 1.226 $');
+llxFooter('$Date: 2006/06/13 14:31:37 $ - $Revision: 1.227 $');
 
 ?>

Index: htdocs/commande/commande.class.php
===================================================================
RCS file: /cvsroot/dolibarr/dolibarr/htdocs/commande/commande.class.php,v
retrieving revision 1.155
retrieving revision 1.156
diff -u -b -r1.155 -r1.156
--- htdocs/commande/commande.class.php  10 Jun 2006 19:36:43 -0000      1.155
+++ htdocs/commande/commande.class.php  13 Jun 2006 14:31:37 -0000      1.156
@@ -18,7 +18,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  *
- * $Id: commande.class.php,v 1.155 2006/06/10 19:36:43 eldy Exp $
+ * $Id: commande.class.php,v 1.156 2006/06/13 14:31:37 hregis Exp $
  * $Source: /cvsroot/dolibarr/dolibarr/htdocs/commande/commande.class.php,v $
  */
  
@@ -26,7 +26,7 @@
         \file       htdocs/commande/commande.class.php
         \ingroup    commande
         \brief      Fichier des classes de commandes
-        \version    $Revision: 1.155 $
+        \version    $Revision: 1.156 $
 */
 
 require_once(DOL_DOCUMENT_ROOT."/product.class.php");
@@ -119,6 +119,7 @@
                $this->date_livraison       = $propal->date_livraison;
                $this->adresse_livraison_id = $propal->adresse_livraison_id;
                $this->contact_id           = $propal->contactid;
+               $this->ref_client           = $propal->ref_client;
     
                /* Définit la société comme un client */
                $soc = new Societe($this->db);
@@ -350,7 +351,7 @@
                $sql.= ' '.$this->db->idate($this->date_commande).',';
                $sql.= ' '.$this->source.', ';
                $sql.= " '".addslashes($this->note)."', ";
-               $sql.= " '".$this->ref_client."', '".$this->modelpdf.'\', 
\''.$this->cond_reglement_id.'\', \''.$this->mode_reglement_id.'\',';
+               $sql.= " '".addslashes($this->ref_client)."', 
'".$this->modelpdf.'\', \''.$this->cond_reglement_id.'\', 
\''.$this->mode_reglement_id.'\',';
                $sql.= ' 
'.($this->date_livraison?$this->db->idate($this->date_livraison):'null').',';
                $sql.= " '".$this->adresse_livraison_id."',";
                $sql.= " '".$this->remise_absolue."',";

Index: htdocs/propal.class.php
===================================================================
RCS file: /cvsroot/dolibarr/dolibarr/htdocs/propal.class.php,v
retrieving revision 1.140
retrieving revision 1.141
diff -u -b -r1.140 -r1.141
--- htdocs/propal.class.php     12 Jun 2006 22:51:56 -0000      1.140
+++ htdocs/propal.class.php     13 Jun 2006 14:31:37 -0000      1.141
@@ -20,7 +20,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  *
- * $Id: propal.class.php,v 1.140 2006/06/12 22:51:56 eldy Exp $
+ * $Id: propal.class.php,v 1.141 2006/06/13 14:31:37 hregis Exp $
  * $Source: /cvsroot/dolibarr/dolibarr/htdocs/propal.class.php,v $
  */
 
@@ -30,7 +30,7 @@
                \author     Rodolphe Qiedeville
                \author     Eric Seigne
                \author     Laurent Destailleur
-               \version    $Revision: 1.140 $
+               \version    $Revision: 1.141 $
 */
 
 require_once(DOL_DOCUMENT_ROOT ."/product.class.php");
@@ -699,14 +699,15 @@
 
         // Insertion dans la base
         $sql = "INSERT INTO ".MAIN_DB_PREFIX."propal (fk_soc, fk_soc_contact, 
price, remise, remise_percent, remise_absolue,";
-        $sql.= " tva, total, datep, datec, ref, fk_user_author, note, 
note_public, model_pdf, fin_validite, fk_cond_reglement, fk_mode_reglement, 
date_livraison) ";
+        $sql.= " tva, total, datep, datec, ref, fk_user_author, note, 
note_public, model_pdf, fin_validite,";
+        $sql.= " fk_cond_reglement, fk_mode_reglement, date_livraison, 
ref_client) ";
         $sql.= " VALUES ($this->socidp, $this->contactid, 0, $this->remise, 
$this->remise_percent, $this->remise_absolue,";
         $sql.= " 0,0,".$this->db->idate($this->datep).", now(), '$this->ref', 
$this->author,";
         $sql.= "'".addslashes($this->note)."',";
         $sql.= "'".addslashes($this->note_public)."',";
         $sql.= "'$this->modelpdf',".$this->db->idate($this->fin_validite).",";
         $sql.= " $this->cond_reglement_id, $this->mode_reglement_id,";
-        $sql.= " ".$this->db->idate($this->date_livraison).")";
+        $sql.= " 
".$this->db->idate($this->date_livraison).",".addslashes($this->ref_client).")";
 
         $resql=$this->db->query($sql);
         if ($resql)
@@ -964,7 +965,7 @@
         $sql.= ", ".$this->db->pdate("datep")." as dp";
         $sql.= ", ".$this->db->pdate("fin_validite")." as dfv";
         $sql.= ", ".$this->db->pdate("date_livraison")." as date_livraison";
-        $sql.= ", model_pdf";
+        $sql.= ", model_pdf, ref_client";
         $sql.= ", note, note_public";
         $sql.= ", fk_projet, fk_statut, fk_user_author";
         $sql.= ", fk_cond_reglement, fk_mode_reglement, fk_adresse_livraison";
@@ -988,6 +989,7 @@
                 $this->fin_validite         = $obj->dfv;
                 $this->date                 = $obj->dp;
                 $this->ref                  = $obj->ref;
+                $this->ref_client           = $obj->ref_client;
                 $this->price                = $obj->price;
                 $this->remise               = $obj->remise;
                 $this->remise_percent       = $obj->remise_percent;
@@ -1232,6 +1234,38 @@
     }
 
     /**
+     *      \brief      Positionne numero reference client
+     *      \param      user            Utilisateur qui modifie
+     *      \param      ref_client      Reference client
+     *      \return     int             <0 si ko, >0 si ok
+     */
+       function set_ref_client($user, $ref_client)
+       {
+               if ($user->rights->propale->creer)
+               {
+               dolibarr_syslog('Propale::set_ref_client 
this->id='.$this->id.', ref_client='.$ref_client);
+
+                       $sql = 'UPDATE '.MAIN_DB_PREFIX.'propal SET ref_client 
= '.(empty($ref_client) ? 'NULL' : '\''.addslashes($ref_client).'\'');
+                       $sql.= ' WHERE rowid = '.$this->id;
+                       if ($this->db->query($sql) )
+                       {
+                               $this->ref_client = $ref_client;
+                               return 1;
+                       }
+                       else
+                       {
+        $this->error=$this->db->error();
+                               dolibarr_syslog('Propale::set_ref_client Erreur 
'.$this->error.' - '.$sql);
+                         return -2;
+                       }
+               }
+               else
+               {
+                   return -1;
+               }
+       }
+
+    /**
      *      \brief      Définit une remise globale relative sur la proposition
      *      \param      user        Objet utilisateur qui modifie
      *      \param      remise      Montant remise

Index: mysql/migration/2.0.0-2.1.0.sql
===================================================================
RCS file: /cvsroot/dolibarr/dolibarr/mysql/migration/2.0.0-2.1.0.sql,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -b -r1.101 -r1.102
--- mysql/migration/2.0.0-2.1.0.sql     12 Jun 2006 23:15:55 -0000      1.101
+++ mysql/migration/2.0.0-2.1.0.sql     13 Jun 2006 14:31:37 -0000      1.102
@@ -1,4 +1,4 @@
--- $Revision: 1.101 $
+-- $Revision: 1.102 $
 --
 -- Attention à l ordre des requetes
 -- ce fichier doit être chargé sur une version 2.0.0 
@@ -297,3 +297,5 @@
 update llx_actioncomm set fk_action = '8' where fk_action =  '3' and label = 
'Envoi commande par mail';
 
 insert into llx_const (name, value, type, visible, note) VALUES 
('PROPALE_VALIDITY_DURATION', '15', 'chaine', 0, 'Durée de validitée des 
propales');
\ No newline at end of file
+
+alter table llx_propal add column ref_client varchar(30) after ref;
\ No newline at end of file

Index: mysql/tables/llx_propal.sql
===================================================================
RCS file: /cvsroot/dolibarr/dolibarr/mysql/tables/llx_propal.sql,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- mysql/tables/llx_propal.sql 20 Apr 2006 13:20:10 -0000      1.14
+++ mysql/tables/llx_propal.sql 13 Jun 2006 14:31:37 -0000      1.15
@@ -15,7 +15,7 @@
 -- along with this program; if not, write to the Free Software
 -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 --
--- $Id: llx_propal.sql,v 1.14 2006/04/20 13:20:10 hregis Exp $
+-- $Id: llx_propal.sql,v 1.15 2006/06/13 14:31:37 hregis Exp $
 -- $Source: /cvsroot/dolibarr/dolibarr/mysql/tables/llx_propal.sql,v $
 --
 -- ===================================================================
@@ -27,6 +27,7 @@
   fk_soc_contact  integer,
   fk_projet       integer DEFAULT 0,     -- projet auquel est rattache la 
propale
   ref             varchar(30) NOT NULL,  -- propal number
+  ref_client      varchar(30),           -- customer order number
   datec           datetime,              -- date de creation 
   datep           date,                  -- date de la propal
   fin_validite    datetime,              -- date de fin de validite




reply via email to

[Prev in Thread] Current Thread [Next in Thread]