Qual: More robust error code management when a box is renamed.
This commit is contained in:
parent
c0221f6950
commit
75312655f1
@ -294,56 +294,59 @@ if ($resql)
|
||||
}
|
||||
|
||||
dol_include_once($sourcefile);
|
||||
$box=new $boxname($db,$obj->note);
|
||||
|
||||
$enabled=true;
|
||||
if ($box->depends && count($box->depends) > 0)
|
||||
if (class_exists($boxname))
|
||||
{
|
||||
foreach($box->depends as $module)
|
||||
{
|
||||
if (empty($conf->$module->enabled)) $enabled=false;
|
||||
}
|
||||
}
|
||||
$box=new $boxname($db,$obj->note);
|
||||
|
||||
if ($enabled)
|
||||
{
|
||||
//if (in_array($obj->rowid, $actives) && $box->box_multiple <> 1)
|
||||
if (in_array($obj->rowid, $actives))
|
||||
{
|
||||
// La boite est deja activee
|
||||
}
|
||||
else
|
||||
{
|
||||
$var=!$var;
|
||||
$enabled=true;
|
||||
if ($box->depends && count($box->depends) > 0)
|
||||
{
|
||||
foreach($box->depends as $module)
|
||||
{
|
||||
if (empty($conf->$module->enabled)) $enabled=false;
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$box->boximg))
|
||||
{
|
||||
$logo = $box->boximg;
|
||||
}
|
||||
else
|
||||
{
|
||||
$logo=preg_replace("/^object_/i","",$box->boximg);
|
||||
}
|
||||
if ($enabled)
|
||||
{
|
||||
//if (in_array($obj->rowid, $actives) && $box->box_multiple <> 1)
|
||||
if (in_array($obj->rowid, $actives))
|
||||
{
|
||||
// La boite est deja activee
|
||||
}
|
||||
else
|
||||
{
|
||||
$var=!$var;
|
||||
|
||||
print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.img_object("",$logo).' '.$box->boxlabel.'</td>';
|
||||
print '<td>' . ($obj->note?$obj->note:' ') . '</td>';
|
||||
print '<td>' . $sourcefile . '</td>';
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$box->boximg))
|
||||
{
|
||||
$logo = $box->boximg;
|
||||
}
|
||||
else
|
||||
{
|
||||
$logo=preg_replace("/^object_/i","",$box->boximg);
|
||||
}
|
||||
|
||||
// Pour chaque position possible, on affiche un lien
|
||||
// d'activation si boite non deja active pour cette position
|
||||
print '<td>';
|
||||
print $form->selectarray("pos",$pos_name);
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="boxid" value="'.$obj->rowid.'">';
|
||||
print ' <input type="submit" class="button" name="button" value="'.$langs->trans("Activate").'">';
|
||||
print '</td>';
|
||||
print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.img_object("",$logo).' '.$box->boxlabel.'</td>';
|
||||
print '<td>' . ($obj->note?$obj->note:' ') . '</td>';
|
||||
print '<td>' . $sourcefile . '</td>';
|
||||
|
||||
print '</tr></form>';
|
||||
}
|
||||
// Pour chaque position possible, on affiche un lien
|
||||
// d'activation si boite non deja active pour cette position
|
||||
print '<td>';
|
||||
print $form->selectarray("pos",$pos_name);
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="boxid" value="'.$obj->rowid.'">';
|
||||
print ' <input type="submit" class="button" name="button" value="'.$langs->trans("Activate").'">';
|
||||
print '</td>';
|
||||
|
||||
print '</tr></form>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
@ -409,36 +412,39 @@ if ($resql)
|
||||
}
|
||||
|
||||
dol_include_once($sourcefile);
|
||||
$box=new $boxname($db,$obj->note);
|
||||
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$box->boximg))
|
||||
if (class_exists($boxname))
|
||||
{
|
||||
$logo = $box->boximg;
|
||||
}
|
||||
else
|
||||
{
|
||||
$logo=preg_replace("/^object_/i","",$box->boximg);
|
||||
}
|
||||
$box=new $boxname($db,$obj->note);
|
||||
|
||||
print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.img_object("",$logo).' '.$box->boxlabel.'</td>';
|
||||
print '<td>' . ($obj->note?$obj->note:' ') . '</td>';
|
||||
print '<td align="center">' . $pos_name[$obj->position] . '</td>';
|
||||
$hasnext=true;
|
||||
$hasprevious=true;
|
||||
if ($foundrupture) { $hasprevious=false; $foundrupture=0; }
|
||||
if (! $objnext || $obj->position != $objnext->position) { $hasnext=false; $foundrupture=1; }
|
||||
print '<td align="center">'.$box_order.'</td>';
|
||||
print '<td align="center">';
|
||||
print ($hasnext?'<a href="boxes.php?action=switch&switchfrom='.$obj->rowid.'&switchto='.$objnext->rowid.'">'.img_down().'</a> ':'');
|
||||
print ($hasprevious?'<a href="boxes.php?action=switch&switchfrom='.$obj->rowid.'&switchto='.$objprevious->rowid.'">'.img_up().'</a>':'');
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="boxes.php?rowid='.$obj->rowid.'&action=delete">'.img_delete().'</a>';
|
||||
print '</td>';
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$box->boximg))
|
||||
{
|
||||
$logo = $box->boximg;
|
||||
}
|
||||
else
|
||||
{
|
||||
$logo=preg_replace("/^object_/i","",$box->boximg);
|
||||
}
|
||||
|
||||
print '</tr>'."\n";
|
||||
print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.img_object("",$logo).' '.$box->boxlabel.'</td>';
|
||||
print '<td>' . ($obj->note?$obj->note:' ') . '</td>';
|
||||
print '<td align="center">' . $pos_name[$obj->position] . '</td>';
|
||||
$hasnext=true;
|
||||
$hasprevious=true;
|
||||
if ($foundrupture) { $hasprevious=false; $foundrupture=0; }
|
||||
if (! $objnext || $obj->position != $objnext->position) { $hasnext=false; $foundrupture=1; }
|
||||
print '<td align="center">'.$box_order.'</td>';
|
||||
print '<td align="center">';
|
||||
print ($hasnext?'<a href="boxes.php?action=switch&switchfrom='.$obj->rowid.'&switchto='.$objnext->rowid.'">'.img_down().'</a> ':'');
|
||||
print ($hasprevious?'<a href="boxes.php?action=switch&switchfrom='.$obj->rowid.'&switchto='.$objprevious->rowid.'">'.img_up().'</a>':'');
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="boxes.php?rowid='.$obj->rowid.'&action=delete">'.img_delete().'</a>';
|
||||
print '</td>';
|
||||
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
$i++;
|
||||
|
||||
$box_order++;
|
||||
|
||||
@ -54,7 +54,7 @@ function printBoxesArea($user,$areacode)
|
||||
// Define $box_max_lines
|
||||
$box_max_lines=5;
|
||||
if (! empty($conf->global->MAIN_BOXES_MAXLINES)) $box_max_lines=$conf->global->MAIN_BOXES_MAXLINES;
|
||||
|
||||
|
||||
$ii=0;
|
||||
foreach ($boxarray as $key => $box)
|
||||
{
|
||||
@ -214,24 +214,27 @@ class InfoBox
|
||||
$sourcefile = DOL_DOCUMENT_ROOT."/core/boxes/".$boxname.".php";
|
||||
}
|
||||
|
||||
include_once($sourcefile);
|
||||
$box=new $boxname($this->db,$obj->note);
|
||||
|
||||
$box->rowid=$obj->rowid;
|
||||
$box->box_id=$obj->box_id;
|
||||
$box->position=$obj->position;
|
||||
$box->box_order=$obj->box_order;
|
||||
$box->fk_user=$obj->fk_user;
|
||||
$enabled=true;
|
||||
if ($box->depends && count($box->depends) > 0)
|
||||
dol_include_once($sourcefile);
|
||||
if (class_exists($boxname))
|
||||
{
|
||||
foreach($box->depends as $module)
|
||||
{
|
||||
//print $module.'<br>';
|
||||
if (empty($conf->$module->enabled)) $enabled=false;
|
||||
}
|
||||
$box=new $boxname($this->db,$obj->note);
|
||||
|
||||
$box->rowid=$obj->rowid;
|
||||
$box->box_id=$obj->box_id;
|
||||
$box->position=$obj->position;
|
||||
$box->box_order=$obj->box_order;
|
||||
$box->fk_user=$obj->fk_user;
|
||||
$enabled=true;
|
||||
if ($box->depends && count($box->depends) > 0)
|
||||
{
|
||||
foreach($box->depends as $module)
|
||||
{
|
||||
//print $module.'<br>';
|
||||
if (empty($conf->$module->enabled)) $enabled=false;
|
||||
}
|
||||
}
|
||||
if ($enabled) $boxes[]=$box;
|
||||
}
|
||||
if ($enabled) $boxes[]=$box;
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
@ -277,28 +280,31 @@ class InfoBox
|
||||
}
|
||||
|
||||
dol_include_once($sourcefile);
|
||||
$box=new $boxname($this->db,$obj->note);
|
||||
if (class_exists($boxname))
|
||||
{
|
||||
$box=new $boxname($this->db,$obj->note);
|
||||
|
||||
$box->rowid=$obj->rowid;
|
||||
$box->box_id=$obj->box_id;
|
||||
$box->position=$obj->position;
|
||||
$box->box_order=$obj->box_order;
|
||||
if (is_numeric($box->box_order))
|
||||
{
|
||||
if ($box->box_order % 2 == 1) $box->box_order='A'.$box->box_order;
|
||||
elseif ($box->box_order % 2 == 0) $box->box_order='B'.$box->box_order;
|
||||
$box->rowid=$obj->rowid;
|
||||
$box->box_id=$obj->box_id;
|
||||
$box->position=$obj->position;
|
||||
$box->box_order=$obj->box_order;
|
||||
if (is_numeric($box->box_order))
|
||||
{
|
||||
if ($box->box_order % 2 == 1) $box->box_order='A'.$box->box_order;
|
||||
elseif ($box->box_order % 2 == 0) $box->box_order='B'.$box->box_order;
|
||||
}
|
||||
$box->fk_user=$obj->fk_user;
|
||||
$enabled=true;
|
||||
if ($box->depends && count($box->depends) > 0)
|
||||
{
|
||||
foreach($box->depends as $module)
|
||||
{
|
||||
//print $boxname.'-'.$module.'<br>';
|
||||
if (empty($conf->$module->enabled)) $enabled=false;
|
||||
}
|
||||
}
|
||||
if ($enabled) $boxes[]=$box;
|
||||
}
|
||||
$box->fk_user=$obj->fk_user;
|
||||
$enabled=true;
|
||||
if ($box->depends && count($box->depends) > 0)
|
||||
{
|
||||
foreach($box->depends as $module)
|
||||
{
|
||||
//print $boxname.'-'.$module.'<br>';
|
||||
if (empty($conf->$module->enabled)) $enabled=false;
|
||||
}
|
||||
}
|
||||
if ($enabled) $boxes[]=$box;
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
@ -328,7 +334,7 @@ class InfoBox
|
||||
global $conf;
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
|
||||
|
||||
dol_syslog("InfoBoxes::saveboxorder zone=".$zone." user=".$userid);
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/boxes/box_services_vendus.php
|
||||
* \file htdocs/core/boxes/box_services_contracts.php
|
||||
* \ingroup produits,services
|
||||
* \brief Module de generation de l'affichage de la box services_vendus
|
||||
*/
|
||||
@ -29,7 +29,7 @@ include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php");
|
||||
/**
|
||||
* Class to manage the box to show last services lines
|
||||
*/
|
||||
class box_services_vendus extends ModeleBoxes
|
||||
class box_services_contracts extends ModeleBoxes
|
||||
{
|
||||
|
||||
var $boxcode="lastproductsincontract";
|
||||
@ -46,7 +46,7 @@ include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php");
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function box_services_vendus()
|
||||
function box_services_contracts()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("boxes");
|
||||
@ -77,7 +77,7 @@ class modService extends DolibarrModules
|
||||
|
||||
// Boxes
|
||||
$this->boxes = array();
|
||||
$this->boxes[0][1] = "box_services_vendus.php";
|
||||
$this->boxes[0][1] = "box_services_contracts.php";
|
||||
|
||||
// Permissions
|
||||
$this->rights = array();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user