Fix: Miscellaneous fixes

This commit is contained in:
Laurent Destailleur
2013-11-16 12:00:08 +01:00
parent c5230ea2ff
commit 5b243abe4b
6 changed files with 29 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
@@ -389,7 +389,7 @@ if ($id > 0)
print '<td>'; print '<td>';
print $form->editfieldkey("OutstandingBill",'OutstandingBill',$object->outstanding_limit,$object,$user->rights->societe->creer); print $form->editfieldkey("OutstandingBill",'OutstandingBill',$object->outstanding_limit,$object,$user->rights->societe->creer);
print '</td><td colspan="3">'; print '</td><td colspan="3">';
print price($form->editfieldval("OutstandingBill",'OutstandingBill',$object->outstanding_limit,$object,$user->rights->societe->creer)); print $form->editfieldval("OutstandingBill",'OutstandingBill',$object->outstanding_limit,$object,$user->rights->societe->creer,'amount',price($object->outstanding_limit));
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }

View File

@@ -2312,19 +2312,22 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
} }
if ($soc->outstanding_limit) // TODO This is nt a roperty of invoice so should not appears here but as a warning on thirdparty
/*
if ($soc->outstanding_limit)
{ {
$outstandigBills=$soc->get_OutstandingBill(); $outstandigBills=$soc->get_OutstandingBill();
// Outstanding Bill // Outstanding Bill
print '<tr><td>'; print '<tr><td>';
print $langs->trans('OutstandingBill'); print $langs->trans('OutstandingBill');
print '</td><td align=right>'; print '</td><td align="right" colspan="2">';
print price($outstandigBills); print price($outstandigBills);
if ($outstandigBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached")); if ($outstandigBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached"));
print ' / '.price($soc->outstanding_limit); print ' / '.price($soc->outstanding_limit);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
*/
// Other attributes // Other attributes
$parameters=array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"'); $parameters=array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"');
@@ -3042,7 +3045,7 @@ else if ($id > 0 || ! empty($ref))
$nbrows=8; $nbcols=2; $nbrows=8; $nbcols=2;
if (! empty($conf->projet->enabled)) $nbrows++; if (! empty($conf->projet->enabled)) $nbrows++;
if (! empty($conf->banque->enabled)) $nbcols++; if (! empty($conf->banque->enabled)) $nbcols++;
if (! empty($soc->outstandingbill)) $nbrows++; //if (! empty($soc->outstandingbill)) $nbrows++;
if($mysoc->localtax1_assuj=="1") $nbrows++; if($mysoc->localtax1_assuj=="1") $nbrows++;
if($mysoc->localtax2_assuj=="1") $nbrows++; if($mysoc->localtax2_assuj=="1") $nbrows++;
if ($selleruserevenustamp) $nbrows++; if ($selleruserevenustamp) $nbrows++;
@@ -3314,18 +3317,23 @@ else if ($id > 0 || ! empty($ref))
} }
print '</td></tr>'; print '</td></tr>';
// TODO This is nt a roperty of invoice so should not appears here but as a warning on thirdparty
/*
if ($soc->outstandingbill) if ($soc->outstandingbill)
{ {
$outstandingBills=$soc->get_OutstandingBill();
// Outstanding Bill // Outstanding Bill
print '<tr><td>'; print '<tr><td>';
print $langs->trans('OutstandingBill'); print $langs->trans('OutstandingBill');
print '</td><td align=right>'; print '</td><td align="right">';
print price($soc->get_OutstandingBill()).' / '; print price($outstandingBills);
print price($soc->outstandingbill); if ($outstandigBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached"));
print ' / '.price($soc->outstandingbill);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
*/
// Amount // Amount
print '<tr><td>'.$langs->trans('AmountHT').'</td>'; print '<tr><td>'.$langs->trans('AmountHT').'</td>';
print '<td align="right" colspan="3" nowrap>'.price($object->total_ht,1,'',1,-1,-1,$conf->currency).'</td></tr>'; print '<td align="right" colspan="3" nowrap>'.price($object->total_ht,1,'',1,-1,-1,$conf->currency).'</td></tr>';

View File

@@ -121,8 +121,8 @@ class Form
* @param string $value Value to show/edit * @param string $value Value to show/edit
* @param object $object Object * @param object $object Object
* @param boolean $perm Permission to allow button to edit parameter * @param boolean $perm Permission to allow button to edit parameter
* @param string $typeofdata Type of data ('string' by default, 'email', 'numeric:99', 'text' or 'textarea:rows:cols', 'day' or 'datepicker', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select:xxx'...) * @param string $typeofdata Type of data ('string' by default, 'amount', 'email', 'numeric:99', 'text' or 'textarea:rows:cols', 'day' or 'datepicker', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select:xxx'...)
* @param string $editvalue When in edit mode, use this value as $value instead of value * @param string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formated price instead of value)
* @param object $extObject External object * @param object $extObject External object
* @param string $success Success message * @param string $success Success message
* @param string $moreparam More param to add on a href URL * @param string $moreparam More param to add on a href URL
@@ -134,6 +134,9 @@ class Form
$ret=''; $ret='';
// Check parameters
if (empty($typeofdata)) return 'ErrorBadParameter';
// When option to edit inline is activated // When option to edit inline is activated
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && ! preg_match('/^select;|datehourpicker/',$typeofdata)) // FIXME add jquery timepicker if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && ! preg_match('/^select;|datehourpicker/',$typeofdata)) // FIXME add jquery timepicker
{ {
@@ -150,7 +153,7 @@ class Form
$ret.='<input type="hidden" name="id" value="'.$object->id.'">'; $ret.='<input type="hidden" name="id" value="'.$object->id.'">';
$ret.='<table class="nobordernopadding" cellpadding="0" cellspacing="0">'; $ret.='<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
$ret.='<tr><td>'; $ret.='<tr><td>';
if (preg_match('/^(string|email|numeric)/',$typeofdata)) if (preg_match('/^(string|email|numeric|amount)/',$typeofdata))
{ {
$tmp=explode(':',$typeofdata); $tmp=explode(':',$typeofdata);
$ret.='<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue?$editvalue:$value).'"'.($tmp[1]?' size="'.$tmp[1].'"':'').'>'; $ret.='<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue?$editvalue:$value).'"'.($tmp[1]?' size="'.$tmp[1].'"':'').'>';
@@ -193,6 +196,7 @@ class Form
else else
{ {
if ($typeofdata == 'email') $ret.=dol_print_email($value,0,0,0,0,1); if ($typeofdata == 'email') $ret.=dol_print_email($value,0,0,0,0,1);
elseif ($typeofdata == 'amount') $ret.=price($value,'',$langs);
elseif (preg_match('/^text/',$typeofdata) || preg_match('/^note/',$typeofdata)) $ret.=dol_htmlentitiesbr($value); elseif (preg_match('/^text/',$typeofdata) || preg_match('/^note/',$typeofdata)) $ret.=dol_htmlentitiesbr($value);
elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') $ret.=dol_print_date($value,'day'); elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') $ret.=dol_print_date($value,'day');
elseif ($typeofdata == 'datehourpicker') $ret.=dol_print_date($value,'dayhour'); elseif ($typeofdata == 'datehourpicker') $ret.=dol_print_date($value,'dayhour');

View File

@@ -210,7 +210,8 @@ class DoliDBPgsql extends DoliDB
// tinyint type conversion // tinyint type conversion
$line=preg_replace('/tinyint\(?[0-9]*\)?/','smallint',$line); $line=preg_replace('/tinyint\(?[0-9]*\)?/','smallint',$line);
$line=preg_replace('/tinyint/i','smallint',$line);
// nuke unsigned // nuke unsigned
$line=preg_replace('/(int\w+|smallint)\s+unsigned/i','\\1',$line); $line=preg_replace('/(int\w+|smallint)\s+unsigned/i','\\1',$line);
@@ -875,7 +876,7 @@ class DoliDBPgsql extends DoliDB
42701=> 'DB_ERROR_COLUMN_ALREADY_EXISTS', 42701=> 'DB_ERROR_COLUMN_ALREADY_EXISTS',
'42710' => 'DB_ERROR_KEY_NAME_ALREADY_EXISTS', '42710' => 'DB_ERROR_KEY_NAME_ALREADY_EXISTS',
'23505' => 'DB_ERROR_RECORD_ALREADY_EXISTS', '23505' => 'DB_ERROR_RECORD_ALREADY_EXISTS',
'42704' => 'DB_ERROR_NO_INDEX_TO_DROP', '42704' => 'DB_ERROR_NO_INDEX_TO_DROP', // May also be Type xxx does not exists
'42601' => 'DB_ERROR_SYNTAX', '42601' => 'DB_ERROR_SYNTAX',
'42P16' => 'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS', '42P16' => 'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS',
1075 => 'DB_ERROR_CANT_DROP_PRIMARY_KEY', 1075 => 'DB_ERROR_CANT_DROP_PRIMARY_KEY',

View File

@@ -359,5 +359,5 @@ ALTER TABLE llx_societe ADD skype VARCHAR(255) AFTER email;
ALTER TABLE llx_adherent ADD skype VARCHAR(255) AFTER email; ALTER TABLE llx_adherent ADD skype VARCHAR(255) AFTER email;
-- multi-rib -- multi-rib
ALTER TABLE llx_societe_rib ADD default_rib TINYINT NOT NULL DEFAULT 0 AFTER owner_address; ALTER TABLE llx_societe_rib ADD default_rib smallint NOT NULL DEFAULT 0 AFTER owner_address;
UPDATE llx_societe_rib SET default_rib = 1; UPDATE llx_societe_rib SET default_rib = 1;

View File

@@ -36,7 +36,7 @@ create table llx_societe_rib
domiciliation varchar(255), domiciliation varchar(255),
proprio varchar(60), proprio varchar(60),
owner_address varchar(255), owner_address varchar(255),
default_rib tinyint NOT NULL DEFAULT 0, default_rib smallint NOT NULL DEFAULT 0,
import_key varchar(14) -- import key import_key varchar(14) -- import key