2
0
forked from Wavyzz/dolibarr

Fix: avoid warning with php 5.4 and strict mode

This commit is contained in:
Regis Houssin
2012-07-08 22:43:06 +02:00
parent be04878d4d
commit 320fe741cb
17 changed files with 108 additions and 88 deletions

View File

@@ -287,19 +287,25 @@ class ActionComm extends CommonObject
$this->note = $obj->note;
$this->percentage = $obj->percentage;
$this->author = (object) array();
$this->author->id = $obj->fk_user_author;
$this->author->firstname = $obj->firstname;
$this->author->lastname = $obj->lastname;
$this->usermod = (object) array();
$this->usermod->id = $obj->fk_user_mod;
$this->usertodo = (object) array();
$this->usertodo->id = $obj->fk_user_action;
$this->userdone = (object) array();
$this->userdone->id = $obj->fk_user_done;
$this->priority = $obj->priority;
$this->fulldayevent = $obj->fulldayevent;
$this->location = $obj->location;
$this->socid = $obj->fk_soc; // To have fetch_thirdparty method working
$this->societe = (object) array();
$this->societe->id = $obj->fk_soc;
$this->contact = (object) array();
$this->contact->id = $obj->fk_contact;
$this->fk_project = $obj->fk_project;

View File

@@ -133,12 +133,13 @@ echo $this->control->tpl['ajax_selectcountry'];
<td colspan="3" valign="top"><textarea name="note" cols="70" rows="<?php echo ROWS_3; ?>"><?php echo $this->control->tpl['note']; ?></textarea></td>
</tr>
<?php if (! empty($this->control->tpl['contact_element'])) { ?>
<?php foreach ($this->control->tpl['contact_element'] as $element) { ?>
<tr>
<td><?php echo $element['linked_element_label']; ?></td>
<td colspan="3"><?php echo $element['linked_element_value']; ?></td>
</tr>
<?php } ?>
<?php } } ?>
<tr>
<td><?php echo $langs->trans("DolibarrLogin"); ?></td>

View File

@@ -540,10 +540,11 @@ else
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<input type="hidden" name="contactid" value="'.$object->id.'">';
print '<input type="hidden" name="old_name" value="'.$object->name.'">';
print '<input type="hidden" name="old_firstname" value="'.$object->firstname.'">';
if (! empty($backtopage)) print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<table class="border" width="100%">';
// Ref

View File

@@ -45,15 +45,15 @@ if (! isset($mode) || $mode != 'noajax') // For ajax call
$module=GETPOST("module");
$urlsource=GETPOST("urlsource");
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if ($page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name";
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if ($page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name";
$upload_dir = dirname(str_replace("../","/", $conf->ecm->dir_output.'/'.$file));

View File

@@ -72,7 +72,7 @@ if ($modulepart == 'ecm')
* View
*/
top_httphead();
top_httphead();
$userstatic=new User($db);
$form=new Form($db);

View File

@@ -85,7 +85,7 @@ class box_activity extends ModeleBoxes
if ($result)
{
$num = $db->num_rows($result);
$now=gmmktime();
$now=dol_now();
$i = 0;
while ($i < $num)

View File

@@ -91,7 +91,7 @@ class Form
if ($perm)
{
$tmp=explode(':',$typeofdata);
$ret.= '<div class="editkey_'.$tmp[0].' '.$tmp[1].'" id="'.$htmlname.'">';
$ret.= '<div class="editkey_'.$tmp[0].(! empty($tmp[1]) ? ' '.$tmp[1] : '').'" id="'.$htmlname.'">';
$ret.= $langs->trans($text);
$ret.= '</div>'."\n";
}
@@ -267,7 +267,8 @@ class Form
if (preg_match('/^(string|email|numeric)/',$inputType))
{
$tmp=explode(':',$inputType);
$inputType=$tmp[0]; $inputOption=$tmp[1];
$inputType=$tmp[0];
if (! empty($tmp[1])) $inputOption=$tmp[1];
if (! empty($tmp[2])) $savemethod=$tmp[2];
}
else if (preg_match('/^datepicker/',$inputType))
@@ -2237,8 +2238,8 @@ class Form
{
foreach ($formquestion as $key => $input)
{
array_push($inputok,$input['name']);
if ($input['inputko'] == 1) array_push($inputko,$input['name']);
if (isset($input['name'])) array_push($inputok,$input['name']);
if (isset($input['inputko']) && $input['inputko'] == 1) array_push($inputko,$input['name']);
}
}

View File

@@ -821,12 +821,12 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
// This part of code should not be used.
dol_syslog("Functions.lib::dol_print_date function call with deprecated value of time in page ".$_SERVER["PHP_SELF"], LOG_WARNING);
// Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' or 'YYYYMMDDHHMMSS'
$syear = $reg[1];
$smonth = $reg[2];
$sday = $reg[3];
$shour = $reg[4];
$smin = $reg[5];
$ssec = $reg[6];
$syear = (! empty($reg[1]) ? $reg[1] : '');
$smonth = (! empty($reg[2]) ? $reg[2] : '');
$sday = (! empty($reg[3]) ? $reg[3] : '');
$shour = (! empty($reg[4]) ? $reg[4] : '');
$smin = (! empty($reg[5]) ? $reg[5] : '');
$ssec = (! empty($reg[6]) ? $reg[6] : '');
$time=dol_mktime($shour,$smin,$ssec,$smonth,$sday,$syear,true);
$ret=adodb_strftime($format,$time+$offsettz+$offsetdst,$to_gmt);
@@ -966,7 +966,7 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
else $localtz = new DateTimeZone('UTC');
$dt = new DateTime(null,$localtz);
$dt->setDate($year,$month,$day);
$dt->setTime($hour,$minute,$second);
$dt->setTime((int) $hour, (int) $minute, (int) $second);
$date=$dt->getTimestamp();
}
else
@@ -3852,7 +3852,7 @@ function picto_from_langcode($codelang)
*/
function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode='add')
{
if (is_array($conf->tabs_modules[$type]))
if (isset($conf->tabs_modules[$type]) && is_array($conf->tabs_modules[$type]))
{
foreach ($conf->tabs_modules[$type] as $value)
{

View File

@@ -123,7 +123,7 @@ function product_prepare_head($object, $user)
// More tabs from canvas
if (is_array($object->onglets))
if (isset($object->onglets) && is_array($object->onglets))
{
foreach ($object->onglets as $onglet)
{

View File

@@ -115,10 +115,14 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
if ($dbt_select != 'rowid') $objectid = "'".$objectid."'";
// More features to check
$features = explode("&",$features);
if (! empty($features)) {
$features = explode("&", $features);
}
// More parameters
list($dbtablename, $sharedelement) = explode('&', $dbtablename);
if (! empty($dbtablename)) {
list($dbtablename, $sharedelement) = explode('&', $dbtablename);
}
// Check read permission from module
// TODO Replace "feature" param into caller by first level of permission

View File

@@ -669,7 +669,7 @@ if (! defined('NOREQUIRETRAN'))
}
// Use php template engine
if ($conf->global->MAIN_USE_TEMPLATE_ENGINE && ! defined('NOTEMPLATEENGINE'))
if (! empty($conf->global->MAIN_USE_TEMPLATE_ENGINE) && ! defined('NOTEMPLATEENGINE'))
{
require_once(DOL_DOCUMENT_ROOT.'/includes/savant/Savant3.php');
@@ -893,14 +893,17 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
//print 'themepath='.$themepath.' themeparam='.$themeparam;exit;
print '<link rel="stylesheet" type="text/css" title="default" href="'.$themepath.$themeparam.'">'."\n";
// CSS forced by modules (relative url starting with /)
$dircss=(array) $conf->modules_parts['css'];
foreach($dircss as $key => $cssfile)
if (isset($conf->modules_parts['css']))
{
// cssfile is a relative path
print '<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1);
// We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters, so browser cache is not used.
if (!preg_match('/\.css$/i',$cssfile)) print $themeparam;
print '"><!-- Added by module '.$key. '-->'."\n";
$dircss=(array) $conf->modules_parts['css'];
foreach($dircss as $key => $cssfile)
{
// cssfile is a relative path
print '<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1);
// We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters, so browser cache is not used.
if (!preg_match('/\.css$/i',$cssfile)) print $themeparam;
print '"><!-- Added by module '.$key. '-->'."\n";
}
}
// CSS forced by page in top_htmlhead call (relative url starting with /)
if (is_array($arrayofcss))
@@ -1207,7 +1210,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
print "\n".'<!-- Start top horizontal menu '.$top_menu.' -->'."\n";
if ($conf->use_javascript_ajax && $conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) print '<div class="ui-layout-north"> <!-- Begin top layout -->'."\n";
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print '<div class="ui-layout-north"> <!-- Begin top layout -->'."\n";
print '<div id="tmenu_tooltip" class="tmenu">'."\n";
@@ -1241,7 +1244,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
$loginhtmltext.='<br><b>'.$langs->trans("IPAddress").'</b>: '.$_SERVER["REMOTE_ADDR"];
$loginhtmltext.='<br>';
$loginhtmltext.='<br><u>'.$langs->trans("Connection").'</u>';
if ($conf->global->MAIN_MODULE_MULTICOMPANY) $loginhtmltext.='<br><b>'.$langs->trans("ConnectedOnMultiCompany").'</b>: '.$conf->entity.' (user entity '.$user->entity.')';
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $loginhtmltext.='<br><b>'.$langs->trans("ConnectedOnMultiCompany").'</b>: '.$conf->entity.' (user entity '.$user->entity.')';
$loginhtmltext.='<br><b>'.$langs->trans("ConnectedSince").'</b>: '.dol_print_date($user->datelastlogin,"dayhour");
$loginhtmltext.='<br><b>'.$langs->trans("PreviousConnexion").'</b>: '.dol_print_date($user->datepreviouslogin,"dayhour");
$loginhtmltext.='<br><b>'.$langs->trans("AuthenticationMode").'</b>: '.$_SESSION["dol_authmode"];
@@ -1253,7 +1256,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
if (! empty($_SESSION["disablemodules"])) $loginhtmltext.='<br><b>'.$langs->trans("DisabledModules").'</b>: <br>'.join(', ',explode(',',$_SESSION["disablemodules"]));
$appli='Dolibarr';
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE;
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE;
// Link info
$logouttext='';
@@ -1281,7 +1284,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
print '<div class="login_block">'."\n";
print '<table class="nobordernopadding" summary=""><tr>';
if (! is_object($form)) $form=new Form($db);
$form=new Form($db);
$toprightmenu.=$form->textwithtooltip('',$loginhtmltext,2,1,$logintext,'',1);
@@ -1308,11 +1311,11 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
print '</tr></table>'."\n";
print "</div>\n";
if ($conf->use_javascript_ajax && $conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) print "</div><!-- End top layout -->\n";
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print "</div><!-- End top layout -->\n";
print "<!-- End top horizontal menu -->\n";
if (! $conf->use_javascript_ajax || ! $conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) print '<table width="100%" class="notopnoleftnoright" summary="leftmenutable" id="undertopmenu"><tr>';
if (empty($conf->use_javascript_ajax) || empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print '<table width="100%" class="notopnoleftnoright" summary="leftmenutable" id="undertopmenu"><tr>';
}
@@ -1347,32 +1350,32 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
}
$hookmanager->initHooks(array('searchform','leftblock'));
if ($conf->use_javascript_ajax && $conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) print "\n".'<div class="ui-layout-west"> <!-- Begin left layout -->'."\n";
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print "\n".'<div class="ui-layout-west"> <!-- Begin left layout -->'."\n";
else print '<td class="vmenu" valign="top">';
print "\n";
// Define $searchform
if ($conf->societe->enabled && $conf->global->MAIN_SEARCHFORM_SOCIETE && $user->rights->societe->lire)
if (! empty($conf->societe->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_SOCIETE) && $user->rights->societe->lire)
{
$langs->load("companies");
$searchform.=printSearchForm(DOL_URL_ROOT.'/societe/societe.php', DOL_URL_ROOT.'/societe/societe.php', img_object('','company').' '.$langs->trans("ThirdParties"), 'soc', 'socname');
}
if ($conf->societe->enabled && $conf->global->MAIN_SEARCHFORM_CONTACT && $user->rights->societe->lire)
if (! empty($conf->societe->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_CONTACT) && $user->rights->societe->lire)
{
$langs->load("companies");
$searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', img_object('','contact').' '.$langs->trans("Contacts"), 'contact', 'contactname');
}
if ((($conf->product->enabled && $user->rights->produit->lire) || ($conf->service->enabled && $user->rights->service->lire))
&& $conf->global->MAIN_SEARCHFORM_PRODUITSERVICE)
if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire))
&& ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE))
{
$langs->load("products");
$searchform.=printSearchForm(DOL_URL_ROOT.'/product/liste.php', DOL_URL_ROOT.'/product/liste.php', img_object('','product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall');
}
if ($conf->adherent->enabled && $conf->global->MAIN_SEARCHFORM_ADHERENT && $user->rights->adherent->lire)
if (! empty($conf->adherent->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_ADHERENT) && $user->rights->adherent->lire)
{
$langs->load("members");
$searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/liste.php', DOL_URL_ROOT.'/adherents/liste.php', img_object('','user').' '.$langs->trans("Members"), 'member', 'sall');
@@ -1504,7 +1507,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
$leftblock=$hookmanager->executeHooks('printLeftBlock',$parameters); // Note that $action and $object may have been modified by some hooks
print $leftblock;
if ($conf->use_javascript_ajax && $conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) print '</div> <!-- End left layout -->'."\n";
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print '</div> <!-- End left layout -->'."\n";
else print '</td>';
print "\n";
@@ -1527,7 +1530,7 @@ function main_area($title='')
{
global $conf, $langs;
if ($conf->use_javascript_ajax && $conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT))
{
print '<div id="mainContent"><div class="ui-layout-center"> <!-- begin main layout -->'."\n";
print '<table width="100%" class="notopnoleftnoright" summary="centermenutable" id="undertopmenu"><tr>';

View File

@@ -2423,6 +2423,7 @@ class Product extends CommonObject
while ($i < $num)
{
$row = $this->db->fetch_object($result);
$this->stock_warehouse[$row->fk_entrepot] = (object) array();
$this->stock_warehouse[$row->fk_entrepot]->real = $row->reel;
$this->stock_warehouse[$row->fk_entrepot]->pmp = $row->pmp;
$this->stock_reel+=$row->reel;

View File

@@ -66,7 +66,7 @@ class Service extends CommonObject
$sql = "SELECT count(p.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= ' WHERE p.entity IN ('.getEntity($this->element, 1).')';
$sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')';
$sql.= " AND p.fk_product_type = 1";
$resql=$this->db->query($sql);

View File

@@ -668,7 +668,7 @@ $helpurl='';
if (GETPOST("type") == '0') $helpurl='EN:Module_Products|FR:Module_Produits|ES:M&oacute;dulo_Productos';
if (GETPOST("type") == '1') $helpurl='EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
llxHeader('',$langs->trans("CardProduct".$_GET["type"]),$helpurl);
llxHeader('',$langs->trans("CardProduct".GETPOST("type")),$helpurl);
$form = new Form($db);
$formproduct = new FormProduct($db);
@@ -1047,7 +1047,7 @@ else
dol_fiche_head($head, 'card', $titre, 0, $picto);
$showphoto=$object->is_photo_available($conf->product->multidir_output[$object->entity]);
$showbarcode=$conf->barcode->enabled && $user->rights->barcode->lire;
$showbarcode=(! empty($conf->barcode->enabled) && $user->rights->barcode->lire);
// En mode visu
print '<table class="border" width="100%"><tr>';
@@ -1137,13 +1137,13 @@ else
}
// Accountancy sell code
print '<tr><td>'.$form->editfieldkey("ProductAccountancySellCode",'accountancy_code_sell',$object->accountancy_code_sell,$object,$user->rights->produit->creer||$user->rights->service->creer).'</td><td colspan="2">';
print $form->editfieldval("ProductAccountancySellCode",'accountancy_code_sell',$object->accountancy_code_sell,$object,$user->rights->produit->creer||$user->rights->service->creer);
print '<tr><td>'.$form->editfieldkey("ProductAccountancySellCode",'accountancy_code_sell',$object->accountancy_code_sell,$object,$user->rights->produit->creer||$user->rights->service->creer,'string').'</td><td colspan="2">';
print $form->editfieldval("ProductAccountancySellCode",'accountancy_code_sell',$object->accountancy_code_sell,$object,$user->rights->produit->creer||$user->rights->service->creer,'string');
print '</td></tr>';
// Accountancy buy code
print '<tr><td>'.$form->editfieldkey("ProductAccountancyBuyCode",'accountancy_code_buy',$object->accountancy_code_buy,$object,$user->rights->produit->creer||$user->rights->service->creer).'</td><td colspan="2">';
print $form->editfieldval("ProductAccountancyBuyCode",'accountancy_code_buy',$object->accountancy_code_buy,$object,$user->rights->produit->creer||$user->rights->service->creer);
print '<tr><td>'.$form->editfieldkey("ProductAccountancyBuyCode",'accountancy_code_buy',$object->accountancy_code_buy,$object,$user->rights->produit->creer||$user->rights->service->creer,'string').'</td><td colspan="2">';
print $form->editfieldval("ProductAccountancyBuyCode",'accountancy_code_buy',$object->accountancy_code_buy,$object,$user->rights->produit->creer||$user->rights->service->creer,'string');
print '</td></tr>';
// Status (to sell)
@@ -1179,7 +1179,7 @@ else
{
$dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year"));
}
print $langs->trans($dur[$object->duration_unit])."&nbsp;";
print (! empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')."&nbsp;";
print '</td></tr>';
}
@@ -1302,11 +1302,11 @@ if ($action == '' || $action == 'view')
{
if ($user->rights->produit->creer || $user->rights->service->creer)
{
if ($object->no_button_edit <> 1) print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&amp;id='.$object->id.'">'.$langs->trans("Modify").'</a>';
if (isset($object->no_button_edit) && $object->no_button_edit <> 1) print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&amp;id='.$object->id.'">'.$langs->trans("Modify").'</a>';
if ($object->no_button_copy <> 1)
if (isset($object->no_button_copy) && $object->no_button_copy <> 1)
{
if ($conf->use_javascript_ajax)
if (! empty($conf->use_javascript_ajax))
{
print '<span id="action-clone" class="butAction">'.$langs->trans('ToClone').'</span>'."\n";
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneProduct'),$langs->trans('ConfirmCloneProduct',$object->ref),'confirm_clone',$formquestionclone,'yes','action-clone',230,600);
@@ -1322,9 +1322,9 @@ if ($action == '' || $action == 'view')
if (($object->type == 0 && $user->rights->produit->supprimer)
|| ($object->type == 1 && $user->rights->service->supprimer))
{
if (! $object_is_used && $object->no_button_delete <> 1)
if (! $object_is_used && isset($object->no_button_delete) && $object->no_button_delete <> 1)
{
if ($conf->use_javascript_ajax)
if (! empty($conf->use_javascript_ajax))
{
print '<span id="action-delete" class="butActionDelete">'.$langs->trans('Delete').'</span>'."\n";
print $form->formconfirm("fiche.php?id=".$object->id,$langs->trans("DeleteProduct"),$langs->trans("ConfirmDeleteProduct"),"confirm_delete",'',0,"action-delete");
@@ -1357,7 +1357,7 @@ if ($id && ($action == '' || $action == 'view') && $object->status)
print '<table width="100%" class="noborder">';
// Propals
if($conf->propal->enabled && $user->rights->propale->creer)
if (! empty($conf->propal->enabled) && $user->rights->propale->creer)
{
$propal = new Propal($db);
@@ -1413,7 +1413,7 @@ if ($id && ($action == '' || $action == 'view') && $object->status)
print '<td><input type="hidden" name="propalid" value="'.$objp->propalid.'">';
print '<input type="text" class="flat" name="qty" size="1" value="1"></td><td nowrap>'.$langs->trans("ReductionShort");
print '<input type="text" class="flat" name="remise_percent" size="1" value="0">%';
print " ".$object->stock_proposition;
if (isset($object->stock_proposition)) print " ".$object->stock_proposition;
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
print '</td>';
@@ -1474,7 +1474,7 @@ if ($id && ($action == '' || $action == 'view') && $object->status)
}
// Commande
if($conf->commande->enabled && $user->rights->commande->creer)
if (! empty($conf->commande->enabled) && $user->rights->commande->creer)
{
$commande = new Commande($db);
@@ -1530,7 +1530,7 @@ if ($id && ($action == '' || $action == 'view') && $object->status)
print '<td><input type="hidden" name="commandeid" value="'.$objc->commandeid.'">';
print '<input type="text" class="flat" name="qty" size="1" value="1"></td><td nowrap>'.$langs->trans("ReductionShort");
print '<input type="text" class="flat" name="remise_percent" size="1" value="0">%';
print " ".$object->stock_proposition;
if (isset($object->stock_proposition)) print " ".$object->stock_proposition;
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
print '</td>';
@@ -1592,7 +1592,7 @@ if ($id && ($action == '' || $action == 'view') && $object->status)
}
// Factures
if ($conf->facture->enabled && $user->rights->facture->creer)
if (! empty($conf->facture->enabled) && $user->rights->facture->creer)
{
print '<tr class="liste_titre"><td width="50%" class="liste_titre">';
print $langs->trans("AddToMyBills").'</td>';
@@ -1743,6 +1743,6 @@ if ($id && ($action == '' || $action == 'view') && $object->status)
}
$db->close();
llxFooter();
$db->close();
?>

View File

@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.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
@@ -74,7 +74,7 @@ print '<tr><td valign="top" width="30%" class="notopnoleft">';
* Zone recherche produit/service
*/
$rowspan=2;
if ($conf->barcode->enabled) $rowspan++;
if (! empty($conf->barcode->enabled)) $rowspan++;
print '<form method="post" action="'.DOL_URL_ROOT.'/product/liste.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder" width="100%">';
@@ -83,7 +83,7 @@ print '<td colspan="3">'.$langs->trans("Search").'</td></tr>';
print "<tr $bc[0]><td>";
print $langs->trans("Ref").':</td><td><input class="flat" type="text" size="14" name="sref"></td>';
print '<td rowspan="'.$rowspan.'"><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
if ($conf->barcode->enabled)
if (! empty($conf->barcode->enabled))
{
print "<tr $bc[0]><td>";
print $langs->trans("BarCode").':</td><td><input class="flat" type="text" size="14" name="sbarcode"></td>';

View File

@@ -86,7 +86,7 @@ class Address
if ($result >= 0)
{
$now=dol_now();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_address (label, fk_soc, name, datec, fk_user_creat) ";
$sql .= " VALUES ('".$this->db->escape($this->label)."', '".$socid."', '".$this->db->escape($this->name)."', ".$this->db->idate($now).", '".$user->id."')";
@@ -188,7 +188,7 @@ class Address
if ($result >= 0)
{
dol_syslog(get_class($this)."::Update verify ok");
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."societe_address";
@@ -203,7 +203,7 @@ class Address
$sql.= ", fax = ".($this->fax?"'".$this->db->escape($this->fax)."'":"null");
if ($user) $sql .= ",fk_user_modif = '".$user->id."'";
$sql .= " WHERE fk_soc = '" . $socid ."' AND rowid = '" . $id ."'";
dol_syslog(get_class($this)."::Update sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
@@ -216,7 +216,7 @@ class Address
{
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
$this->error=$langs->trans("ErrorDuplicateField",$this->name);
$result=-1;
}
@@ -302,7 +302,7 @@ class Address
$line->phone = $objp->tel;
$line->fax = $objp->fax;
$line->note = $objp->note;
// deprecated
$line->cp = $line->zip;
$line->ville = $line->town;
@@ -381,14 +381,14 @@ class Address
$this->phone = $obj->tel;
$this->fax = $obj->fax;
$this->note = $obj->note;
// deprecated
$line->cp = $line->zip;
$line->ville = $line->town;
$line->pays_id = $line->country_id;
$line->pays_code = $line->country_code;
$line->pays = $line->country;
$line->tel = $line->phone;
$this->cp = $this->zip;
$this->ville = $this->town;
$this->pays_id = $this->country_id;
$this->pays_code = $this->country_code;
$this->pays = $this->country;
$this->tel = $this->phone;
$result = 1;
}
@@ -435,7 +435,7 @@ class Address
print $this->db->error() . '<br>' . $sql;
}
}
/**
* Return name of address with link (and eventually picto)
* Use $this->id, $this->label, $this->socid
@@ -447,12 +447,12 @@ class Address
function getNomUrl($withpicto=0,$option='')
{
global $langs;
$result='';
$lien = '<a href="'.DOL_URL_ROOT.'/comm/address.php?id='.$this->id.'&socid='.$this->socid.'">';
$lienfin='</a>';
if ($withpicto) $result.=($lien.img_object($langs->trans("ShowAddress").': '.$this->label,'address').$lienfin.' ');
$result.=$lien.$this->label.$lienfin;
return $result;

View File

@@ -578,8 +578,11 @@ class User extends CommonObject
if ($perms)
{
if (! is_object($this->rights)) $this->rights = (object) array(); // For avoid error
if (! is_object($this->rights->$module)) $this->rights->$module = (object) array();
if ($subperms)
{
if (! is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = (object) array();
$this->rights->$module->$perms->$subperms = 1;
}
else