Added ability to assign a category of product to a customer
This commit is contained in:
parent
977bacbdab
commit
cf937a4278
@ -217,7 +217,10 @@ class Categorie
|
||||
{
|
||||
$sql .= ", description = '".addslashes($this->description)."'";
|
||||
}
|
||||
$sql .= ", fk_soc = ".$this->socid;
|
||||
if ($this->socid)
|
||||
{
|
||||
$sql .= ", fk_soc = ".$this->socid;
|
||||
}
|
||||
$sql .= ", visible = '".$this->visible."'";
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
|
||||
@ -140,7 +140,7 @@ else
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
if ($_GET['type'] == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)
|
||||
if ($_GET['type'] == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER && !$categorie->id_mere)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans ("AssignedToCustomer").'</td><td>';
|
||||
print $html->select_societes($categorie->socid,'socid','s.client = 1 AND s.fournisseur = 0',1);
|
||||
|
||||
@ -45,7 +45,11 @@ if ($_REQUEST['origin'])
|
||||
if ($_GET['type'] == 0) $idProdOrigin = $_REQUEST['origin'];
|
||||
if ($_GET['type'] == 1) $idSupplierOrigin = $_REQUEST['origin'];
|
||||
if ($_GET['type'] == 2) $idCompanyOrigin = $_REQUEST['origin'];
|
||||
|
||||
}
|
||||
|
||||
if ($_REQUEST['catorigin'])
|
||||
{
|
||||
if ($_GET['type'] == 0) $idCatOrigin = $_REQUEST['catorigin'];
|
||||
}
|
||||
|
||||
// If socid provided by ajax company selector
|
||||
@ -80,6 +84,11 @@ if ($_POST["action"] == 'add' && $user->rights->categorie->creer)
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?socid='.$idSupplierOrigin.'&type='.$_GET["type"]);
|
||||
exit;
|
||||
}
|
||||
else if ($idCatOrigin)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idCatOrigin.'&type='.$_GET["type"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$_GET["type"]);
|
||||
@ -140,6 +149,11 @@ if ($_POST["action"] == 'add' && $user->rights->categorie->creer)
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?socid='.$idSupplierOrigin.'&mesg='.urlencode($langs->trans("CatCreated")));
|
||||
exit;
|
||||
}
|
||||
if ($idCatOrigin)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idCatOrigin.'&mesg='.urlencode($langs->trans("CatCreated")));
|
||||
exit;
|
||||
}
|
||||
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$result.'&type='.$_POST["type"]);
|
||||
exit;
|
||||
@ -174,6 +188,10 @@ if ($user->rights->categorie->creer)
|
||||
{
|
||||
print '<input type="hidden" name="origin" value="'.$_REQUEST['origin'].'">';
|
||||
}
|
||||
if ($_REQUEST['catorigin'])
|
||||
{
|
||||
print '<input type="hidden" name="catorigin" value="'.$_REQUEST['catorigin'].'">';
|
||||
}
|
||||
print '<input type="hidden" name="nom" value="'.$nom.'">';
|
||||
|
||||
print_fiche_titre($langs->trans("CreateCat"));
|
||||
@ -200,11 +218,24 @@ if ($user->rights->categorie->creer)
|
||||
print '</td></tr>';
|
||||
if ($_GET['type'] == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans ("AssignedToCustomer").'</td><td>';
|
||||
print $html->select_societes($_REQUEST['socid_id'],'socid','s.client = 1 AND s.fournisseur = 0',1);
|
||||
print '</td></tr>';
|
||||
print '<input type="hidden" name="catMere" value="-1">';
|
||||
print '<input type="hidden" name="visible" value="1">';
|
||||
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($_REQUEST['socid_id'],'socid','s.client = 1 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
|
||||
{
|
||||
|
||||
@ -123,13 +123,23 @@ print '</td></tr>';
|
||||
|
||||
if ($type == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($c->socid);
|
||||
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
print $langs->trans("AssignedToTheCustomer").'</td><td>';
|
||||
print $soc->getNomUrl(1);
|
||||
print '</td></tr>';
|
||||
if ($c->socid)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($c->socid);
|
||||
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
print $langs->trans("AssignedToTheCustomer").'</td><td>';
|
||||
print $soc->getNomUrl(1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
print $langs->trans("InternalCategory").'</td><td>';
|
||||
print ($c->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -203,6 +213,21 @@ else
|
||||
print "<tr><td>".$langs->trans("NoSubCat")."</td></tr>";
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
/*
|
||||
* Boutons actions
|
||||
*/
|
||||
if ($type == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)
|
||||
{
|
||||
print "<div class='tabsAction'>\n";
|
||||
|
||||
if ($user->rights->categorie->creer)
|
||||
{
|
||||
print "<a class='butAction' href='fiche.php?action=create&catorigin=".$c->id."&socid=".$c->socid."&type=".$type."'>".$langs->trans("Create")."</a>";
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -323,4 +348,4 @@ if($c->type == 2)
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
?>
|
||||
@ -72,4 +72,5 @@ ThisCategoryHasNoProduct=This category does not contain any product.
|
||||
ThisCategoryHasNoSupplier=This category does not contain any supplier.
|
||||
ThisCategoryHasNoCustomer=This category does not contain any customer.
|
||||
AssignedToCustomer=Assigned to a customer
|
||||
AssignedToTheCustomer=Assigned to the customer
|
||||
AssignedToTheCustomer=Assigned to the customer
|
||||
InternalCategory=Inernal category
|
||||
@ -72,4 +72,5 @@ ThisCategoryHasNoProduct=Cette cat
|
||||
ThisCategoryHasNoSupplier=Cette catégorie ne contient aucun fournisseur.
|
||||
ThisCategoryHasNoCustomer=Cette catégorie ne contient aucun client.
|
||||
AssignedToCustomer=Attribuer à un client
|
||||
AssignedToTheCustomer=Attribué au client
|
||||
AssignedToTheCustomer=Attribué au client
|
||||
InternalCategory=Catégorie interne
|
||||
Loading…
Reference in New Issue
Block a user