* Copyright (C) 2005 Brice Davoleau * Copyright (C) 2005-2006 Regis Houssin * Copyright (C) 2006 Laurent Destailleur * Copyright (C) 2007 Patrick Raguin * * 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$ */ /** \file htdocs/product/categorie.php \ingroup product \brief Page de l'onglet categories de produits \version $Revision$ */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT."/societe.class.php"); require_once(DOL_DOCUMENT_ROOT."/categories/categorie.class.php"); $langs->load("categories"); $langs->load("companies"); if (!$user->rights->societe->lire) accessforbidden(); $mesg = ''; /* * Actions */ //on veut supprimer une catégorie if ($_REQUEST["removecat"] && $user->rights->societe->creer) { $soc = new Societe($db); if ($_REQUEST["socid"]) $result = $soc->fetch($_REQUEST["socid"]); $cat = new Categorie($db,$_REQUEST["removecat"]); $result=$cat->del_type($soc,"societe"); } //on veut ajouter une catégorie if (isset($_REQUEST["catMere"]) && $_REQUEST["catMere"]>=0 && $user->rights->societe->creer) { $soc = new Societe($db); if ($_REQUEST["socid"]) $result = $soc->fetch($_REQUEST["socid"]); $cat = new Categorie($db,$_REQUEST["catMere"]); $result=$cat->add_type($soc,"societe"); if ($result >= 0) { $mesg='
'.$langs->trans("Added").'
'; } else { $mesg='
'.$langs->trans("Error").' '.$cat->error.'
'; } } /* * Creation de l'objet fournisseur correspondant à l'id */ if ($_GET["socid"] || $_GET["ref"]) { $soc = new Societe($db); if ($_GET["socid"]) $result = $soc->fetch($_GET["socid"]); llxHeader("","",$langs->trans("CardCompany".$soc->type)); } $html = new Form($db); /* * Fiche produit */ if ($_GET["socid"] || $_GET["ref"]) { /* * Affichage onglets */ $head = societe_prepare_head($soc); dolibarr_fiche_head($head, 'category', $soc->nom); print ''; print '
'; print ''; print ''; print ''; if ($soc->client) { print ''; } print ""; print '"; print '"; if ($soc->pays) { print ''; } print ''; print ''; print '"; // Assujeti à TVA ou pas print ''; print ''; print ''; // Conditions de réglement par défaut $langs->load('bills'); $html = new Form($db); print '"; print ''; // Mode de règlement print '"; print ''; // Réductions relative (Remises-Ristournes-Rabbais) print ''; print ''; // Réductions absolues (Remises-Ristournes-Rabbais) print ''; print ''; print ''; // multiprix if($conf->global->PRODUIT_MULTIPRICES == 1) { print '"; print ''; } // Adresse de livraison if ($conf->expedition->enabled) { print ''; print ''; } print "
'.$langs->trans("Name").''; print $soc->nom; print '
'.$langs->trans('Prefix').''.$soc->prefix_comm.'
'; print $langs->trans('CustomerCode').''; print $soc->code_client; if ($soc->check_codeclient() <> 0) print ' '.$langs->trans("WrongCustomerCode"); print '
".$langs->trans('Address')."".nl2br($soc->adresse)."
'.$langs->trans('Zip').''.$soc->cp."'.$langs->trans('Town').''.$soc->ville."
'.$langs->trans('Country').''.$soc->pays.'
'.$langs->trans('Phone').''.dolibarr_print_phone($soc->tel,$soc->pays_code).''.$langs->trans('Fax').''.dolibarr_print_phone($soc->fax,$soc->pays_code).'
'.$langs->trans("Web")."url\" target=\"_blank\">".$soc->url." 
'.$langs->trans('VATIsUsed').''; print yn($soc->tva_assuj); print '
'; print ''; print '
'; print $langs->trans('PaymentConditions'); print ''; if (($_GET['action'] != 'editconditions') && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; print '
'; if ($_GET['action'] == 'editconditions') { $html->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$soc->id,$soc->cond_reglement,'cond_reglement_id',-1,1); } else { $html->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$soc->id,$soc->cond_reglement,'none'); } print "
'; print ''; print '
'; print $langs->trans('PaymentMode'); print ''; if (($_GET['action'] != 'editmode') && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('SetMode'),1).'
'; print '
'; if ($_GET['action'] == 'editmode') { $html->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$soc->id,$soc->mode_reglement,'mode_reglement_id'); } else { $html->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$soc->id,$soc->mode_reglement,'none'); } print "
'; print '
'; print $langs->trans("CustomerRelativeDiscountShort"); print ''; if ($user->rights->societe->creer) { print ''.img_edit($langs->trans("Modify")).''; } print '
'; print '
'.($soc->remise_client?$soc->remise_client.'%':$langs->trans("DiscountNone")).'
'; print ''; print '
'; print $langs->trans("CustomerAbsoluteDiscountShort"); print ''; if ($user->rights->societe->creer) { print ''.img_edit($langs->trans("Modify")).''; } print '
'; print '
'; $amount_discount=$soc->getcurrentDiscount(); if ($amount_discount < 0) dolibarr_print_error($db,$societe->error); if ($amount_discount > 0) print $amount_discount.' '.$langs->trans("Currency".$conf->monnaie); else print $langs->trans("DiscountNone"); print '
'; print '
'; print $langs->trans("PriceLevel"); print ''; if ($user->rights->societe->creer) { print ''.img_edit($langs->trans("Modify")).''; } print '
'; print '
'.$soc->price_level."
'; print '
'; print $langs->trans("DeliveriesAddress"); print ''; if ($user->rights->societe->creer) { print ''.img_edit($langs->trans("Modify")).''; } print '
'; print '
'; $sql = "SELECT count(rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."societe_adresse_livraison"; $sql.= " WHERE fk_societe =".$soc->id; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $objal = $db->fetch_object($resql); print $objal->nb?($objal->nb):$langs->trans("NoOtherDeliveryAddress"); } else { dolibarr_print_error($db); } print '
"; print ''; if ($mesg) print($mesg); /* * Barre d'actions * */ print '
'; if ($user->rights->categorie->creer) { print ''.$langs->trans("NewCat").''; } print '
'; // Formulaire ajout dans une categorie if ($user->rights->societe->creer) { print '
'; print '
'; print ''; print ''; print ''; print '
'; print $langs->trans("ClassifyInCategory").' '; print $html->select_all_categories(2,$categorie->id_mere).'
'; print '
'; print '
'; } $c = new Categorie($db); if ($_GET["socid"]) { $cats = $c->containing($_REQUEST["socid"],"societe"); } if (sizeof($cats) > 0) { print_fiche_titre($langs->trans("CompanyIsInCategories")); print ''; print ''; $var = true; foreach ($cats as $cat) { $ways = $cat->print_all_ways (); foreach ($ways as $way) { $var = ! $var; print ""; // Categorie print ""; // Lien supprimer print '"; print "\n"; } } print "
'.$langs->trans("Categories").'
".$way."'; if ($user->rights->societe->creer) { print ""; print img_delete($langs->trans("DeleteFromCat")).' '; print $langs->trans("DeleteFromCat").""; } else { print ' '; } print "

\n"; } else if($cats < 0) { print $langs->trans("ErrorUnknown"); } else { print $langs->trans("CompanyHasNoCategory")."
"; } } $db->close(); llxFooter('$Date$ - $Revision$'); ?>