Fix: Boxes not visibles if first activation

This commit is contained in:
Laurent Destailleur 2009-10-29 01:12:53 +00:00
parent d1e70fcd67
commit 80a876886e
6 changed files with 53 additions and 33 deletions

View File

@ -29,10 +29,9 @@
/** /**
\class InfoBox * \class InfoBox
\brief Classe permettant la gestion des boxes sur une page * \brief Classe permettant la gestion des boxes sur une page
*/ */
class InfoBox class InfoBox
{ {
var $db; var $db;
@ -136,6 +135,11 @@ class InfoBox
$box->box_id=$obj->box_id; $box->box_id=$obj->box_id;
$box->position=$obj->position; $box->position=$obj->position;
$box->box_order=$obj->box_order; $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; $box->fk_user=$obj->fk_user;
$enabled=true; $enabled=true;
if ($box->depends && sizeof($box->depends) > 0) if ($box->depends && sizeof($box->depends) > 0)
@ -171,7 +175,7 @@ class InfoBox
function saveboxorder($zone,$boxorder,$userid=0) function saveboxorder($zone,$boxorder,$userid=0)
{ {
global $conf; global $conf;
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
dol_syslog("InfoBoxes::saveboxorder zone=".$zone." user=".$userid); dol_syslog("InfoBoxes::saveboxorder zone=".$zone." user=".$userid);
@ -192,8 +196,8 @@ class InfoBox
return -3; return -3;
} }
$sql = "DELETE ".MAIN_DB_PREFIX."boxes"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes";
$sql.= " FROM ".MAIN_DB_PREFIX."boxes, ".MAIN_DB_PREFIX."boxes_def"; $sql.= " USING ".MAIN_DB_PREFIX."boxes, ".MAIN_DB_PREFIX."boxes_def";
$sql.= " WHERE ".MAIN_DB_PREFIX."boxes.box_id = ".MAIN_DB_PREFIX."boxes_def.rowid"; $sql.= " WHERE ".MAIN_DB_PREFIX."boxes.box_id = ".MAIN_DB_PREFIX."boxes_def.rowid";
$sql.= " AND ".MAIN_DB_PREFIX."boxes_def.entity = ".$conf->entity; $sql.= " AND ".MAIN_DB_PREFIX."boxes_def.entity = ".$conf->entity;
$sql.= " AND ".MAIN_DB_PREFIX."boxes.fk_user = ".$userid; $sql.= " AND ".MAIN_DB_PREFIX."boxes.fk_user = ".$userid;
@ -253,8 +257,9 @@ class InfoBox
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->lasterror();
$this->db->rollback(); $this->db->rollback();
dol_syslog("InfoBox::saveboxorder ".$this->error);
return -1; return -1;
} }
} }

View File

@ -21,10 +21,9 @@
/** /**
* \file htdocs/includes/boxes/box_comptes.php * \file htdocs/includes/boxes/box_comptes.php
* \ingroup banque * \ingroup banque
* \brief Module de generation de l'affichage de la box comptes * \brief Module to generate box for bank accounts
* \version $Id$ * \version $Id$
*/ */
include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php"); include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php");
include_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); include_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php");
@ -121,9 +120,9 @@ class box_comptes extends ModeleBoxes {
} }
// Total // Total
if (sizeof($listofcurrencies) < 1) if (sizeof($listofcurrencies) <= 1)
{ {
$this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'align="right" colspan="3" class="liste_total"', $this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'align="right" class="liste_total"',
'text' => $langs->trans('Total') 'text' => $langs->trans('Total')
); );
$totalamount=price($solde_total).' '.$langs->trans("Currency".$conf->monnaie); $totalamount=price($solde_total).' '.$langs->trans("Currency".$conf->monnaie);

View File

@ -101,9 +101,9 @@ class ModeleBoxes
$MAXLENGTHBOX=60; // Mettre 0 pour pas de limite $MAXLENGTHBOX=60; // Mettre 0 pour pas de limite
$bcx[0] = 'class="box_pair"'; $bcx[0] = 'class="box_pair"';
$bcx[1] = 'class="box_impair"'; $bcx[1] = 'class="box_impair"';
$var = true; $var = false;
dol_syslog("modules_box::showBox ".get_Class($this)); dol_syslog("ModeleBoxes::showBox ".get_Class($this));
// Define nbcol and nblines of the box to show // Define nbcol and nblines of the box to show
$nbcol=0; $nbcol=0;

View File

@ -585,7 +585,7 @@ if (sizeof($boxarray))
$ii=0; $ii=0;
foreach ($boxarray as $key => $box) foreach ($boxarray as $key => $box)
{ {
if (preg_match('/^A/i',$box->box_order)) // colonne A if (preg_match('/^A/i',$box->box_order)) // column A
{ {
$ii++; $ii++;
//print 'box_id '.$boxarray[$ii]->box_id.' '; //print 'box_id '.$boxarray[$ii]->box_id.' ';

View File

@ -234,9 +234,20 @@ class DoliDb
$line.= "CREATE ".(preg_match('/UNIQUE/',$reg[2])?'UNIQUE ':'')."INDEX ".$idxname." ON ".$tablename." (".$fieldlist.")"; $line.= "CREATE ".(preg_match('/UNIQUE/',$reg[2])?'UNIQUE ':'')."INDEX ".$idxname." ON ".$tablename." (".$fieldlist.")";
} }
// Delete using criteria on other table must not declare twice the deleted table
// DELETE FROM tabletodelete USING tabletodelete, othertable -> DELETE FROM tabletodelete USING othertable
if (preg_match('/DELETE FROM ([a-z_]+) USING ([a-z_]+), ([a-z_]+)/i',$line,$reg))
{
if ($reg[1] == $reg[2]) // If same table, we remove second one
{
$line=preg_replace('/DELETE FROM ([a-z_]+) USING ([a-z_]+), ([a-z_]+)/i','DELETE FROM \\1 USING \\3', $line);
}
}
// Remove () in the tables in FROM // Remove () in the tables in FROM
//$line=preg_replace('/FROM\s*\((([a-z_]+)\s+as\s+([a-z_]+)\s*,\s*([a-z_]+)\s+as\s+([a-z_]+)\s*)\)/i','FROM \\1',$line); //$line=preg_replace('/FROM\s*\((([a-z_]+)\s+as\s+([a-z_]+)\s*,\s*([a-z_]+)\s+as\s+([a-z_]+)\s*)\)/i','FROM \\1',$line);
//print $line; //print $line;
} # END of if ($create_sql ne "") i.e. were inside create table statement so processed datatypes } # END of if ($create_sql ne "") i.e. were inside create table statement so processed datatypes
else { # not inside create table else { # not inside create table
#---- fix data in inserted data: (from MS world) #---- fix data in inserted data: (from MS world)

View File

@ -757,16 +757,16 @@ border-left: 1px solid #000000;
table.noborder { table.noborder {
border-collapse: collapse; border-collapse: collapse;
border-top-color: #FEFEFE; border-top-color: #FEFEFE;
/*
border-right-width: 1px; border-right-width: 1px;
border-right-color: #BBBBBB; border-right-color: #BBBBBB;
border-right-style: solid; border-right-style: solid;
*/
border-bottom-width: 1px; border-bottom-width: 1px;
border-bottom-color: #BBBBBB; border-bottom-color: #BBBBBB;
border-bottom-style: solid; border-bottom-style: solid;
} }
/*
table.noborder tr { table.noborder tr {
border-top-color: #FEFEFE; border-top-color: #FEFEFE;
@ -777,12 +777,13 @@ border-right-style: solid;
border-left-width: 1px; border-left-width: 1px;
border-left-color: #BBBBBB; border-left-color: #BBBBBB;
border-left-style: solid; border-left-style: solid;
/*
border-bottom-width: 1px; border-bottom-width: 1px;
border-bottom-color: #BBBBBB; border-bottom-color: #BBBBBB;
border-bottom-style: solid; border-bottom-style: solid;
}
*/ */
}
table.noborder td { table.noborder td {
border: 0px; border: 0px;
padding: 1px 2px; padding: 1px 2px;
@ -864,9 +865,22 @@ border-bottom: 1px solid #FFFFFF;
white-space: nowrap; white-space: nowrap;
} }
.impair {
/* background: #d0d4d7; */
background: #eaeaea;
font-family: helvetica, verdana, arial, sans-serif;
border: 0px;
}
/*
.impair:hover {
background: #c0c4c7;
border: 0px;
}
*/
.pair { .pair {
background: #e6ebed; /* background: #e6ebed; */
background: #fafafa;
font-family: helvetica, verdana, arial, sans-serif; font-family: helvetica, verdana, arial, sans-serif;
border: 0px; border: 0px;
} }
@ -877,17 +891,6 @@ border: 0px;
} }
*/ */
.impair {
background: #d0d4d7;
font-family: helvetica, verdana, arial, sans-serif;
border: 0px;
}
/*
.impair:hover {
background: #c0c4c7;
border: 0px;
}
*/
/* /*
* Boxes * Boxes
@ -910,12 +913,14 @@ white-space: nowrap;
} }
tr.box_impair { tr.box_impair {
background: #e6ebed; /* background: #e6ebed; */
background: #eaeaea;
font-family: arial, helvetica, verdana, sans-serif; font-family: arial, helvetica, verdana, sans-serif;
} }
tr.box_pair { tr.box_pair {
background: #d0d4d7; /* background: #d0d4d7; */
background: #fafafa;
font-family: arial, helvetica, verdana, sans-serif; font-family: arial, helvetica, verdana, sans-serif;
} }