Fix order of product templates
This commit is contained in:
parent
bc61123efe
commit
8dc1ac2cdc
5 changed files with 48 additions and 35 deletions
|
|
@ -264,7 +264,7 @@ print ' <td>'.$langs->trans("Name").'</td>';
|
|||
print ' <td>'.$langs->trans("Description").'</td>';
|
||||
print ' <td>'.$langs->trans("Example").'</td>';
|
||||
print ' <td class="center" width="80">'.$langs->trans("Status").'</td>';
|
||||
print ' <td class="center" width="60">'.$langs->trans("ShortInfo").'</td>';
|
||||
print ' <td class="center" width="60"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$arrayofmodules = array();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* Copyright (C) 2013-2017 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2020 Maxime DEMAREST <maxime@indelog.fr>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.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
|
||||
|
|
@ -30,8 +30,6 @@
|
|||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
|
|
@ -39,6 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
|||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'compta', 'accountancy'));
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ class mod_codeproduct_elephant extends ModeleProductCode
|
|||
public $name = 'Elephant';
|
||||
public $version = 'dolibarr';
|
||||
|
||||
public $position = 50;
|
||||
|
||||
// variables not inherited
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -44,6 +44,9 @@ class mod_codeproduct_leopard extends ModeleProductCode
|
|||
public $name = 'Leopard';
|
||||
public $version = 'dolibarr';
|
||||
|
||||
public $position = 10;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -324,9 +324,11 @@ print ' <td>'.$langs->trans("Name").'</td>';
|
|||
print ' <td>'.$langs->trans("Description").'</td>';
|
||||
print ' <td>'.$langs->trans("Example").'</td>';
|
||||
print ' <td class="center" width="80">'.$langs->trans("Status").'</td>';
|
||||
print ' <td class="center"></td>';
|
||||
print ' <td class="center" width="60"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$arrayofmodules = array();
|
||||
|
||||
foreach ($dirproduct as $dirroot) {
|
||||
$dir = dol_buildpath($dirroot, 0);
|
||||
|
||||
|
|
@ -354,41 +356,48 @@ foreach ($dirproduct as $dirroot) {
|
|||
continue;
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td width="140">'.$modCodeProduct->name.'</td>'."\n";
|
||||
print '<td>'.$modCodeProduct->info($langs).'</td>'."\n";
|
||||
print '<td class="nowrap"><span class="opacitymedium">'.$modCodeProduct->getExample($langs).'</span></td>'."\n";
|
||||
|
||||
if (getDolGlobalString('PRODUCT_CODEPRODUCT_ADDON') == $file) {
|
||||
print '<td class="center">'."\n";
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print "</td>\n";
|
||||
} else {
|
||||
$disabled = false;
|
||||
// if (!(isModEnabled('multicompany') && ((is_object($mc) && !empty($mc->sharings['referent'])) && ($mc->sharings['referent'] == $conf->entity)))) {
|
||||
// }
|
||||
print '<td class="center">';
|
||||
if (!$disabled) {
|
||||
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setcodeproduct&token='.newToken().'&value='.urlencode($file).'">';
|
||||
}
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
if (!$disabled) {
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td class="center">';
|
||||
$s = $modCodeProduct->getToolTip($langs, '', -1);
|
||||
print $form->textwithpicto('', $s, 1);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
$arrayofmodules[$file] = $modCodeProduct;
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
|
||||
$arrayofmodules = dol_sort_array($arrayofmodules, 'position');
|
||||
'@phan-var-force array<string,ModeleProductCode> $arrayofmodules';
|
||||
|
||||
foreach ($arrayofmodules as $file => $modCodeProduct) {
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td width="140">'.$modCodeProduct->name.'</td>'."\n";
|
||||
print '<td>'.$modCodeProduct->info($langs).'</td>'."\n";
|
||||
print '<td class="nowrap"><span class="opacitymedium">'.$modCodeProduct->getExample($langs).'</span></td>'."\n";
|
||||
|
||||
if (getDolGlobalString('PRODUCT_CODEPRODUCT_ADDON') == $file) {
|
||||
print '<td class="center">'."\n";
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print "</td>\n";
|
||||
} else {
|
||||
$disabled = false;
|
||||
// if (!(isModEnabled('multicompany') && ((is_object($mc) && !empty($mc->sharings['referent'])) && ($mc->sharings['referent'] == $conf->entity)))) {
|
||||
// }
|
||||
print '<td class="center">';
|
||||
if (!$disabled) {
|
||||
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setcodeproduct&token='.newToken().'&value='.urlencode($file).'">';
|
||||
}
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
if (!$disabled) {
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td class="center">';
|
||||
$s = $modCodeProduct->getToolTip($langs, '', -1);
|
||||
print $form->textwithpicto('', $s, 1);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue