diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index f456bc0db8b..f5d38bc001c 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -51,6 +51,8 @@ $date = dol_mktime(0, 0, 0, GETPOST('datemonth'), GETPOST('dateday'), GETPOST('d $fk_projet=GETPOST('fk_projet'); $vatrate=GETPOST('vatrate'); $ref=GETPOST("ref",'alpha'); +$comments=GETPOST('comments'); +$fk_c_type_fees=GETPOST('fk_c_type_fees','int'); // If socid provided by ajax company selector if (! empty($_REQUEST['socid_id'])) @@ -92,7 +94,19 @@ $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($co * Actions */ -if ($cancel) $action=''; +if ($cancel) +{ + $action=''; + $fk_projet=''; + $date_start=''; + $date_end=''; + $date=''; + $comments=''; + $vatrate=''; + $value_unit=''; + $qty=1; + $fk_c_type_fees=-1; +} if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $id > 0 && $user->rights->expensereport->supprimer) { @@ -863,7 +877,7 @@ if ($action == "addline") if($object_ligne->value_unit==0) { $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UP")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PriceUTTC")), null, 'errors'); } // S'il y'a eu au moins une erreur @@ -1615,7 +1629,19 @@ else $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pjt ON fde.fk_projet=pjt.rowid'; $sql.= ' WHERE fde.fk_expensereport = '.$object->id; - $resql = $db->query($sql); + print '
'; + + $actiontouse='updateligne'; + if (($object->fk_statut==0 || $object->fk_statut==99) && $action != 'editline') $actiontouse='addline'; + + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + + $resql = $db->query($sql); if ($resql) { $num_lignes = $db->num_rows($resql); @@ -1623,34 +1649,21 @@ else if ($num_lignes) { - print '
'; - - print ''; - print ''; - print ''; - print ''; - - print '
'; - print ''; - if ($action != 'editline') print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; - print ''; + print ''; print ''; if ($action != 'editline') { print ''; print ''; } - // Ajout des boutons de modification/suppression - if ($object->fk_statut < 2 || $object->fk_statut==99) - { - print ''; - } + print ''; print ''; @@ -1663,14 +1676,11 @@ else if ($action != 'editline' || $objp->rowid != GETPOST('rowid')) { print ''; - if ($action != 'editline') - { - print ''; - } - print ''; print ''; + print ''; + print ''; print ''; print ''; + if ($action != 'editline') { print ''; @@ -1690,17 +1701,18 @@ else } // Ajout des boutons de modification/suppression + print ''; } + print ''; + print ''; } @@ -1708,6 +1720,9 @@ else { //modif ligne!!!!! print ''; + + print ''; + // Select date print ''; + if ($action != 'editline') + { + print ''; + print ''; + } + print '
'.$langs->trans('Piece').''.$langs->trans('Piece').''.$langs->trans('Date').''.$langs->trans('Project').''.$langs->trans('Project').''.$langs->trans('Type').''.$langs->trans('Description').''.$langs->trans('VAT').''.$langs->trans('UnitPriceTTC').''.$langs->trans('PriceUTTC').''.$langs->trans('Qty').''.$langs->trans('AmountHT').''.$langs->trans('AmountTTC').'
'; - print img_picto($langs->trans("Document"), "object_generic"); - print ' '.$piece_comptable.''.dol_print_date($db->jdate($objp->date), 'day').''; + print img_picto($langs->trans("Document"), "object_generic"); + print ' '.$piece_comptable.''.dol_print_date($db->jdate($objp->date), 'day').''; if ($objp->projet_id > 0) { $projecttmp->id=$objp->projet_id; @@ -1683,6 +1693,7 @@ else print ''.vatrate($objp->vatrate,true).''.price($objp->value_unit).''.$objp->qty.''.price($objp->total_ht).''; if($object->fk_statut<2 OR $object->fk_statut==99) { - print ''; print 'rowid.'#'.$objp->rowid.'">'; print img_edit(); print '   '; print 'rowid.'">'; print img_delete(); print ''; - print '
'; $form->select_date($objp->date,'date'); @@ -1743,6 +1758,12 @@ else print ''; print ''.$langs->trans('AmountHT').''.$langs->trans('AmountTTC').''; print ''; print ''; @@ -1754,12 +1775,6 @@ else } $db->free($resql); - - print '
'; - - print '
'; - - print '
'; } else { @@ -1772,27 +1787,23 @@ else // Add a line if (($object->fk_statut==0 || $object->fk_statut==99) && $action != 'editline') { - print load_fiche_titre($langs->trans("AddLine"),'',''); - - print '
'; - print ''; - print ''; - print ''; - - print ''; print ''; - print ''; + print ''; + //print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; print ''; - print ''; + print ''; print ''; + print ''; + print ''; + // Select date print ''; // Select type - print ''; // Add comments - print ''; // Select VAT @@ -1819,28 +1830,37 @@ else if (! empty($conf->global->EXPENSEREPORT_NO_DEFAULT_VAT)) $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none'; print ''; print ''; // Unit price print ''; // Quantity print ''; + if ($action != 'editline') + { + print ''; + print ''; + } + print ''; + print ''; - - print '
'.$langs->trans('Date').''.$langs->trans('Date').''.$langs->trans('Project').''.$langs->trans('Type').''.$langs->trans('Type').''.$langs->trans('Description').''.$langs->trans('VAT').''.$langs->trans('PriceUTTC').''.$langs->trans('Qty').'
'; $form->select_date($date?$date:-1,'date'); @@ -1800,17 +1811,17 @@ else // Select project print ''; - $formproject->select_projects(-1, GETPOST('fk_projet'), 'fk_projet', 0, 0, 1, 1); + $formproject->select_projects(-1, $fk_projet, 'fk_projet', 0, 0, 1, 1); print ''; - select_type_fees_id(GETPOST('fk_c_type_fees'),'fk_c_type_fees',1); + print ''; + select_type_fees_id($fk_c_type_fees,'fk_c_type_fees',1); print ''; - print ''; + print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print '
'; - - print '
'; } // Fin si c'est payé/validé + print ''; + + print ''; + + print ''; + } else { diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 0dba68b5b5c..8b79d0b5d9f 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1801,9 +1801,10 @@ class ExpenseReportLine * @param int $selected preselect status * @param string $htmlname Name of HTML select * @param int $useempty 1=Add empty line + * @param int $useshortlabel Use short labels * @return string HTML select with status */ -function select_expensereport_statut($selected='',$htmlname='fk_statut',$useempty=1) +function select_expensereport_statut($selected='',$htmlname='fk_statut',$useempty=1, $useshortlabel=0) { global $db, $langs; @@ -1811,7 +1812,9 @@ function select_expensereport_statut($selected='',$htmlname='fk_statut',$useempt print '