Clean code

This commit is contained in:
Laurent Destailleur
2018-10-01 00:20:47 +02:00
parent f32ccf935a
commit adc36e7d63
5 changed files with 50 additions and 39 deletions

View File

@@ -1253,12 +1253,14 @@ class Facture extends CommonInvoice
if ($addlinktonotes) if ($addlinktonotes)
{ {
$txttoshow=($user->societe_id>0?$this->note_public:$this->note_private); $txttoshow=($user->socid > 0 ? $this->note_public : $this->note_private);
if ($txttoshow) if ($txttoshow)
{ {
$notetoshow=$langs->trans("ViewPrivateNote").':<br>'.dol_string_nohtmltag($txttoshow,1); $notetoshow=$langs->trans("ViewPrivateNote").':<br>'.dol_string_nohtmltag($txttoshow,1);
$result.=' <span class="note inline-block">'; $result.=' <span class="note inline-block">';
$result.='<a href="'.DOL_URL_ROOT.'/compta/facture/note.php?id='.$this->id.'" class="classfortooltip" title="'.dol_escape_htmltag($notetoshow).'">'.img_picto('','object_generic').'</a>'; $result.='<a href="'.DOL_URL_ROOT.'/compta/facture/note.php?id='.$this->id.'" class="classfortooltip" title="'.dol_escape_htmltag($notetoshow).'">';
$result.=img_picto('','note');
$result.='</a>';
//$result.=img_picto($langs->trans("ViewNote"),'object_generic'); //$result.=img_picto($langs->trans("ViewNote"),'object_generic');
//$result.='</a>'; //$result.='</a>';
$result.='</span>'; $result.='</span>';

View File

@@ -914,6 +914,7 @@ if ($resql)
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$datelimit=$db->jdate($obj->datelimite); $datelimit=$db->jdate($obj->datelimite);
$facturestatic->id=$obj->id; $facturestatic->id=$obj->id;
$facturestatic->ref=$obj->ref; $facturestatic->ref=$obj->ref;
$facturestatic->type=$obj->type; $facturestatic->type=$obj->type;
@@ -957,12 +958,10 @@ if ($resql)
print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding nowrap">'; print '<td class="nobordernopadding nowraponall">';
print $facturestatic->getNomUrl(1,'',200,0,'',0,1); print $facturestatic->getNomUrl(1,'',200,0,'',0,1);
print empty($obj->increment)?'':' ('.$obj->increment.')'; print empty($obj->increment)?'':' ('.$obj->increment.')';
print '</td>';
print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
$filename=dol_sanitizeFileName($obj->ref); $filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->ref); $filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->id; $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->id;

View File

@@ -622,7 +622,7 @@ while ($i < min($num,$limit))
if (!empty($obj->note_private) || !empty($obj->note_public)) if (!empty($obj->note_private) || !empty($obj->note_public))
{ {
print ' <span class="note">'; print ' <span class="note">';
print '<a href="'.DOL_URL_ROOT.'/contrat/note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'</a>'; print '<a href="'.DOL_URL_ROOT.'/contrat/note.php?id='.$obj->rowid.'&save_lastsearch_values=1">'.img_picto($langs->trans("ViewPrivateNote"),'note').'</a>';
print '</span>'; print '</span>';
} }

View File

@@ -923,41 +923,41 @@ function num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $ha
* This replace old function monthArrayOrSelected. * This replace old function monthArrayOrSelected.
* *
* @param Translate $outputlangs Object langs * @param Translate $outputlangs Object langs
* @param int $short 1=Return short label * @param int $short 0=Return long label, 1=Return short label
* @return array Month string or array if selected < 0 * @return array Month string or array if selected < 0
*/ */
function monthArray($outputlangs,$short=0) function monthArray($outputlangs,$short=0)
{ {
$montharray = array ( $montharray = array (
1 => $outputlangs->trans("January"), 1 => $outputlangs->trans("Month01"),
2 => $outputlangs->trans("February"), 2 => $outputlangs->trans("Month02"),
3 => $outputlangs->trans("March"), 3 => $outputlangs->trans("Month03"),
4 => $outputlangs->trans("April"), 4 => $outputlangs->trans("Month04"),
5 => $outputlangs->trans("May"), 5 => $outputlangs->trans("Month05"),
6 => $outputlangs->trans("June"), 6 => $outputlangs->trans("Month06"),
7 => $outputlangs->trans("July"), 7 => $outputlangs->trans("Month07"),
8 => $outputlangs->trans("August"), 8 => $outputlangs->trans("Month08"),
9 => $outputlangs->trans("September"), 9 => $outputlangs->trans("Month09"),
10 => $outputlangs->trans("October"), 10 => $outputlangs->trans("Month10"),
11 => $outputlangs->trans("November"), 11 => $outputlangs->trans("Month11"),
12 => $outputlangs->trans("December") 12 => $outputlangs->trans("Month12")
); );
if (! empty($short)) if (! empty($short))
{ {
$montharray = array ( $montharray = array (
1 => $outputlangs->trans("JanuaryMin"), 1 => $outputlangs->trans("MonthShort01"),
2 => $outputlangs->trans("FebruaryMin"), 2 => $outputlangs->trans("MonthShort02"),
3 => $outputlangs->trans("MarchMin"), 3 => $outputlangs->trans("MonthShort03"),
4 => $outputlangs->trans("AprilMin"), 4 => $outputlangs->trans("MonthShort04"),
5 => $outputlangs->trans("MayMin"), 5 => $outputlangs->trans("MonthShort05"),
6 => $outputlangs->trans("JuneMin"), 6 => $outputlangs->trans("MonthShort06"),
7 => $outputlangs->trans("JulyMin"), 7 => $outputlangs->trans("MonthShort07"),
8 => $outputlangs->trans("AugustMin"), 8 => $outputlangs->trans("MonthShort08"),
9 => $outputlangs->trans("SeptemberMin"), 9 => $outputlangs->trans("MonthShort09"),
10 => $outputlangs->trans("OctoberMin"), 10 => $outputlangs->trans("MonthShort10"),
11 => $outputlangs->trans("NovemberMin"), 11 => $outputlangs->trans("MonthShort11"),
12 => $outputlangs->trans("DecemberMin") 12 => $outputlangs->trans("MonthShort12")
); );
} }

View File

@@ -3150,8 +3150,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
//if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on'))) //if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on')))
if (empty($srconly) && in_array($pictowithoutext, array( if (empty($srconly) && in_array($pictowithoutext, array(
'bank', 'close_title', 'delete', 'edit', 'ellipsis-h', 'filter', 'grip', 'grip_title', 'list', 'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'bank', 'close_title', 'delete', 'edit', 'ellipsis-h', 'filter', 'grip', 'grip_title', 'list', 'listlight', 'off', 'on', 'play', 'playdisabled', 'printer', 'resize',
'switch_off', 'switch_on', 'unlink', 'uparrow', '1downarrow', '1uparrow') 'note','switch_off', 'switch_on', 'unlink', 'uparrow', '1downarrow', '1uparrow')
)) { )) {
$fakey = $pictowithoutext; $fakey = $pictowithoutext;
$facolor = ''; $fasize = ''; $facolor = ''; $fasize = '';
@@ -3195,6 +3195,11 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
elseif ($pictowithoutext == 'grip_title' || $pictowithoutext == 'grip') { elseif ($pictowithoutext == 'grip_title' || $pictowithoutext == 'grip') {
$fakey = 'fa-arrows'; $fakey = 'fa-arrows';
} }
elseif ($pictowithoutext == 'listlight') {
$fakey = 'fa-download';
$facolor = '#999';
$marginleftonlyshort=1;
}
elseif ($pictowithoutext == 'printer') { elseif ($pictowithoutext == 'printer') {
$fakey = 'fa-print'; $fakey = 'fa-print';
$fasize = '1.2em'; $fasize = '1.2em';
@@ -3204,6 +3209,11 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$fakey = 'fa-crop'; $fakey = 'fa-crop';
$facolor = '#444'; $facolor = '#444';
} }
elseif ($pictowithoutext == 'note') {
$fakey = 'fa-sticky-note-o';
$facolor = '#999';
$marginleftonlyshort=1;
}
elseif ($pictowithoutext == 'uparrow') { elseif ($pictowithoutext == 'uparrow') {
$fakey = 'fa-mail-forward'; $fakey = 'fa-mail-forward';
$facolor = '#555'; $facolor = '#555';