Fix: A lot of fixes.
This commit is contained in:
parent
e08bcfcb5b
commit
8a0a2dacdf
@ -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;
|
||||||
|
|||||||
@ -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");
|
||||||
|
|||||||
@ -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";
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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,7 +1850,21 @@ 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
|
||||||
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long, 5=Libellé court + Picto
|
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long, 5=Libellé court + Picto
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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,51 +2964,51 @@ 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.= ' u.login';
|
||||||
$sql = 'SELECT a.id, '.$db->pdate('a.datea').' as da, a.label, a.note,';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a, '.MAIN_DB_PREFIX.'user as u';
|
||||||
$sql.= ' u.login';
|
$sql.= ' WHERE a.fk_user_author = u.rowid';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a, '.MAIN_DB_PREFIX.'user as u';
|
$sql.= ' AND a.fk_action in (9,10)';
|
||||||
$sql.= ' WHERE a.fk_user_author = u.rowid';
|
$sql.= ' AND a.fk_soc = '.$fac->socid ;
|
||||||
$sql.= ' AND a.fk_action in (9,10)';
|
$sql.= ' AND a.fk_facture = '.$fac->id;
|
||||||
$sql.= ' AND a.fk_soc = '.$fac->socid ;
|
|
||||||
$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)
|
{
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
if ($num)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
print '<br>';
|
||||||
if ($num)
|
print_titre($langs->trans('ActionsOnBill'));
|
||||||
|
|
||||||
|
$i = 0; $total = 0;
|
||||||
|
print '<table class="border" width="100%">';
|
||||||
|
print '<tr '.$bc[$var].'><td>'.$langs->trans('Ref').'</td><td>'.$langs->trans('Date').'</td><td>'.$langs->trans('Action').'</td><td>'.$langs->trans('By').'</td></tr>';
|
||||||
|
print "\n";
|
||||||
|
|
||||||
|
$var=True;
|
||||||
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
print '<br>';
|
$objp = $db->fetch_object($resql);
|
||||||
print_titre($langs->trans('ActionsOnBill'));
|
$var=!$var;
|
||||||
|
print '<tr '.$bc[$var].'>';
|
||||||
$i = 0; $total = 0;
|
print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$objp->id.'">'.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.'</a></td>';
|
||||||
print '<table class="border" width="100%">';
|
print '<td>'.dolibarr_print_date($objp->da,'day').'</td>';
|
||||||
print '<tr '.$bc[$var].'><td>'.$langs->trans('Ref').'</td><td>'.$langs->trans('Date').'</td><td>'.$langs->trans('Action').'</td><td>'.$langs->trans('By').'</td></tr>';
|
print '<td>'.$objp->label.'</td>';
|
||||||
print "\n";
|
print '<td>'.$objp->login.'</td>';
|
||||||
|
print '</tr>';
|
||||||
$var=True;
|
$i++;
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$objp = $db->fetch_object($resql);
|
|
||||||
$var=!$var;
|
|
||||||
print '<tr '.$bc[$var].'>';
|
|
||||||
print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$objp->id.'">'.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.'</a></td>';
|
|
||||||
print '<td>'.dolibarr_print_date($objp->da,'day').'</td>';
|
|
||||||
print '<td>'.$objp->label.'</td>';
|
|
||||||
print '<td>'.$objp->login.'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
print '</table>';
|
|
||||||
}
|
}
|
||||||
|
print '</table>';
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
dolibarr_print_error($db);
|
{
|
||||||
}
|
dolibarr_print_error($db);
|
||||||
}
|
}
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
|
|
||||||
|
|||||||
@ -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.'&action=valid">'.$langs->trans("Validate").'</a>';
|
if ($user->rights->contrat->creer) print '<a class="butAction" href="fiche.php?id='.$id.'&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&contratid='.$contrat->id.'&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&contratid='.$contrat->id.'&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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?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>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -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');
|
||||||
@ -275,14 +273,29 @@ if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user-
|
|||||||
|
|
||||||
if ($_POST["action"] == 'livraison' && $user->rights->fournisseur->commande->receptionner)
|
if ($_POST["action"] == 'livraison' && $user->rights->fournisseur->commande->receptionner)
|
||||||
{
|
{
|
||||||
$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"]);
|
||||||
Header("Location: fiche.php?id=".$_GET["id"]);
|
if ($result > 0)
|
||||||
exit;
|
{
|
||||||
|
Header("Location: fiche.php?id=".$_GET["id"]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_print_error($db,$commande->error);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Delivery")).'</div>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -897,7 +910,7 @@ else
|
|||||||
/**
|
/**
|
||||||
* Boutons actions
|
* Boutons actions
|
||||||
*/
|
*/
|
||||||
if ($user->societe_id == 0 && $commande->statut < 3 && $_GET['action'] <> 'editline')
|
if ($user->societe_id == 0 && $commande->statut < 3 && $_GET['action'] <> 'editline')
|
||||||
{
|
{
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
@ -924,8 +937,8 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($commande->statut == 2)
|
if ($commande->statut == 2)
|
||||||
{
|
{
|
||||||
if ($user->rights->fournisseur->commande->annuler)
|
if ($user->rights->fournisseur->commande->annuler)
|
||||||
{
|
{
|
||||||
@ -969,7 +982,7 @@ else
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if ( $user->rights->fournisseur->commande->commander && $commande->statut == 2)
|
if ( $user->rights->fournisseur->commande->commander && $commande->statut == 2)
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Commander
|
* Commander
|
||||||
@ -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[''] = ' ';
|
||||||
$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);
|
||||||
|
|
||||||
|
|||||||
@ -1006,57 +1006,63 @@ 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;
|
|
||||||
if ($user->rights->fournisseur->commande->receptionner && $date < time())
|
|
||||||
{
|
|
||||||
if ($type == 'par')
|
|
||||||
{
|
|
||||||
$statut = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($type == 'tot')
|
|
||||||
{
|
|
||||||
$statut = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($statut == 4 or $statut == 5)
|
|
||||||
{
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur";
|
|
||||||
$sql .= " SET fk_statut = ".$statut;
|
|
||||||
$sql .= " WHERE rowid = ".$this->id;
|
|
||||||
$sql .= " AND (fk_statut = 3 OR fk_statut = 4) ;";
|
|
||||||
|
|
||||||
if ($this->db->query($sql) )
|
|
||||||
{
|
|
||||||
$result = 0;
|
$result = 0;
|
||||||
$this->log($user, $statut, $date);
|
|
||||||
}
|
dolibarr_syslog("CommandeFournisseur::Livraison");
|
||||||
else
|
|
||||||
{
|
if ($user->rights->fournisseur->commande->receptionner && $date < time())
|
||||||
dolibarr_syslog("CommandeFournisseur::Livraison Error -1");
|
{
|
||||||
$result = -1;
|
if ($type == 'tot') $statut = 5;
|
||||||
}
|
if ($type == 'par') $statut = 4;
|
||||||
}
|
if ($type == 'nev') $statut = 6;
|
||||||
else
|
if ($type == 'can') $statut = 6;
|
||||||
{
|
|
||||||
dolibarr_syslog("CommandeFournisseur::Livraison Error -2");
|
if ($statut == 4 or $statut == 5 or $statut == 6)
|
||||||
$result = -2;
|
{
|
||||||
}
|
$this->db->begin();
|
||||||
}
|
|
||||||
else
|
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur";
|
||||||
{
|
$sql.= " SET fk_statut = ".$statut;
|
||||||
dolibarr_syslog("CommandeFournisseur::Livraison Not Authorized");
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
}
|
$sql.= " AND (fk_statut = 3 OR fk_statut = 4)";
|
||||||
return $result ;
|
|
||||||
}
|
dolibarr_syslog("CommandeFournisseur::Livraison sql=".$sql);
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$result = 0;
|
||||||
|
$result=$this->log($user, $statut, $date);
|
||||||
|
|
||||||
|
$this->db->commit();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
|
dolibarr_syslog("CommandeFournisseur::Livraison Error ".$this->error, LOG_ERR);
|
||||||
|
$result = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_syslog("CommandeFournisseur::Livraison Error -2", LOG_ERR);
|
||||||
|
$result = -2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_syslog("CommandeFournisseur::Livraison Not Authorized");
|
||||||
|
}
|
||||||
|
return $result ;
|
||||||
|
}
|
||||||
|
|
||||||
/** \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
|
||||||
|
|||||||
@ -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"> </option>';
|
if ($addempty) print '<option value="-1" selected="true"> </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>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
140
htdocs/soc.php
140
htdocs/soc.php
@ -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"];
|
||||||
@ -111,87 +113,97 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
|
|||||||
$soc->fournisseur_categorie = $_POST["fournisseur_categorie"];
|
$soc->fournisseur_categorie = $_POST["fournisseur_categorie"];
|
||||||
|
|
||||||
$soc->commercial_id = $_POST["commercial_id"];
|
$soc->commercial_id = $_POST["commercial_id"];
|
||||||
|
|
||||||
// On vérifie si un tiers devient client ou fournisseur pour l'obtention d'un code automatiqe
|
|
||||||
if ($soc->client && $soc->code_client == -1)
|
|
||||||
{
|
|
||||||
$soc->code_client = -1;
|
|
||||||
}
|
|
||||||
else if ($_POST['code_auto'])
|
|
||||||
{
|
|
||||||
$soc->code_client = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($soc->fournisseur && $soc->code_fournisseur == -1)
|
|
||||||
{
|
|
||||||
$soc->code_fournisseur = -1;
|
|
||||||
}
|
|
||||||
else if ($_POST['code_auto'])
|
|
||||||
{
|
|
||||||
$soc->code_fournisseur = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_POST["action"] == 'add')
|
|
||||||
|
if ($soc->fournisseur && ! $conf->fournisseur->enabled)
|
||||||
{
|
{
|
||||||
$result = $soc->create($user);
|
$error = 1;
|
||||||
|
$soc->error = $langs->trans("ErrorSupplierModuleNotEnabled");
|
||||||
if ($result >= 0)
|
$_GET["action"]= "create";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
// 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 == 1 )
|
$soc->code_client = -1;
|
||||||
|
}
|
||||||
|
else if ($_POST['code_auto'])
|
||||||
|
{
|
||||||
|
$soc->code_client = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($soc->fournisseur && $soc->code_fournisseur == -1)
|
||||||
|
{
|
||||||
|
$soc->code_fournisseur = -1;
|
||||||
|
}
|
||||||
|
else if ($_POST['code_auto'])
|
||||||
|
{
|
||||||
|
$soc->code_fournisseur = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_POST["action"] == 'add')
|
||||||
|
{
|
||||||
|
$result = $soc->create($user);
|
||||||
|
|
||||||
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
Header("Location: comm/fiche.php?socid=".$soc->id);
|
if ( $soc->client == 1 )
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( $soc->fournisseur == 1 )
|
|
||||||
{
|
{
|
||||||
Header("Location: fourn/fiche.php?socid=".$soc->id);
|
Header("Location: comm/fiche.php?socid=".$soc->id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Header("Location: soc.php?socid=".$soc->id);
|
if ( $soc->fournisseur == 1 )
|
||||||
return;
|
{
|
||||||
|
Header("Location: fourn/fiche.php?socid=".$soc->id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Header("Location: soc.php?socid=".$soc->id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
$mesg=$langs->trans($soc->error);
|
||||||
|
$_GET["action"]='create';
|
||||||
}
|
}
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$langs->load("errors");
|
|
||||||
$mesg=$langs->trans($soc->error);
|
|
||||||
$_GET["action"]='create';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_POST["action"] == 'update')
|
if ($_POST["action"] == 'update')
|
||||||
{
|
|
||||||
if ($_POST["cancel"])
|
|
||||||
{
|
{
|
||||||
Header("Location: soc.php?socid=".$socid);
|
if ($_POST["cancel"])
|
||||||
exit;
|
{
|
||||||
}
|
Header("Location: soc.php?socid=".$socid);
|
||||||
|
exit;
|
||||||
$oldsoc=new Societe($db);
|
}
|
||||||
$result=$oldsoc->fetch($socid);
|
|
||||||
|
|
||||||
$result = $soc->update($socid,$user,1,$oldsoc->codeclient_modifiable(),$oldsoc->codefournisseur_modifiable());
|
|
||||||
if ($result >= 0)
|
|
||||||
{
|
|
||||||
Header("Location: soc.php?socid=".$socid);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$soc->id = $socid;
|
|
||||||
$reload = 0;
|
|
||||||
|
|
||||||
$mesg = $soc->error;
|
$oldsoc=new Societe($db);
|
||||||
$_GET["action"]= "edit";
|
$result=$oldsoc->fetch($socid);
|
||||||
|
|
||||||
|
$result = $soc->update($socid,$user,1,$oldsoc->codeclient_modifiable(),$oldsoc->codefournisseur_modifiable());
|
||||||
|
if ($result >= 0)
|
||||||
|
{
|
||||||
|
Header("Location: soc.php?socid=".$socid);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$soc->id = $socid;
|
||||||
|
$reload = 0;
|
||||||
|
|
||||||
|
$mesg = $soc->error;
|
||||||
|
$_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)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user