mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 09:38:23 +01:00
Fix: uniformize code
New: add categories module library
This commit is contained in:
@@ -120,6 +120,7 @@ class modMyModule extends DolibarrModules
|
||||
// 'user' to add a tab in user view
|
||||
// 'group' to add a tab in group view
|
||||
// 'contact' to add a tab in contact view
|
||||
// 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
|
||||
$this->tabs = array();
|
||||
|
||||
// Dictionnaries
|
||||
|
||||
@@ -29,22 +29,29 @@
|
||||
require("../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/categories.lib.php");
|
||||
|
||||
$langs->load("category");
|
||||
$langs->load("categories");
|
||||
$langs->load("bills");
|
||||
|
||||
$mesg = '';
|
||||
$type=$_REQUEST['type'];
|
||||
|
||||
// Security check
|
||||
if (!$user->rights->categorie->lire) accessforbidden();
|
||||
|
||||
if ($_REQUEST['id'] == "")
|
||||
$mesg = '';
|
||||
|
||||
$id=GETPOST('id');
|
||||
$ref=GETPOST('ref');
|
||||
$type=GETPOST('type');
|
||||
$action=GETPOST('action');
|
||||
$confirm=GETPOST('confirm');
|
||||
|
||||
if ($id == "")
|
||||
{
|
||||
dol_print_error('','Missing parameter id');
|
||||
exit();
|
||||
}
|
||||
|
||||
$object = new Categorie($db);
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@@ -52,26 +59,22 @@ if ($_REQUEST['id'] == "")
|
||||
|
||||
if ($_FILES['userfile']['size'] > 0 && $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
if ($_GET["id"])
|
||||
if ($id)
|
||||
{
|
||||
$c = new Categorie($db);
|
||||
$result = $c->fetch($_GET["id"]);
|
||||
$result = $object->fetch($id);
|
||||
|
||||
$result = $c->add_photo($conf->categorie->dir_output, $_FILES['userfile']);
|
||||
$result = $object->add_photo($conf->categorie->dir_output, $_FILES['userfile']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($_REQUEST["action"] == 'confirm_delete' && $_GET["file"] && $_REQUEST['confirm'] == 'yes' && $user->rights->categorie->creer)
|
||||
if ($action == 'confirm_delete' && $_GET["file"] && $confirm == 'yes' && $user->rights->categorie->creer)
|
||||
{
|
||||
$c = new Categorie($db);
|
||||
$c->delete_photo($conf->categorie->dir_output."/".$_GET["file"]);
|
||||
$object->delete_photo($conf->categorie->dir_output."/".$_GET["file"]);
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'addthumb' && $_GET["file"])
|
||||
if ($action == 'addthumb' && $_GET["file"])
|
||||
{
|
||||
$c = new Category($db);
|
||||
$c->add_thumb($conf->categorie->dir_output."/".$_GET["file"]);
|
||||
$object->add_thumb($conf->categorie->dir_output."/".$_GET["file"]);
|
||||
}
|
||||
|
||||
|
||||
@@ -81,48 +84,29 @@ if ($_GET["action"] == 'addthumb' && $_GET["file"])
|
||||
|
||||
llxHeader ("","",$langs->trans("Categories"));
|
||||
|
||||
$c = new Categorie($db);
|
||||
$c->fetch($_REQUEST['id']);
|
||||
|
||||
$html = new Form($db);
|
||||
|
||||
if ($_GET["id"] || $_GET["ref"])
|
||||
if (!empty($id) || !empty($ref))
|
||||
{
|
||||
$c = new Categorie($db);
|
||||
|
||||
if ($_GET["id"]) $result = $c->fetch($_GET["id"]);
|
||||
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/categories/viewcat.php?id='.$c->id.'&type='.$type;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/categories/photos.php?id='.$c->id.'&type='.$type;
|
||||
$head[$h][1] = $langs->trans("Photos");
|
||||
$head[$h][2] = 'photos';
|
||||
$h++;
|
||||
|
||||
$title=$langs->trans("ProductsCategoryShort");
|
||||
if ($type == 0) $title=$langs->trans("ProductsCategoryShort");
|
||||
elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort");
|
||||
elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort");
|
||||
elseif ($type == 3) $title=$langs->trans("MembersCategoryShort");
|
||||
|
||||
$head = categories_prepare_head($object,$type);
|
||||
dol_fiche_head($head, 'photos', $title, 0, 'category');
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression de photo
|
||||
*/
|
||||
if ($_GET['action'] == 'delete')
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$c->id.'&type='.$type.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete', '', 0, 1);
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete', '', 0, 1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
@@ -132,7 +116,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
|
||||
// Path of category
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
$ways = $c->print_all_ways ();
|
||||
$ways = $object->print_all_ways ();
|
||||
print $langs->trans("Ref").'</td><td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
|
||||
foreach ($ways as $way)
|
||||
@@ -144,23 +128,23 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
// Description
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
print $langs->trans("Description").'</td><td>';
|
||||
print nl2br($c->description);
|
||||
print nl2br($object->description);
|
||||
print '</td></tr>';
|
||||
|
||||
// Visibility
|
||||
/* if ($type == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)
|
||||
{
|
||||
if ($c->socid)
|
||||
if ($object->socid)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($c->socid);
|
||||
$soc->fetch($object->socid);
|
||||
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
print $langs->trans("AssignedToTheCustomer").'</td><td>';
|
||||
print $soc->getNomUrl(1);
|
||||
print '</td></tr>';
|
||||
|
||||
$catsMeres = $c->get_meres ();
|
||||
$catsMeres = $object->get_meres ();
|
||||
|
||||
if ($catsMeres < 0)
|
||||
{
|
||||
@@ -170,7 +154,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
{
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
print $langs->trans("CategoryContents").'</td><td>';
|
||||
print ($c->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
|
||||
print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
@@ -178,7 +162,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
{
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
print $langs->trans("CategoryContents").'</td><td>';
|
||||
print ($c->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
|
||||
print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
@@ -186,7 +170,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
{
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
print $langs->trans("CategoryContents").'</td><td>';
|
||||
print ($c->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
|
||||
print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
|
||||
print '</td></tr>';
|
||||
}
|
||||
*/
|
||||
@@ -205,11 +189,11 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
|
||||
print "\n<div class=\"tabsAction\">\n";
|
||||
|
||||
if ($_GET["action"] != 'ajout_photo' && $user->rights->produit->creer)
|
||||
if ($action != 'ajout_photo' && $user->rights->produit->creer)
|
||||
{
|
||||
if (! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/categories/photos.php?action=ajout_photo&id='.$c->id.'&type='.$type.'">';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/categories/photos.php?action=ajout_photo&id='.$object->id.'&type='.$type.'">';
|
||||
print $langs->trans("AddPhoto").'</a>';
|
||||
}
|
||||
else
|
||||
@@ -224,15 +208,15 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
/*
|
||||
* Ajouter une photo
|
||||
*/
|
||||
if ($_GET["action"] == 'ajout_photo' && $user->rights->categorie->creer && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
if ($action == 'ajout_photo' && $user->rights->categorie->creer && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
// Affiche formulaire upload
|
||||
$formfile=new FormFile($db);
|
||||
$formfile->form_attach_new_file(DOL_URL_ROOT.'/categories/photos.php?id='.$c->id.'&type='.$type,$langs->trans("AddPhoto"),1);
|
||||
$formfile->form_attach_new_file(DOL_URL_ROOT.'/categories/photos.php?id='.$object->id.'&type='.$type,$langs->trans("AddPhoto"),1);
|
||||
}
|
||||
|
||||
// Affiche photos
|
||||
if ($_GET["action"] != 'ajout_photo')
|
||||
if ($action != 'ajout_photo')
|
||||
{
|
||||
$nbphoto=0;
|
||||
$nbbyrow=5;
|
||||
@@ -240,13 +224,13 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
$maxWidth = 160;
|
||||
$maxHeight = 120;
|
||||
|
||||
$pdir = get_exdir($c->id,2) . $c->id ."/photos/";
|
||||
$pdir = get_exdir($object->id,2) . $object->id ."/photos/";
|
||||
$dir = $conf->categorie->dir_output.'/'.$pdir;
|
||||
|
||||
print '<br>';
|
||||
print '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
|
||||
|
||||
foreach ($c->liste_photos($dir) as $key => $obj)
|
||||
foreach ($object->liste_photos($dir) as $key => $obj)
|
||||
{
|
||||
$nbphoto++;
|
||||
|
||||
@@ -270,9 +254,9 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
$viewfilename=$obj['photo'];
|
||||
|
||||
// Taille de l'image
|
||||
$c->get_image_size($dir.$filename);
|
||||
$imgWidth = ($c->imgWidth < $maxWidth) ? $c->imgWidth : $maxWidth;
|
||||
$imgHeight = ($c->imgHeight < $maxHeight) ? $c->imgHeight : $maxHeight;
|
||||
$object->get_image_size($dir.$filename);
|
||||
$imgWidth = ($object->imgWidth < $maxWidth) ? $object->imgWidth : $maxWidth;
|
||||
$imgHeight = ($object->imgHeight < $maxHeight) ? $object->imgHeight : $maxHeight;
|
||||
|
||||
print '<img border="0" width="'.$imgWidth.'" height="'.$imgHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=categorie&file='.urlencode($pdir.$filename).'">';
|
||||
|
||||
@@ -281,7 +265,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
print '<br>';
|
||||
|
||||
// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
|
||||
if (!$obj['photo_vignette'] && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i',$obj['photo']) && ($c->imgWidth > $maxWidth || $c->imgHeight > $maxHeight))
|
||||
if (!$obj['photo_vignette'] && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i',$obj['photo']) && ($object->imgWidth > $maxWidth || $object->imgHeight > $maxHeight))
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&action=addthumb&type='.$type.'&file='.urlencode($pdir.$viewfilename).'">'.img_refresh($langs->trans('GenerateThumb')).' </a>';
|
||||
}
|
||||
|
||||
@@ -28,46 +28,51 @@
|
||||
|
||||
require("../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/categories.lib.php");
|
||||
|
||||
// Security check
|
||||
if (! $user->rights->categorie->lire)
|
||||
{
|
||||
accessforbidden();
|
||||
}
|
||||
if (! $user->rights->categorie->lire) accessforbidden();
|
||||
|
||||
$mesg = '';
|
||||
|
||||
if (GETPOST('id') == "")
|
||||
$mesg = '';
|
||||
$id=GETPOST('id');
|
||||
$ref=GETPOST('ref');
|
||||
$type=GETPOST('type');
|
||||
$action=GETPOST('action');
|
||||
$confirm=GETPOST('confirm');
|
||||
|
||||
if ($id == "")
|
||||
{
|
||||
dol_print_error('','Missing parameter id');
|
||||
exit();
|
||||
}
|
||||
|
||||
$c = new Categorie($db);
|
||||
$result=$c->fetch(GETPOST('id'));
|
||||
$object = new Categorie($db);
|
||||
$result=$object->fetch($id);
|
||||
if ($result <= 0)
|
||||
{
|
||||
dol_print_error($db,$c->error);
|
||||
dol_print_error($db,$object->error);
|
||||
exit;
|
||||
}
|
||||
|
||||
$type=$c->type;
|
||||
$type=$object->type;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($user->rights->categorie->supprimer && $_POST["action"] == 'confirm_delete' && $_POST['confirm'] == 'yes')
|
||||
if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confirm == 'yes')
|
||||
{
|
||||
if ($c->delete($user) >= 0)
|
||||
if ($object->delete($user) >= 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/index.php?type='.$type);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$c->error.'</div>';
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,38 +86,24 @@ $html = new Form($db);
|
||||
|
||||
llxHeader ("","",$langs->trans("Categories"));
|
||||
|
||||
|
||||
if ($mesg) print $mesg.'<br>';
|
||||
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/categories/viewcat.php?id='.$c->id.'&type='.$type;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/categories/photos.php?id='.$c->id.'&type='.$type;
|
||||
$head[$h][1] = $langs->trans("Photos");
|
||||
$head[$h][2] = 'photos';
|
||||
$h++;
|
||||
|
||||
if ($type == 0) $title=$langs->trans("ProductsCategoryShort");
|
||||
elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort");
|
||||
elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort");
|
||||
elseif ($type == 3) $title=$langs->trans("MembersCategoryShort");
|
||||
else $title=$langs->trans("Category");
|
||||
|
||||
$head = categories_prepare_head($object,$type);
|
||||
dol_fiche_head($head, 'card', $title, 0, 'category');
|
||||
|
||||
|
||||
/*
|
||||
* Confirmation suppression
|
||||
*/
|
||||
if ($_GET['action'] == 'delete')
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$c->id.'&type='.$type,$langs->trans('DeleteCategory'),$langs->trans('ConfirmDeleteCategory'),'confirm_delete');
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type,$langs->trans('DeleteCategory'),$langs->trans('ConfirmDeleteCategory'),'confirm_delete');
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
@@ -120,7 +111,7 @@ print '<table border="0" width="100%" class="border">';
|
||||
|
||||
// Path of category
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
$ways = $c->print_all_ways ();
|
||||
$ways = $object->print_all_ways ();
|
||||
print $langs->trans("Ref").'</td><td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
|
||||
foreach ($ways as $way)
|
||||
@@ -132,7 +123,7 @@ print '</td></tr>';
|
||||
// Description
|
||||
print '<tr><td width="20%" class="notopnoleft">';
|
||||
print $langs->trans("Description").'</td><td>';
|
||||
print nl2br($c->description);
|
||||
print nl2br($object->description);
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@@ -147,13 +138,13 @@ print "<div class='tabsAction'>\n";
|
||||
|
||||
if ($user->rights->categorie->creer)
|
||||
{
|
||||
$socid = ($c->socid ? "&socid=".$c->socid : "");
|
||||
print "<a class='butAction' href='edit.php?id=".$c->id.$socid."&type=".$type."'>".$langs->trans("Modify")."</a>";
|
||||
$socid = ($object->socid ? "&socid=".$object->socid : "");
|
||||
print "<a class='butAction' href='edit.php?id=".$object->id.$socid."&type=".$type."'>".$langs->trans("Modify")."</a>";
|
||||
}
|
||||
|
||||
if ($user->rights->categorie->supprimer)
|
||||
{
|
||||
print "<a class='butActionDelete' href='".DOL_URL_ROOT."/categories/viewcat.php?action=delete&id=".$c->id."&type=".$type."'>".$langs->trans("Delete")."</a>";
|
||||
print "<a class='butActionDelete' href='".DOL_URL_ROOT."/categories/viewcat.php?action=delete&id=".$object->id."&type=".$type."'>".$langs->trans("Delete")."</a>";
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
@@ -161,7 +152,7 @@ print "</div>";
|
||||
|
||||
|
||||
|
||||
$cats = $c->get_filles();
|
||||
$cats = $object->get_filles();
|
||||
if ($cats < 0)
|
||||
{
|
||||
dol_print_error();
|
||||
@@ -173,7 +164,7 @@ else
|
||||
print "<tr class='liste_titre'><td colspan='2'>".$langs->trans("SubCats").'</td><td align="right">';
|
||||
if ($user->rights->categorie->creer)
|
||||
{
|
||||
print "<a href='".DOL_URL_ROOT."/categories/fiche.php?action=create&catorigin=".$c->id."&socid=".$c->socid."&type=".$type."&urlfrom=".urlencode($_SERVER["PHP_SELF"].'?id='.$c->id.'&type='.$type)."'>";
|
||||
print "<a href='".DOL_URL_ROOT."/categories/fiche.php?action=create&catorigin=".$object->id."&socid=".$object->socid."&type=".$type."&urlfrom=".urlencode($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type)."'>";
|
||||
print img_picto($langs->trans("Create"),'filenew');
|
||||
print "</a>";
|
||||
}
|
||||
@@ -214,10 +205,10 @@ else
|
||||
}
|
||||
|
||||
// List of products
|
||||
if ($c->type == 0)
|
||||
if ($object->type == 0)
|
||||
{
|
||||
|
||||
$prods = $c->get_type("product","Product");
|
||||
$prods = $object->get_type("product","Product");
|
||||
if ($prods < 0)
|
||||
{
|
||||
dol_print_error();
|
||||
@@ -253,9 +244,9 @@ if ($c->type == 0)
|
||||
}
|
||||
}
|
||||
|
||||
if ($c->type == 1)
|
||||
if ($object->type == 1)
|
||||
{
|
||||
$socs = $c->get_type("societe","Fournisseur","fournisseur");
|
||||
$socs = $object->get_type("societe","Fournisseur","fournisseur");
|
||||
if ($socs < 0)
|
||||
{
|
||||
dol_print_error();
|
||||
@@ -291,9 +282,9 @@ if ($c->type == 1)
|
||||
}
|
||||
}
|
||||
|
||||
if($c->type == 2)
|
||||
if($object->type == 2)
|
||||
{
|
||||
$socs = $c->get_type("societe","Societe");
|
||||
$socs = $object->get_type("societe","Societe");
|
||||
if ($socs < 0)
|
||||
{
|
||||
dol_print_error();
|
||||
@@ -329,14 +320,14 @@ if($c->type == 2)
|
||||
}
|
||||
|
||||
// List of members
|
||||
if ($c->type == 3)
|
||||
if ($object->type == 3)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php");
|
||||
|
||||
$prods = $c->get_type("member","Adherent");
|
||||
$prods = $object->get_type("member","Adherent");
|
||||
if ($prods < 0)
|
||||
{
|
||||
dol_print_error($db,$c->error);
|
||||
dol_print_error($db,$object->error);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -45,23 +45,28 @@ $langs->load('bills');
|
||||
$langs->load('orders');
|
||||
$langs->load('products');
|
||||
|
||||
$id=GETPOST('id');
|
||||
$ref=GETPOST('ref');
|
||||
$socid=GETPOST('socid');
|
||||
$action=GETPOST('action');
|
||||
$confirm=GETPOST('confirm');
|
||||
|
||||
$sall=GETPOST("sall");
|
||||
$mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
|
||||
$year=GETPOST("year");
|
||||
$month=GETPOST("month");
|
||||
$socid=GETPOST('socid');
|
||||
|
||||
// Security check
|
||||
$module='propale';
|
||||
if (isset($_GET["socid"]))
|
||||
if (isset($socid))
|
||||
{
|
||||
$objectid=$_GET["socid"];
|
||||
$objectid=$socid;
|
||||
$module='societe';
|
||||
$dbtable='';
|
||||
}
|
||||
else if (isset($_GET["id"]) && $_GET["id"] > 0)
|
||||
else if (isset($id) && $id > 0)
|
||||
{
|
||||
$objectid=$_GET["id"];
|
||||
$objectid=$id;
|
||||
$module='propale';
|
||||
$dbtable='propal';
|
||||
}
|
||||
|
||||
58
htdocs/lib/categories.lib.php
Normal file
58
htdocs/lib/categories.lib.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/lib/categories.lib.php
|
||||
* \brief Ensemble de fonctions de base pour le module categorie
|
||||
* \ingroup categorie
|
||||
* \version $Id$
|
||||
*
|
||||
* Ensemble de fonctions de base de dolibarr sous forme d'include
|
||||
*/
|
||||
|
||||
function categories_prepare_head($object,$type)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
|
||||
$langs->load("categories");
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/categories/viewcat.php?id='.$object->id.'&type='.$type;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/categories/photos.php?id='.$object->id.'&type='.$type;
|
||||
$head[$h][1] = $langs->trans("Photos");
|
||||
$head[$h][2] = 'photos';
|
||||
$h++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'categories_'.$type);
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user