Skip to content

Commit

Permalink
Evarisk#3637 [Hook] fix: remove hook category now in saturne
Browse files Browse the repository at this point in the history
  • Loading branch information
evarisk-micka committed Dec 13, 2023
1 parent db14868 commit 8a7a352
Showing 1 changed file with 0 additions and 92 deletions.
92 changes: 0 additions & 92 deletions class/actions_digiriskdolibarr.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -511,98 +511,6 @@ public function printCommonFooter($parameters)
}
} elseif (preg_match('/categoryindex/', $parameters['context'])) { // do something only for the context 'somecontext1' or 'somecontext2'
print '<script src="../custom/digiriskdolibarr/js/digiriskdolibarr.js"></script>';
} elseif (preg_match('/categorycard/', $parameters['context']) && preg_match('/viewcat.php/', $_SERVER["PHP_SELF"])) {
global $user;
$id = GETPOST('id');
$type = GETPOST('type');

// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) {
$page = 0;
} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;

if ($type == 'accident' || $type == 'preventionplan' || $type == 'firepermit') {
require_once __DIR__ . '/' . $type . '.class.php';

$classname = ucfirst($type);
$object = new $classname($this->db);

$arrayObjects = $object->fetchAll();
if (is_array($arrayObjects) && !empty($arrayObjects)) {
foreach ($arrayObjects as $objectsingle) {
$array[$objectsingle->id] = $objectsingle->ref;
}
}

$category = new Categorie($this->db);
$category->fetch($id);
$objectsInCateg = $category->getObjectsInCateg($type, 0, $limit, $offset);

$out = '<br>';

$out .= '<form method="post" action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '&type=' . $type . '">';
$out .= '<input type="hidden" name="token" value="'.newToken().'">';
$out .= '<input type="hidden" name="action" value="addintocategory">';

$out .= '<table class="noborder centpercent">';
$out .= '<tr class="liste_titre"><td>';
$out .= $langs->trans("Add". ucfirst($type) . "IntoCategory") . ' ';
$out .= $form->selectarray('element_id', $array, '', 1);
$out .= '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
$out .= '</tr>';
$out .= '</table>';
$out .= '</form>';

$out .= '<br>';

//$param = '&limit=' . $limit . '&id=' . $id . '&type=' . $type;
//$num = count($objectsInCateg);
//print_barre_liste($langs->trans(ucfirst($type)), $page, $_SERVER["PHP_SELF"], $param, '', '', '', $num, '', 'object_'.$type.'@digiquali', 0, '', '', $limit);

$out .= load_fiche_titre($langs->transnoentities($classname), '', 'object_' . $object->picto);
$out .= '<table class="noborder centpercent">';
$out .= '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Ref").'</td></tr>';

if (is_array($objectsInCateg) && !empty($objectsInCateg)) {
// Form to add record into a category
if (count($objectsInCateg) > 0) {
$i = 0;
foreach ($objectsInCateg as $element) {
$i++;
if ($i > $limit) break;

$out .= '<tr class="oddeven">';
$out .= '<td class="nowrap" valign="top">';
$out .= $element->getNomUrl(1);
$out .= '</td>';
// Link to delete from category
$out .= '<td class="right">';
if ($user->rights->categorie->creer) {
$out .= '<a href="' . $_SERVER["PHP_SELF"] . '?action=delintocategory&id=' . $id . '&type=' . $type . '&element_id=' . $element->id . '&token=' . newToken() . '">';
$out .= $langs->trans("DeleteFromCat");
$out .= img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft');
$out .= '</a>';
}
$out .= '</td>';
$out .= '</tr>';
}
} else {
$out .= '<tr class="oddeven"><td colspan="2" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</td></tr>';
}
}

$out .= '</table>';
} ?>

<script>
jQuery('.fichecenter').last().after(<?php echo json_encode($out) ; ?>)
</script>
<?php
}

if (true) {
Expand Down

0 comments on commit 8a7a352

Please sign in to comment.