Clean code

This commit is contained in:
Laurent Destailleur 2021-10-17 15:47:29 +02:00
parent 79177b0a11
commit 0aa90e82ea
7 changed files with 193 additions and 168 deletions

View File

@ -9307,11 +9307,12 @@ class Form
* *
* @param string $save_label Alternative label for save button * @param string $save_label Alternative label for save button
* @param string $cancel_label Alternative label for cancel button * @param string $cancel_label Alternative label for cancel button
* @param array $morefields Add additional buttons between save and cancel * @param array $morebuttons Add additional buttons between save and cancel
* @param bool $withoutdiv Option to remove enclosing centered div * @param bool $withoutdiv Option to remove enclosing centered div
* @param string $morecss More CSS
* @return string Html code with the buttons * @return string Html code with the buttons
*/ */
public function buttonsSaveCancel($save_label = 'Save', $cancel_label = 'Cancel', $morefields = array(), $withoutdiv = 0) public function buttonsSaveCancel($save_label = 'Save', $cancel_label = 'Cancel', $morebuttons = array(), $withoutdiv = 0, $morecss = '')
{ {
global $langs; global $langs;
@ -9335,8 +9336,8 @@ class Form
!empty($save_label) ? $buttons[] = $save : ''; !empty($save_label) ? $buttons[] = $save : '';
if (!empty($morefields)) { if (!empty($morebuttons)) {
$buttons[] = $morefields; $buttons[] = $morebuttons;
} }
!empty($cancel_label) ? $buttons[] = $cancel : ''; !empty($cancel_label) ? $buttons[] = $cancel : '';
@ -9345,7 +9346,7 @@ class Form
foreach ($buttons as $button) { foreach ($buttons as $button) {
$addclass = empty($button['addclass']) ? '' : $button['addclass']; $addclass = empty($button['addclass']) ? '' : $button['addclass'];
$retstring .= '<input type="submit" class="button button-'.$button['name'].' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">'; $retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">';
} }
$retstring .= $withoutdiv ? '': '</div>'; $retstring .= $withoutdiv ? '': '</div>';

View File

@ -2214,6 +2214,7 @@ if ($action == 'create') {
$colspan++; $colspan++;
} }
print '<!-- line of expense report -->'."\n";
print '<tr class="tredited">'; print '<tr class="tredited">';
print '<td class="center">'; print '<td class="center">';
@ -2333,8 +2334,10 @@ if ($action == 'create') {
//print $line->fk_ecm_files; //print $line->fk_ecm_files;
print '</td>'; print '</td>';
print '<td>';
print '<input type="hidden" name="rowid" value="'.$line->rowid.'">'; print '<input type="hidden" name="rowid" value="'.$line->rowid.'">';
print $form->buttonsSaveCancel(); print $form->buttonsSaveCancel('Save', 'Cancel', array(), 0, 'small');
print '</td>';
print '</tr>'; print '</tr>';
} }
@ -2344,9 +2347,7 @@ if ($action == 'create') {
} }
// Add a new line // Add a new line
if (($object->status == ExpenseReport::STATUS_DRAFT || $object->status == ExpenseReport::STATUS_REFUSED) if (($object->status == ExpenseReport::STATUS_DRAFT || $object->status == ExpenseReport::STATUS_REFUSED) && $action != 'editline' && $user->rights->expensereport->creer) {
&& $action != 'editline'
&& $user->rights->expensereport->creer) {
$colspan = 11; $colspan = 11;
if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) {
$colspan++; $colspan++;

View File

@ -2,7 +2,14 @@
// Add line to upload new file // Add line to upload new file
print '<!-- expensereport_addfile.tpl.php -->'."\n"; print '<!-- expensereport_addfile.tpl.php -->'."\n";
print '<tr class="truploadnewfilenow'.(empty($tredited) ? ' oddeven nohover' : ' '.$tredited).'"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? ' style="display: none"' : '').'>'; print '<tr class="truploadnewfilenow'.(empty($tredited) ? ' oddeven nohover' : ' '.$tredited).'"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? ' style="display: none"' : '').'>';
print '<td colspan="'.$colspan.'">';
// Num line
if ($action == 'editline') {
print '<td></td>';
}
// Upload section
print '<td colspan="'.($action == 'editline' ? $colspan - 1 : $colspan).'">';
$modulepart = 'expensereport'; $modulepart = 'expensereport';
$permission = $user->rights->expensereport->creer; $permission = $user->rights->expensereport->creer;

View File

@ -13,7 +13,14 @@ if (empty($conf->global->EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES)) {
if ($nbFiles > 0) { if ($nbFiles > 0) {
print '<tr class="trattachnewfilenow'.(empty($tredited) ? ' oddeven nohover' : ' '.$tredited).'"'.(!GETPOSTISSET('sendit') && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? ' style="display: none"' : '').'>'; print '<tr class="trattachnewfilenow'.(empty($tredited) ? ' oddeven nohover' : ' '.$tredited).'"'.(!GETPOSTISSET('sendit') && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? ' style="display: none"' : '').'>';
print '<td colspan="'.$colspan.'">';
// Num line
if ($action == 'editline') {
print '<td></td>';
}
// Select image section
print '<td colspan="'.($action == 'editline' ? $colspan - 1 : $colspan).'">';
//print '<span class="opacitymedium">'.$langs->trans("AttachTheNewLineToTheDocument").'</span><br>'; //print '<span class="opacitymedium">'.$langs->trans("AttachTheNewLineToTheDocument").'</span><br>';
$modulepart = 'expensereport'; $maxheightmini = 48; $modulepart = 'expensereport'; $maxheightmini = 48;
$relativepath = (!empty($object->ref) ?dol_sanitizeFileName($object->ref) : '').'/'; $relativepath = (!empty($object->ref) ?dol_sanitizeFileName($object->ref) : '').'/';
@ -112,8 +119,8 @@ if (empty($conf->global->EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES)) {
if (!empty($filenamelinked) && $filenamelinked == $file['relativename']) { if (!empty($filenamelinked) && $filenamelinked == $file['relativename']) {
$checked = ' checked'; $checked = ' checked';
} }
print '<div class="margintoponly minwidth150 maxwidth150"><input type="checkbox"'.$checked.' id="radio'.$filei.'" name="attachfile[]" class="checkboxattachfile" value="'.$file['relativename'].'">'; print '<div class="margintoponly minwidth150 maxwidth150 divoverflow"><input type="checkbox"'.$checked.' id="radio'.$filei.'" name="attachfile[]" class="checkboxattachfile valignmiddle" value="'.$file['relativename'].'">';
print '<label class="wordbreak checkboxattachfilelabel" for="radio'.$filei.'"> '.$file['relativename'].'</label>'; print '<label class="wordbreak checkboxattachfilelabel paddingrightonly valignmiddle" for="radio'.$filei.'" title="'.dol_escape_htmltag($file['relativename']).'">'.$file['relativename'].'</label>';
print '</div>'; print '</div>';
print '</div>'; print '</div>';

View File

@ -274,6 +274,7 @@ NewInter=Nouvelle intervention
OneLinePerTask=Une ligne par tâche OneLinePerTask=Une ligne par tâche
OneLinePerPeriod=Une ligne par période OneLinePerPeriod=Une ligne par période
OneLinePerTimeSpentLine=Une ligne pour chaque déclaration de temps passé OneLinePerTimeSpentLine=Une ligne pour chaque déclaration de temps passé
AddDetailDateAndDuration=Avec date et durée dans la description de la ligne
RefTaskParent=Réf. Tâche parent RefTaskParent=Réf. Tâche parent
ProfitIsCalculatedWith=Le bénéfice est calculé sur la base de ProfitIsCalculatedWith=Le bénéfice est calculé sur la base de
AddPersonToTask=Ajouter également aux tâches AddPersonToTask=Ajouter également aux tâches
@ -281,3 +282,4 @@ UsageOrganizeEvent=Utilisation: Organisation d'événements
PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE=Classer le projet comme étant clos lorsque toutes ses tâches sont terminées (progression 100%%) PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE=Classer le projet comme étant clos lorsque toutes ses tâches sont terminées (progression 100%%)
PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE_help=Remarque : les projets existants avec toutes les tâches terminées à 100 %% ne seront pas affectés : vous devrez les fermer manuellement. Cette option n’affecte que les projets ouverts. PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE_help=Remarque : les projets existants avec toutes les tâches terminées à 100 %% ne seront pas affectés : vous devrez les fermer manuellement. Cette option n’affecte que les projets ouverts.
SelectLinesOfTimeSpentToInvoice=Sélectionnez les lignes de temps consacré non facturées, puis l'action groupée "Générer la facture" pour les facturer SelectLinesOfTimeSpentToInvoice=Sélectionnez les lignes de temps consacré non facturées, puis l'action groupée "Générer la facture" pour les facturer
ProjectTasksWithoutTimeSpent=Project tasks without time spent

View File

@ -33,7 +33,7 @@ PropalStatusSigned=Signée (à facturer)
PropalStatusNotSigned=Non signée (fermée) PropalStatusNotSigned=Non signée (fermée)
PropalStatusBilled=Facturée PropalStatusBilled=Facturée
PropalStatusDraftShort=Brouillon PropalStatusDraftShort=Brouillon
PropalStatusValidatedShort=Validé (ouvert) PropalStatusValidatedShort=Ouvert
PropalStatusClosedShort=Fermée PropalStatusClosedShort=Fermée
PropalStatusSignedShort=Signée PropalStatusSignedShort=Signée
PropalStatusNotSignedShort=Non signée PropalStatusNotSignedShort=Non signée

View File

@ -886,6 +886,13 @@ span.fa.fa-plus-circle.paddingleft {
font-size: 1.5em; vertical-align: text-bottom; font-size: 1.5em; vertical-align: text-bottom;
} }
.divoverflow {
overflow: hidden;
white-space: nowrap;
vertical-align: middle;
text-overflow: ellipsis;
}
/* Themes for badges */ /* Themes for badges */