Fix: Default category when editing a supplier.

This commit is contained in:
Laurent Destailleur 2010-03-12 23:59:23 +00:00
parent a577152057
commit 0f591d36ad
4 changed files with 26 additions and 41 deletions

View File

@ -226,36 +226,11 @@ if ($user->rights->categorie->creer)
}
print '</td></tr>';
if ($_GET['type'] == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)
{
if ($_REQUEST['catorigin'])
{
print '<tr><td>'.$langs->trans ("AddIn").'</td><td>';
print $html->select_all_categories($_GET['type'],$_REQUEST['catorigin']);
print '</td></tr>';
print '<tr><td>'.$langs->trans ("ContentsVisibleByAll").'</td><td>';
print $html->selectyesno("visible", 1,1);
print '</td></tr>';
print '<input type="hidden" name="socid" value="'.$_GET['socid'].'">';
}
else
{
print '<tr><td>'.$langs->trans ("AssignedToCustomer").'</td><td>';
print $html->select_societes($socid,'socid','s.client IN (1, 3) AND s.fournisseur = 0',1);
print '</td></tr>';
print '<input type="hidden" name="catMere" value="-1">';
print '<input type="hidden" name="visible" value="1">';
}
}
else
{
print '<tr><td>'.$langs->trans ("AddIn").'</td><td>';
print $html->select_all_categories($_GET['type']);
print '</td></tr>';
print '<tr><td>'.$langs->trans ("ContentsVisibleByAll").'</td><td>';
print $html->selectyesno("visible", 1,1);
print '</td></tr>';
}
print '<tr><td>'.$langs->trans ("AddIn").'</td><td>';
print $html->select_all_categories($_GET['type'],$_REQUEST['catorigin']);
print '</td></tr>';
print '</table>';
print '<center><br>';

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
*
@ -147,7 +147,7 @@ if ($_GET["id"] || $_GET["ref"])
print '</td></tr>';
// Visibility
if ($type == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)
/* if ($type == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)
{
if ($c->socid)
{
@ -188,6 +188,7 @@ if ($_GET["id"] || $_GET["ref"])
print ($c->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
print '</td></tr>';
}
*/
print "</table>\n";

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
*
@ -134,6 +134,7 @@ print nl2br($c->description);
print '</td></tr>';
// Visibility
/*
if ($type == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)
{
if ($c->socid)
@ -175,6 +176,7 @@ else
print ($c->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
print '</td></tr>';
}
*/
print '</table>';
@ -226,6 +228,7 @@ else
print "</td>\n";
print "\t\t<td>".$cat->description."</td>\n";
/*
if ($cat->visible == 1)
{
print "\t\t<td>".$langs->trans("ContentsVisibleByAllShort")."</td>\n";
@ -234,6 +237,7 @@ else
{
print "\t\t<td>".$langs->trans("ContentsNotVisibleByAllShort")."</td>\n";
}
*/
print "\t</tr>\n";
}

View File

@ -520,6 +520,7 @@ $_GET["action"] == 'create' || $_POST["action"] == 'create')
print '</td></tr>';
// Category
if ($soc->fournisseur)
{
$load = $soc->LoadSupplierCateg();
@ -529,12 +530,13 @@ $_GET["action"] == 'create' || $_POST["action"] == 'create')
{
print '<tr>';
print '<td>'.$langs->trans('SupplierCategory').'</td><td colspan="3">';
$form->select_array("fournisseur_categorie",$soc->SupplierCategories);
$form->select_array("fournisseur_categorie",$soc->SupplierCategories,$_POST["fournisseur_categorie"],1);
print '</td></tr>';
}
}
}
// Barcode
if ($conf->global->MAIN_MODULE_BARCODE)
{
print '<tr><td>'.$langs->trans('Gencod').'</td><td colspan="3"><input type="text" name="gencod">';
@ -904,6 +906,7 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
print '</td></tr>';
// Category
if ($soc->fournisseur)
{
$load = $soc->LoadSupplierCateg();
@ -913,7 +916,7 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
{
print '<tr>';
print '<td>'.$langs->trans('SupplierCategory').'</td><td colspan="3">';
$form->select_array("fournisseur_categorie",$soc->SupplierCategories);
$form->select_array("fournisseur_categorie",$soc->SupplierCategories,'',1);
print '</td></tr>';
}
}
@ -1061,13 +1064,15 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
print '</tr>';
}
print '<tr><td align="center" colspan="4">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print ' &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</td></tr>';
print '</table>';
print '<br>';
print '<center>';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print ' &nbsp; &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</center>';
print '</form>';
}
}