Skip to content

Commit

Permalink
Fix when limit = 0
Browse files Browse the repository at this point in the history
Look and feel v11
  • Loading branch information
eldy committed Nov 14, 2019
1 parent 7566783 commit 52787b5
Show file tree
Hide file tree
Showing 7 changed files with 150 additions and 72 deletions.
6 changes: 3 additions & 3 deletions htdocs/admin/mails.php
Expand Up @@ -111,6 +111,8 @@
* View
*/

$form = new Form($db);

$linuxlike=1;
if (preg_match('/^win/i', PHP_OS)) $linuxlike=0;
if (preg_match('/^mac/i', PHP_OS)) $linuxlike=0;
Expand Down Expand Up @@ -139,8 +141,6 @@

if ($action == 'edit')
{
$form=new Form($db);

if ($conf->use_javascript_ajax)
{
print "\n".'<script type="text/javascript" language="javascript">';
Expand Down Expand Up @@ -251,7 +251,7 @@ function initfields()

dol_fiche_head($head, 'common', '', -1);

print $langs->trans("EMailsDesc")."<br>\n";
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
print "<br>\n";


Expand Down
6 changes: 3 additions & 3 deletions htdocs/admin/mails_emailing.php
Expand Up @@ -94,6 +94,8 @@
* View
*/

$form = new Form($db);

$linuxlike=1;
if (preg_match('/^win/i', PHP_OS)) $linuxlike=0;
if (preg_match('/^mac/i', PHP_OS)) $linuxlike=0;
Expand Down Expand Up @@ -123,8 +125,6 @@

if ($action == 'edit')
{
$form=new Form($db);

if ($conf->use_javascript_ajax)
{
print "\n".'<script type="text/javascript" language="javascript">';
Expand Down Expand Up @@ -219,7 +219,7 @@ function initfields()

dol_fiche_head($head, 'common_emailing', '', -1);

print $langs->trans("EMailsDesc")."<br>\n";
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
print "<br>\n";


Expand Down
191 changes: 134 additions & 57 deletions htdocs/admin/mails_senderprofile_list.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion htdocs/core/lib/admin.lib.php
Expand Up @@ -1818,7 +1818,7 @@ function email_admin_prepare_head()
$head[$h][2] = 'templates';
$h++;

if ($conf->global->MAIN_FEATURES_LEVEL >= 1 && ! empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates'))
if ($conf->global->MAIN_FEATURES_LEVEL >= 0 && ! empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates'))
{
$head[$h][0] = DOL_URL_ROOT."/admin/mails_senderprofile_list.php";
$head[$h][1] = $langs->trans("EmailSenderProfiles");
Expand Down
6 changes: 3 additions & 3 deletions htdocs/core/lib/functions.lib.php
Expand Up @@ -4275,7 +4275,9 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '',
}
}

print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtmlright, $savlimit, $totalnboflines, $hideselectlimit); // output the div and ul for previous/last completed with page numbers into $pagelist
if ($savlimit) {
print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtmlright, $savlimit, $totalnboflines, $hideselectlimit); // output the div and ul for previous/last completed with page numbers into $pagelist
}

print '</td>';

Expand Down Expand Up @@ -4317,7 +4319,6 @@ function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $be
$tmpkey = $conf->liste_limit.':'.$conf->liste_limit;
if (!in_array($tmpkey, $tmpchoice)) $tmpchoice[] = $tmpkey;
asort($tmpchoice, SORT_NUMERIC);
$found = false;
foreach ($tmpchoice as $val)
{
$selected = '';
Expand All @@ -4329,7 +4330,6 @@ function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $be
if ((int) $key == (int) $limit)
{
$selected = ' selected="selected"';
$found = true;
}
print '<option name="'.$key.'"'.$selected.'>'.dol_escape_htmltag($val).'</option>'."\n";
}
Expand Down
1 change: 1 addition & 0 deletions htdocs/langs/en_US/admin.lang
Expand Up @@ -268,6 +268,7 @@ Emails=Emails
EMailsSetup=Emails setup
EMailsDesc=This page allows you to override your default PHP parameters for email sending. In most cases on Unix/Linux OS, the PHP setup is correct and these parameters are unnecessary.
EmailSenderProfiles=Emails sender profiles
EMailsSenderProfileDesc=You can keep this section empty. If you enter some emails here, they will be added to the list of possible senders into the combobox when your write a new email.
MAIN_MAIL_SMTP_PORT=SMTP/SMTPS Port (default value in php.ini: <b>%s</b>)
MAIN_MAIL_SMTP_SERVER=SMTP/SMTPS Host (default value in php.ini: <b>%s</b>)
MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike=SMTP/SMTPS Port (Not defined into PHP on Unix-like systems)
Expand Down
10 changes: 5 additions & 5 deletions htdocs/modulebuilder/template/myobject_list.php
Expand Up @@ -137,14 +137,14 @@
foreach($object->fields as $key => $val)
{
// If $val['visible']==0, then we never show the field
if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']);
if (!empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']);
}
// Extra fields
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
{
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{
if (! empty($extrafields->attributes[$object->table_element]['list'][$key])) {
if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) {
$arrayfields["ef.".$key] = array(
'label'=>$extrafields->attributes[$object->table_element]['label'][$key],
'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1),
Expand Down Expand Up @@ -282,13 +282,13 @@
}
}
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit)))
{
$num = $nbtotalofrecords;
}
else
{
$sql .= $db->plimit($limit + 1, $offset);
if ($limit) $sql .= $db->plimit($limit + 1, $offset);

$resql = $db->query($sql);
if (!$resql)
Expand Down Expand Up @@ -481,7 +481,7 @@ function init_myfunc()
// --------------------------------------------------------------------
$i = 0;
$totalarray = array();
while ($i < min($num, $limit))
while ($i < ($limit ? min($num, $limit) : $num))
{
$obj = $db->fetch_object($resql);
if (empty($obj)) break; // Should not happen
Expand Down

0 comments on commit 52787b5

Please sign in to comment.