Fix: A lot of fixes.

This commit is contained in:
Laurent Destailleur 2008-02-28 16:57:55 +00:00
parent e08bcfcb5b
commit 8a0a2dacdf
14 changed files with 238 additions and 198 deletions

View File

@ -19,10 +19,10 @@
/** /**
\file agenda/events.class.php \file agenda/events.class.php
\ingroup agenda \ingroup agenda
\brief Events class file \brief Events class file.
\version $Id$ \version $Id$
\author Laurent Destailleur \author Laurent Destailleur
\remarks Initialy built by build_class_from_table on 2008-02-28 17:25 \remarks An event is when status of an object change.
*/ */
// Put here all includes required by your class file // Put here all includes required by your class file
@ -46,7 +46,6 @@ class Events // extends CommonObject
var $id; var $id;
var $id;
var $tms; var $tms;
var $fk_action; var $fk_action;
var $dateevent; var $dateevent;

View File

@ -17,15 +17,13 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/ */
/** /**
\file htdocs/categories/index.php \file htdocs/categories/index.php
\ingroup category \ingroup category
\brief Page accueil espace categories \brief Page accueil espace categories
\version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");

View File

@ -16,17 +16,13 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*
*/ */
/*! /**
\file htdocs/categories/pre.inc.php \file htdocs/categories/pre.inc.php
\ingroup product,service \ingroup product,service
\brief Fichier gestionnaire du menu gauche des produits et services \brief Fichier gestionnaire du menu gauche des produits et services
\version $Revision$ \version $Id$
*/ */
require "../main.inc.php"; require "../main.inc.php";

View File

@ -109,7 +109,7 @@ if ($_GET["id"] > 0) {
// Ref // Ref
print '<tr><td width="18%">'.$langs->trans("Ref")."</td>"; print '<tr><td width="18%">'.$langs->trans("Ref")."</td>";
print '<td colspan="2">'.$commande->ref.'</td>'; print '<td colspan="2">'.$commande->ref.'</td>';
print '<td width="50%">'.$langs->trans("Source").' : ' . $commande->sources[$commande->source] ; print '<td width="50%">'.$langs->trans("Source").' : '.$commande->getLabelSource();
if ($commande->source == 0) if ($commande->source == 0)
{ {
// Propale // Propale

View File

@ -75,6 +75,7 @@ class Commande extends CommonObject
var $nbtodo; var $nbtodo;
var $nbtodolate; var $nbtodolate;
/** /**
* \brief Constructeur * \brief Constructeur
* \param DB Handler d'accès base * \param DB Handler d'accès base
@ -87,19 +88,13 @@ class Commande extends CommonObject
$this->socid = $socid; $this->socid = $socid;
$this->id = $commandeid; $this->id = $commandeid;
$this->sources[0] = $langs->trans('OrderSource0');
$this->sources[1] = $langs->trans('OrderSource1');
$this->sources[2] = $langs->trans('OrderSource2');
$this->sources[3] = $langs->trans('OrderSource3');
$this->sources[4] = $langs->trans('OrderSource4');
$this->sources[5] = $langs->trans('OrderSource5');
$this->remise = 0; $this->remise = 0;
$this->remise_percent = 0; $this->remise_percent = 0;
$this->products = array(); $this->products = array();
} }
/** \brief Créé la commande depuis une propale existante /** \brief Créé la commande depuis une propale existante
\param user Utilisateur qui crée \param user Utilisateur qui crée
\param propale_id id de la propale qui sert de modèle \param propale_id id de la propale qui sert de modèle
@ -1855,6 +1850,20 @@ class Commande extends CommonObject
} }
} }
/**
* \brief Return source label of order
* \return string Label
*/
function getLabelSource()
{
global $langs;
$label=$langs->trans('OrderSource'.$this->source);
// \TODO Si libelle non trouve, on va chercher en base dans dictionnaire
return $label;
}
/** /**
* \brief Retourne le libellé du statut de la commande * \brief Retourne le libellé du statut de la commande

View File

@ -1141,7 +1141,7 @@ else
// Date // Date
print '<tr><td>'.$langs->trans('Date').'</td>'; print '<tr><td>'.$langs->trans('Date').'</td>';
print '<td colspan="2">'.dolibarr_print_date($commande->date,'daytext').'</td>'; print '<td colspan="2">'.dolibarr_print_date($commande->date,'daytext').'</td>';
print '<td width="50%">'.$langs->trans('Source').' : ' . $commande->sources[$commande->source] ; print '<td width="50%">'.$langs->trans('Source').' : '.$commande->getLabelSource();
if ($commande->source == 0 && $conf->propal->enabled) if ($commande->source == 0 && $conf->propal->enabled)
{ {
// Si source = propal // Si source = propal

View File

@ -159,7 +159,7 @@ if ($_GET["id"] > 0)
// Date // Date
print '<tr><td>'.$langs->trans('Date').'</td>'; print '<tr><td>'.$langs->trans('Date').'</td>';
print '<td colspan="2">'.dolibarr_print_date($commande->date,'daytext').'</td>'; print '<td colspan="2">'.dolibarr_print_date($commande->date,'daytext').'</td>';
print '<td width="50%">'.$langs->trans('Source').' : ' . $commande->sources[$commande->source] ; print '<td width="50%">'.$langs->trans('Source').' : '.$commande->getLabelSource();
if ($commande->source == 0) if ($commande->source == 0)
{ {
// Si source = propal // Si source = propal

View File

@ -24,7 +24,7 @@
/** /**
\file htdocs/compta/facture.php \file htdocs/compta/facture.php
\ingroup facture \ingroup facture
\brief Page de création d'une facture \brief Page de création/visu facture
\version $Id$ \version $Id$
*/ */
@ -2964,9 +2964,9 @@ else
/* /*
* Liste des actions propres à la facture * Liste des actions propres à la facture
* Action 9 and 10 are implicits actions. Do not protect this section according
* to agenda module permissions.
*/ */
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
{
$sql = 'SELECT a.id, '.$db->pdate('a.datea').' as da, a.label, a.note,'; $sql = 'SELECT a.id, '.$db->pdate('a.datea').' as da, a.label, a.note,';
$sql.= ' u.login'; $sql.= ' u.login';
$sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a, '.MAIN_DB_PREFIX.'user as u'; $sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a, '.MAIN_DB_PREFIX.'user as u';
@ -2975,6 +2975,7 @@ else
$sql.= ' AND a.fk_soc = '.$fac->socid ; $sql.= ' AND a.fk_soc = '.$fac->socid ;
$sql.= ' AND a.fk_facture = '.$fac->id; $sql.= ' AND a.fk_facture = '.$fac->id;
dolibarr_syslog("compta/facture.php sql=".$sql);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
@ -3009,7 +3010,6 @@ else
{ {
dolibarr_print_error($db); dolibarr_print_error($db);
} }
}
print '</td></tr></table>'; print '</td></tr></table>';

View File

@ -1178,14 +1178,15 @@ else
if ($contrat->statut == 0 && $nbofservices) if ($contrat->statut == 0 && $nbofservices)
{ {
if ($user->rights->facture->creer ) print '<a class="butAction" href="fiche.php?id='.$id.'&amp;action=valid">'.$langs->trans("Validate").'</a>'; if ($user->rights->contrat->creer) print '<a class="butAction" href="fiche.php?id='.$id.'&amp;action=valid">'.$langs->trans("Validate").'</a>';
else print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("Validate").'</a>'; else print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("Validate").'</a>';
} }
if ($contrat->statut > 0 && $user->rights->facture->creer) if ($contrat->statut > 0)
{ {
$langs->load("bills"); $langs->load("bills");
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;contratid='.$contrat->id.'&amp;socid='.$contrat->societe->id.'">'.$langs->trans("CreateBill").'</a>'; if ($user->rights->facture->creer) print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;contratid='.$contrat->id.'&amp;socid='.$contrat->societe->id.'">'.$langs->trans("CreateBill").'</a>';
else print '<a class="butAction" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("CreateBill").'</a>';
} }
$numclos=$contrat->array_detail(5); // Tableau des lignes au statut clos $numclos=$contrat->array_detail(5); // Tableau des lignes au statut clos

View File

@ -149,7 +149,7 @@ if ($_GET["id"] > 0)
// Date // Date
print '<tr><td>'.$langs->trans('Date').'</td>'; print '<tr><td>'.$langs->trans('Date').'</td>';
print '<td colspan="2">'.dolibarr_print_date($commande->date,'daytext').'</td>'; print '<td colspan="2">'.dolibarr_print_date($commande->date,'daytext').'</td>';
print '<td width="50%">'.$langs->trans('Source').' : ' . $commande->sources[$commande->source] ; print '<td width="50%">'.$langs->trans('Source').' : '.$commande->getLabelSource();
if ($commande->source == 0) if ($commande->source == 0)
{ {
// Si source = propal // Si source = propal

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
* *
@ -17,15 +17,13 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/ */
/** /**
\file htdocs/fourn/commande/fiche.php \file htdocs/fourn/commande/fiche.php
\ingroup commande \ingroup commande
\brief Fiche commande \brief Fiche commande
\version $Revision$ \version $Id$
*/ */
require('./pre.inc.php'); require('./pre.inc.php');
@ -278,11 +276,26 @@ if ($_POST["action"] == 'livraison' && $user->rights->fournisseur->commande->rec
$commande = new CommandeFournisseur($db); $commande = new CommandeFournisseur($db);
$commande->fetch($_GET["id"]); $commande->fetch($_GET["id"]);
$date_liv = mktime(0,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]); if ($_POST["type"])
{
$date_liv = dolibarr_mktime(0,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]);
$result = $commande->Livraison($user, $date_liv, $_POST["type"]); $result = $commande->Livraison($user, $date_liv, $_POST["type"]);
if ($result > 0)
{
Header("Location: fiche.php?id=".$_GET["id"]); Header("Location: fiche.php?id=".$_GET["id"]);
exit; exit;
}
else
{
dolibarr_print_error($db,$commande->error);
exit;
}
}
else
{
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Delivery")).'</div>';
}
} }
@ -1012,8 +1025,11 @@ else
print "<tr><td>".$langs->trans("Delivery")."</td><td>\n"; print "<tr><td>".$langs->trans("Delivery")."</td><td>\n";
$liv = array(); $liv = array();
$liv['par'] = $langs->trans("PartialWoman"); $liv[''] = '&nbsp;';
$liv['tot'] = $langs->trans("TotalWoman"); $liv['tot'] = $langs->trans("TotalWoman");
$liv['par'] = $langs->trans("PartialWoman");
$liv['nev'] = $langs->trans("NeverReceived");
$liv['can'] = $langs->trans("Canceled");
print $html->select_array("type",$liv); print $html->select_array("type",$liv);

View File

@ -1007,47 +1007,53 @@ class CommandeFournisseur extends Commande
} }
/** /**
* Livraison * \bref Set a delivery in database for this supplier order
* * \param user User that input data
* * \param date Date of reception
* \param type Type of receipt
*/ */
function Livraison($user, $date, $type) function Livraison($user, $date, $type)
{ {
dolibarr_syslog("CommandeFournisseur::Livraison");
$result = 0; $result = 0;
dolibarr_syslog("CommandeFournisseur::Livraison");
if ($user->rights->fournisseur->commande->receptionner && $date < time()) if ($user->rights->fournisseur->commande->receptionner && $date < time())
{ {
if ($type == 'par') if ($type == 'tot') $statut = 5;
{ if ($type == 'par') $statut = 4;
$statut = 4; if ($type == 'nev') $statut = 6;
} if ($type == 'can') $statut = 6;
if ($type == 'tot') if ($statut == 4 or $statut == 5 or $statut == 6)
{ {
$statut = 5; $this->db->begin();
}
if ($statut == 4 or $statut == 5)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur"; $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur";
$sql .= " SET fk_statut = ".$statut; $sql.= " SET fk_statut = ".$statut;
$sql .= " WHERE rowid = ".$this->id; $sql.= " WHERE rowid = ".$this->id;
$sql .= " AND (fk_statut = 3 OR fk_statut = 4) ;"; $sql.= " AND (fk_statut = 3 OR fk_statut = 4)";
if ($this->db->query($sql) ) dolibarr_syslog("CommandeFournisseur::Livraison sql=".$sql);
$resql=$this->db->query($sql);
if ($resql)
{ {
$result = 0; $result = 0;
$this->log($user, $statut, $date); $result=$this->log($user, $statut, $date);
$this->db->commit();
} }
else else
{ {
dolibarr_syslog("CommandeFournisseur::Livraison Error -1"); $this->db->rollback();
$this->error=$this->db->lasterror();
dolibarr_syslog("CommandeFournisseur::Livraison Error ".$this->error, LOG_ERR);
$result = -1; $result = -1;
} }
} }
else else
{ {
dolibarr_syslog("CommandeFournisseur::Livraison Error -2"); dolibarr_syslog("CommandeFournisseur::Livraison Error -2", LOG_ERR);
$result = -2; $result = -2;
} }
} }

View File

@ -320,6 +320,8 @@ class Form
global $conf,$langs; global $conf,$langs;
print '<select class="flat" name="'.$htmlname.'" '.$htmloption.'>'; print '<select class="flat" name="'.$htmlname.'" '.$htmloption.'>';
if ($addempty) print '<option value="-1" selected="true">&nbsp;</option>'; if ($addempty) print '<option value="-1" selected="true">&nbsp;</option>';
// \TODO Aller cherches les sources dans dictionnaire
print '<option value="0"'.($selected=='0'?' selected="true"':'').'>'.$langs->trans('OrderSource0').'</option>'; print '<option value="0"'.($selected=='0'?' selected="true"':'').'>'.$langs->trans('OrderSource0').'</option>';
print '<option value="1"'.($selected=='1'?' selected="true"':'').'>'.$langs->trans('OrderSource1').'</option>'; print '<option value="1"'.($selected=='1'?' selected="true"':'').'>'.$langs->trans('OrderSource1').'</option>';
print '<option value="2"'.($selected=='2'?' selected="true"':'').'>'.$langs->trans('OrderSource2').'</option>'; print '<option value="2"'.($selected=='2'?' selected="true"':'').'>'.$langs->trans('OrderSource2').'</option>';
@ -327,6 +329,7 @@ class Form
print '<option value="4"'.($selected=='4'?' selected="true"':'').'>'.$langs->trans('OrderSource4').'</option>'; print '<option value="4"'.($selected=='4'?' selected="true"':'').'>'.$langs->trans('OrderSource4').'</option>';
print '<option value="5"'.($selected=='5'?' selected="true"':'').'>'.$langs->trans('OrderSource5').'</option>'; print '<option value="5"'.($selected=='5'?' selected="true"':'').'>'.$langs->trans('OrderSource5').'</option>';
print '<option value="6"'.($selected=='6'?' selected="true"':'').'>'.$langs->trans('OrderSource6').'</option>'; print '<option value="6"'.($selected=='6'?' selected="true"':'').'>'.$langs->trans('OrderSource6').'</option>';
print '</select>'; print '</select>';
} }

View File

@ -62,6 +62,8 @@ if ($_POST["getsuppliercode"])
if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"]) if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
&& ($_POST["action"] == 'add' || $_POST["action"] == 'update') && $user->rights->societe->creer) && ($_POST["action"] == 'add' || $_POST["action"] == 'update') && $user->rights->societe->creer)
{ {
$error=0;
if ($_REQUEST["private"] == 1) if ($_REQUEST["private"] == 1)
{ {
$soc->nom = $_POST["nom"].' '.$_POST["prenom"]; $soc->nom = $_POST["nom"].' '.$_POST["prenom"];
@ -112,6 +114,16 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
$soc->commercial_id = $_POST["commercial_id"]; $soc->commercial_id = $_POST["commercial_id"];
if ($soc->fournisseur && ! $conf->fournisseur->enabled)
{
$error = 1;
$soc->error = $langs->trans("ErrorSupplierModuleNotEnabled");
$_GET["action"]= "create";
}
if (! $error)
{
// On vérifie si un tiers devient client ou fournisseur pour l'obtention d'un code automatiqe // On vérifie si un tiers devient client ou fournisseur pour l'obtention d'un code automatiqe
if ($soc->client && $soc->code_client == -1) if ($soc->client && $soc->code_client == -1)
{ {
@ -191,7 +203,7 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
$_GET["action"]= "edit"; $_GET["action"]= "edit";
} }
} }
}
} }
if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->societe->supprimer) if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->societe->supprimer)