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->note = $obj->note;
$this->percentage = $obj->percentage; $this->percentage = $obj->percentage;
$this->author = (object) array();
$this->author->id = $obj->fk_user_author; $this->author->id = $obj->fk_user_author;
$this->author->firstname = $obj->firstname; $this->author->firstname = $obj->firstname;
$this->author->lastname = $obj->lastname; $this->author->lastname = $obj->lastname;
$this->usermod = (object) array();
$this->usermod->id = $obj->fk_user_mod; $this->usermod->id = $obj->fk_user_mod;
$this->usertodo = (object) array();
$this->usertodo->id = $obj->fk_user_action; $this->usertodo->id = $obj->fk_user_action;
$this->userdone = (object) array();
$this->userdone->id = $obj->fk_user_done; $this->userdone->id = $obj->fk_user_done;
$this->priority = $obj->priority; $this->priority = $obj->priority;
$this->fulldayevent = $obj->fulldayevent; $this->fulldayevent = $obj->fulldayevent;
$this->location = $obj->location; $this->location = $obj->location;
$this->socid = $obj->fk_soc; // To have fetch_thirdparty method working $this->socid = $obj->fk_soc; // To have fetch_thirdparty method working
$this->societe = (object) array();
$this->societe->id = $obj->fk_soc; $this->societe->id = $obj->fk_soc;
$this->contact = (object) array();
$this->contact->id = $obj->fk_contact; $this->contact->id = $obj->fk_contact;
$this->fk_project = $obj->fk_project; $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> <td colspan="3" valign="top"><textarea name="note" cols="70" rows="<?php echo ROWS_3; ?>"><?php echo $this->control->tpl['note']; ?></textarea></td>
</tr> </tr>
<?php if (! empty($this->control->tpl['contact_element'])) { ?>
<?php foreach ($this->control->tpl['contact_element'] as $element) { ?> <?php foreach ($this->control->tpl['contact_element'] as $element) { ?>
<tr> <tr>
<td><?php echo $element['linked_element_label']; ?></td> <td><?php echo $element['linked_element_label']; ?></td>
<td colspan="3"><?php echo $element['linked_element_value']; ?></td> <td colspan="3"><?php echo $element['linked_element_value']; ?></td>
</tr> </tr>
<?php } ?> <?php } } ?>
<tr> <tr>
<td><?php echo $langs->trans("DolibarrLogin"); ?></td> <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="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="id" value="'.$id.'">'; print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="action" value="update">'; 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="contactid" value="'.$object->id.'">';
print '<input type="hidden" name="old_name" value="'.$object->name.'">'; print '<input type="hidden" name="old_name" value="'.$object->name.'">';
print '<input type="hidden" name="old_firstname" value="'.$object->firstname.'">'; 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%">'; print '<table class="border" width="100%">';
// Ref // Ref

View File

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

View File

@ -91,7 +91,7 @@ class Form
if ($perm) if ($perm)
{ {
$tmp=explode(':',$typeofdata); $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.= $langs->trans($text);
$ret.= '</div>'."\n"; $ret.= '</div>'."\n";
} }
@ -267,7 +267,8 @@ class Form
if (preg_match('/^(string|email|numeric)/',$inputType)) if (preg_match('/^(string|email|numeric)/',$inputType))
{ {
$tmp=explode(':',$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]; if (! empty($tmp[2])) $savemethod=$tmp[2];
} }
else if (preg_match('/^datepicker/',$inputType)) else if (preg_match('/^datepicker/',$inputType))
@ -2237,8 +2238,8 @@ class Form
{ {
foreach ($formquestion as $key => $input) foreach ($formquestion as $key => $input)
{ {
array_push($inputok,$input['name']); if (isset($input['name'])) array_push($inputok,$input['name']);
if ($input['inputko'] == 1) array_push($inputko,$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. // 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); 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' // Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' or 'YYYYMMDDHHMMSS'
$syear = $reg[1]; $syear = (! empty($reg[1]) ? $reg[1] : '');
$smonth = $reg[2]; $smonth = (! empty($reg[2]) ? $reg[2] : '');
$sday = $reg[3]; $sday = (! empty($reg[3]) ? $reg[3] : '');
$shour = $reg[4]; $shour = (! empty($reg[4]) ? $reg[4] : '');
$smin = $reg[5]; $smin = (! empty($reg[5]) ? $reg[5] : '');
$ssec = $reg[6]; $ssec = (! empty($reg[6]) ? $reg[6] : '');
$time=dol_mktime($shour,$smin,$ssec,$smonth,$sday,$syear,true); $time=dol_mktime($shour,$smin,$ssec,$smonth,$sday,$syear,true);
$ret=adodb_strftime($format,$time+$offsettz+$offsetdst,$to_gmt); $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'); else $localtz = new DateTimeZone('UTC');
$dt = new DateTime(null,$localtz); $dt = new DateTime(null,$localtz);
$dt->setDate($year,$month,$day); $dt->setDate($year,$month,$day);
$dt->setTime($hour,$minute,$second); $dt->setTime((int) $hour, (int) $minute, (int) $second);
$date=$dt->getTimestamp(); $date=$dt->getTimestamp();
} }
else else
@ -3852,7 +3852,7 @@ function picto_from_langcode($codelang)
*/ */
function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode='add') 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) foreach ($conf->tabs_modules[$type] as $value)
{ {

View File

@ -123,7 +123,7 @@ function product_prepare_head($object, $user)
// More tabs from canvas // More tabs from canvas
if (is_array($object->onglets)) if (isset($object->onglets) && is_array($object->onglets))
{ {
foreach ($object->onglets as $onglet) 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."'"; if ($dbt_select != 'rowid') $objectid = "'".$objectid."'";
// More features to check // More features to check
$features = explode("&",$features); if (! empty($features)) {
$features = explode("&", $features);
}
// More parameters // More parameters
list($dbtablename, $sharedelement) = explode('&', $dbtablename); if (! empty($dbtablename)) {
list($dbtablename, $sharedelement) = explode('&', $dbtablename);
}
// Check read permission from module // Check read permission from module
// TODO Replace "feature" param into caller by first level of permission // TODO Replace "feature" param into caller by first level of permission

View File

@ -669,7 +669,7 @@ if (! defined('NOREQUIRETRAN'))
} }
// Use php template engine // 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'); 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 'themepath='.$themepath.' themeparam='.$themeparam;exit;
print '<link rel="stylesheet" type="text/css" title="default" href="'.$themepath.$themeparam.'">'."\n"; print '<link rel="stylesheet" type="text/css" title="default" href="'.$themepath.$themeparam.'">'."\n";
// CSS forced by modules (relative url starting with /) // CSS forced by modules (relative url starting with /)
$dircss=(array) $conf->modules_parts['css']; if (isset($conf->modules_parts['css']))
foreach($dircss as $key => $cssfile)
{ {
// cssfile is a relative path $dircss=(array) $conf->modules_parts['css'];
print '<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1); foreach($dircss as $key => $cssfile)
// 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; // cssfile is a relative path
print '"><!-- Added by module '.$key. '-->'."\n"; 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 /) // CSS forced by page in top_htmlhead call (relative url starting with /)
if (is_array($arrayofcss)) 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"; 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"; 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><b>'.$langs->trans("IPAddress").'</b>: '.$_SERVER["REMOTE_ADDR"];
$loginhtmltext.='<br>'; $loginhtmltext.='<br>';
$loginhtmltext.='<br><u>'.$langs->trans("Connection").'</u>'; $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("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("PreviousConnexion").'</b>: '.dol_print_date($user->datepreviouslogin,"dayhour");
$loginhtmltext.='<br><b>'.$langs->trans("AuthenticationMode").'</b>: '.$_SESSION["dol_authmode"]; $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"])); if (! empty($_SESSION["disablemodules"])) $loginhtmltext.='<br><b>'.$langs->trans("DisabledModules").'</b>: <br>'.join(', ',explode(',',$_SESSION["disablemodules"]));
$appli='Dolibarr'; $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 // Link info
$logouttext=''; $logouttext='';
@ -1281,7 +1284,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
print '<div class="login_block">'."\n"; print '<div class="login_block">'."\n";
print '<table class="nobordernopadding" summary=""><tr>'; 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); $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 '</tr></table>'."\n";
print "</div>\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"; 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')); $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">'; else print '<td class="vmenu" valign="top">';
print "\n"; print "\n";
// Define $searchform // 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"); $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'); $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"); $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'); $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)) if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire))
&& $conf->global->MAIN_SEARCHFORM_PRODUITSERVICE) && ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE))
{ {
$langs->load("products"); $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'); $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"); $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'); $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 $leftblock=$hookmanager->executeHooks('printLeftBlock',$parameters); // Note that $action and $object may have been modified by some hooks
print $leftblock; 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>'; else print '</td>';
print "\n"; print "\n";
@ -1527,7 +1530,7 @@ function main_area($title='')
{ {
global $conf, $langs; 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 '<div id="mainContent"><div class="ui-layout-center"> <!-- begin main layout -->'."\n";
print '<table width="100%" class="notopnoleftnoright" summary="centermenutable" id="undertopmenu"><tr>'; print '<table width="100%" class="notopnoleftnoright" summary="centermenutable" id="undertopmenu"><tr>';

View File

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

View File

@ -66,7 +66,7 @@ class Service extends CommonObject
$sql = "SELECT count(p.rowid) as nb"; $sql = "SELECT count(p.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $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"; $sql.= " AND p.fk_product_type = 1";
$resql=$this->db->query($sql); $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") == '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'; 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); $form = new Form($db);
$formproduct = new FormProduct($db); $formproduct = new FormProduct($db);
@ -1047,7 +1047,7 @@ else
dol_fiche_head($head, 'card', $titre, 0, $picto); dol_fiche_head($head, 'card', $titre, 0, $picto);
$showphoto=$object->is_photo_available($conf->product->multidir_output[$object->entity]); $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 // En mode visu
print '<table class="border" width="100%"><tr>'; print '<table class="border" width="100%"><tr>';
@ -1137,13 +1137,13 @@ else
} }
// Accountancy sell code // 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 '<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); print $form->editfieldval("ProductAccountancySellCode",'accountancy_code_sell',$object->accountancy_code_sell,$object,$user->rights->produit->creer||$user->rights->service->creer,'string');
print '</td></tr>'; print '</td></tr>';
// Accountancy buy code // 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 '<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); print $form->editfieldval("ProductAccountancyBuyCode",'accountancy_code_buy',$object->accountancy_code_buy,$object,$user->rights->produit->creer||$user->rights->service->creer,'string');
print '</td></tr>'; print '</td></tr>';
// Status (to sell) // 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")); $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>'; print '</td></tr>';
} }
@ -1302,11 +1302,11 @@ if ($action == '' || $action == 'view')
{ {
if ($user->rights->produit->creer || $user->rights->service->creer) 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 '<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); 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) if (($object->type == 0 && $user->rights->produit->supprimer)
|| ($object->type == 1 && $user->rights->service->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 '<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"); 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">'; print '<table width="100%" class="noborder">';
// Propals // Propals
if($conf->propal->enabled && $user->rights->propale->creer) if (! empty($conf->propal->enabled) && $user->rights->propale->creer)
{ {
$propal = new Propal($db); $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 '<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="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 '<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 '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">'; print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
print '</td>'; print '</td>';
@ -1474,7 +1474,7 @@ if ($id && ($action == '' || $action == 'view') && $object->status)
} }
// Commande // Commande
if($conf->commande->enabled && $user->rights->commande->creer) if (! empty($conf->commande->enabled) && $user->rights->commande->creer)
{ {
$commande = new Commande($db); $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 '<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="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 '<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 '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">'; print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
print '</td>'; print '</td>';
@ -1592,7 +1592,7 @@ if ($id && ($action == '' || $action == 'view') && $object->status)
} }
// Factures // 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 '<tr class="liste_titre"><td width="50%" class="liste_titre">';
print $langs->trans("AddToMyBills").'</td>'; print $langs->trans("AddToMyBills").'</td>';
@ -1743,6 +1743,6 @@ if ($id && ($action == '' || $action == 'view') && $object->status)
} }
$db->close();
llxFooter(); llxFooter();
$db->close();
?> ?>

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * 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 * 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 * 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 * Zone recherche produit/service
*/ */
$rowspan=2; $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 '<form method="post" action="'.DOL_URL_ROOT.'/product/liste.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder" width="100%">'; 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 "<tr $bc[0]><td>";
print $langs->trans("Ref").':</td><td><input class="flat" type="text" size="14" name="sref"></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>'; 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 "<tr $bc[0]><td>";
print $langs->trans("BarCode").':</td><td><input class="flat" type="text" size="14" name="sbarcode"></td>'; print $langs->trans("BarCode").':</td><td><input class="flat" type="text" size="14" name="sbarcode"></td>';

View File

@ -383,12 +383,12 @@ class Address
$this->note = $obj->note; $this->note = $obj->note;
// deprecated // deprecated
$line->cp = $line->zip; $this->cp = $this->zip;
$line->ville = $line->town; $this->ville = $this->town;
$line->pays_id = $line->country_id; $this->pays_id = $this->country_id;
$line->pays_code = $line->country_code; $this->pays_code = $this->country_code;
$line->pays = $line->country; $this->pays = $this->country;
$line->tel = $line->phone; $this->tel = $this->phone;
$result = 1; $result = 1;
} }

View File

@ -578,8 +578,11 @@ class User extends CommonObject
if ($perms) 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 ($subperms)
{ {
if (! is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = (object) array();
$this->rights->$module->$perms->$subperms = 1; $this->rights->$module->$perms->$subperms = 1;
} }
else else