Nouvelle gestion des fournisseurs
This commit is contained in:
parent
df4a56da49
commit
84dfda2ed8
@ -56,7 +56,7 @@ function llxHeader($head = "", $title="") {
|
||||
$menu->add_submenu(DOL_URL_ROOT."/telephonie/facture/check.php", "Verif");
|
||||
$menu->add_submenu(DOL_URL_ROOT."/telephonie/facture/stats.php", "Stats");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/fournisseurs.php", "Fournisseurs");
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/fournisseur/", "Fournisseurs");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/statca/", "Chiffre d'affaire");
|
||||
|
||||
|
||||
101
htdocs/telephonie/fournisseur/fiche.php
Normal file
101
htdocs/telephonie/fournisseur/fiche.php
Normal file
@ -0,0 +1,101 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.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$
|
||||
*
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
$mesg = '';
|
||||
|
||||
if ($_POST["action"] == 'add')
|
||||
{
|
||||
$fourn = new FournisseurTelephonie($db);
|
||||
|
||||
$fourn->nom = $_POST["nom"];
|
||||
$fourn->email_commande = $_POST["email_commande"];
|
||||
|
||||
if ( $fourn->create($user) == 0)
|
||||
{
|
||||
Header("Location: index.php");
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'active')
|
||||
{
|
||||
$fourn = new FournisseurTelephonie($db);
|
||||
$fourn->id = $_GET["id"];
|
||||
|
||||
if ( $fourn->active($user) == 0)
|
||||
{
|
||||
Header("Location: index.php");
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'desactive')
|
||||
{
|
||||
$fourn = new FournisseurTelephonie($db);
|
||||
$fourn->id = $_GET["id"];
|
||||
|
||||
if ( $fourn->desactive($user) == 0)
|
||||
{
|
||||
Header("Location: index.php");
|
||||
}
|
||||
}
|
||||
|
||||
llxHeader("","","Fiche Fournisseur");
|
||||
|
||||
if ($cancel == $langs->trans("Cancel"))
|
||||
{
|
||||
$action = '';
|
||||
}
|
||||
|
||||
/*
|
||||
* Création
|
||||
*
|
||||
*/
|
||||
|
||||
if ($_GET["action"] == 'create')
|
||||
{
|
||||
$fourn = new FournisseurTelephonie($db);
|
||||
print "<form action=\"fiche.php\" method=\"post\">\n";
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
print_titre("Nouveau fournisseur");
|
||||
|
||||
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
|
||||
|
||||
print '<tr><td width="20%">Nom</td><td><input name="nom" size="30" value=""></td></tr>';
|
||||
print '<tr><td width="20%">Email de commande</td><td><input name="email_commande" size="40" value=""> (adresse email à laquelle sont envoyées les commandes de lignes</td></tr>';
|
||||
|
||||
print '<tr><td> </td><td><input type="submit" value="Créer"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Error";
|
||||
}
|
||||
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
130
htdocs/telephonie/fournisseur/index.php
Normal file
130
htdocs/telephonie/fournisseur/index.php
Normal file
@ -0,0 +1,130 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.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$
|
||||
*
|
||||
*/
|
||||
require("./pre.inc.php");
|
||||
|
||||
$user->getrights('telephonie');
|
||||
|
||||
|
||||
|
||||
$page = $_GET["page"];
|
||||
$sortorder = $_GET["sortorder"];
|
||||
|
||||
llxHeader();
|
||||
|
||||
if (!$user->rights->telephonie->lire)
|
||||
accessforbidden();
|
||||
|
||||
/*
|
||||
* Sécurité accés client
|
||||
*/
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socidp = $user->societe_id;
|
||||
}
|
||||
|
||||
if ($sortorder == "") {
|
||||
$sortorder="ASC";
|
||||
}
|
||||
if ($sortfield == "") {
|
||||
$sortfield="f.nom";
|
||||
}
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
|
||||
$offset = $conf->liste_limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
/*
|
||||
* Mode Liste
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT f.rowid, f.nom, f.email_commande, f.commande_active";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_fournisseur as f";
|
||||
|
||||
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
|
||||
print_barre_liste("Fournisseurs", $page, "fournisseurs.php", "", $sortfield, $sortorder, '', $num);
|
||||
|
||||
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Société","fournisseurs.php","s.nom");
|
||||
print '<td>Email de commande</td>';
|
||||
print '<td align="center">Commande possible</td>';
|
||||
|
||||
if($user->rights->telephonie->fournisseur->config)
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
{
|
||||
$obj = $db->fetch_object($i);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td>".$obj->nom."</td>\n";
|
||||
print "<td>".$obj->email_commande."</td>\n";
|
||||
print '<td align="center">'.$langs->trans($yesno[$obj->commande_active])."</td>\n";
|
||||
|
||||
if($user->rights->telephonie->fournisseur->config)
|
||||
{
|
||||
print '<td align="center">';
|
||||
if ($obj->commande_active)
|
||||
{
|
||||
print '<a href="fiche.php?action=desactive&id='.$obj->rowid.'">Désactive</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="fiche.php?action=active&id='.$obj->rowid.'">Active</a>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
$db->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
print $db->error() . ' ' . $sql;
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
69
htdocs/telephonie/fournisseur/pre.inc.php
Normal file
69
htdocs/telephonie/fournisseur/pre.inc.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.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$
|
||||
*
|
||||
*/
|
||||
require("../../main.inc.php");
|
||||
require(DOL_DOCUMENT_ROOT."/telephonie/fournisseurtel.class.php");
|
||||
$user->getrights('telephonie');
|
||||
|
||||
function llxHeader($head = "", $title="") {
|
||||
global $user, $conf;
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
top_menu($head, $title);
|
||||
|
||||
$menu = new Menu();
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/simulation/fiche.php", "Simulation");
|
||||
$menu->add_submenu(DOL_URL_ROOT."/telephonie/simulation/fiche.php?action=create", "Nouvelle");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/client/index.php", "Clients");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commandes");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/facture/", "Factures");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/stats/", "Statistiques");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/fournisseur/index.php", "Fournisseurs");
|
||||
|
||||
if($user->rights->telephonie->fournisseur->config)
|
||||
{
|
||||
$menu->add_submenu(DOL_URL_ROOT."/telephonie/fournisseur/fiche.php?action=create", "Nouveau");
|
||||
}
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/statca/", "Chiffre d'affaire");
|
||||
|
||||
if ($user->admin)
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/config/", "Configuration");
|
||||
|
||||
left_menu($menu->liste);
|
||||
}
|
||||
|
||||
?>
|
||||
@ -80,6 +80,13 @@ if ($result)
|
||||
print_liste_field_titre("Société","fournisseurs.php","s.nom");
|
||||
print '<td>Email de commande</td>';
|
||||
|
||||
if($user->rights->telephonie->fournisseur->config)
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td><input type=""></td>';
|
||||
print '<td>Email de commande</td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
|
||||
|
||||
@ -31,7 +31,24 @@ class FournisseurTelephonie {
|
||||
$this->id = $id;
|
||||
return 1;
|
||||
}
|
||||
/*
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
function create()
|
||||
{
|
||||
$res = 0;
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_fournisseur";
|
||||
$sql .= " (nom, email_commande, commande_active)";
|
||||
$sql .= " VALUES ('".$this->nom."','".$this->email_commande."',1)";
|
||||
|
||||
if (! $this->db->query($sql) )
|
||||
{
|
||||
$res = -1;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@ -65,6 +82,40 @@ class FournisseurTelephonie {
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
function active()
|
||||
{
|
||||
$res = 0;
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_fournisseur";
|
||||
$sql .= " SET commande_active = 1";
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
if (! $this->db->query($sql) )
|
||||
{
|
||||
$res = -1;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
function desactive()
|
||||
{
|
||||
$res = 0;
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_fournisseur";
|
||||
$sql .= " SET commande_active = 0";
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
if (! $this->db->query($sql) )
|
||||
{
|
||||
$res = -1;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -60,7 +60,7 @@ function llxHeader($head = "", $title="") {
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/stats/", "Statistiques");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/fournisseurs.php", "Fournisseurs");
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/fournisseur/", "Fournisseurs");
|
||||
|
||||
|
||||
left_menu($menu->liste);
|
||||
|
||||
@ -58,7 +58,7 @@ function llxHeader($head = "", $title="") {
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/stats/", "Statistiques");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/fournisseurs.php", "Fournisseurs");
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/fournisseur/", "Fournisseurs");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/statca/", "Chiffre d'affaire");
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ function llxHeader($head = "", $title="") {
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/stats/", "Statistiques");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/fournisseurs.php", "Fournisseurs");
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/fournisseur/index.php", "Fournisseurs");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/statca/", "Chiffre d'affaire");
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user