2
0
forked from Wavyzz/dolibarr

WIP Link files to expense report lines

This commit is contained in:
Laurent Destailleur
2019-03-15 15:07:52 +01:00
parent d2c7fe3a6f
commit a2d6723ff3
18 changed files with 189 additions and 59 deletions

View File

@@ -139,7 +139,7 @@ if ($action == 'update')
dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", $_POST["main_size_liste_limit"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", $_POST["main_size_liste_limit"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", $_POST["main_size_shortliste_limit"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", $_POST["main_size_shortliste_limit"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", $_POST["main_disable_javascript"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", $_POST["MAIN_DISABLE_JAVASCRIPT"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", $_POST["MAIN_BUTTON_HIDE_UNAUTHORIZED"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", $_POST["MAIN_BUTTON_HIDE_UNAUTHORIZED"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_START_WEEK", $_POST["MAIN_START_WEEK"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_START_WEEK", $_POST["MAIN_START_WEEK"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", $_POST["MAIN_DEFAULT_WORKING_DAYS"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", $_POST["MAIN_DEFAULT_WORKING_DAYS"], 'chaine', 0, '', $conf->entity);
@@ -259,11 +259,18 @@ if ($action == 'edit') // Edit
print '<br>'; print '<br>';
// Other // Other
print '<table summary="edit" class="noborder" width="100%">'; print '<table summary="otherparameters" class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>'; print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Disable javascript and ajax
print '<tr><td>'.$langs->trans("DisableJavascript").'</td><td>';
print $form->selectyesno('MAIN_DISABLE_JAVASCRIPT', isset($conf->global->MAIN_DISABLE_JAVASCRIPT)?$conf->global->MAIN_DISABLE_JAVASCRIPT:0, 1);
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// Max size of lists // Max size of lists
print '<tr><td>'.$langs->trans("DefaultMaxSizeList").'</td><td><input class="flat" name="main_size_liste_limit" size="4" value="' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '"></td>'; print '<tr><td>'.$langs->trans("DefaultMaxSizeList").'</td><td><input class="flat" name="main_size_liste_limit" size="4" value="' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '"></td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
@@ -283,13 +290,6 @@ if ($action == 'edit') // Edit
print '</tr>'; print '</tr>';
*/ */
// Disable javascript and ajax
print '<tr><td>'.$langs->trans("DisableJavascript").'</td><td>';
print $form->selectyesno('main_disable_javascript', isset($conf->global->MAIN_DISABLE_JAVASCRIPT)?$conf->global->MAIN_DISABLE_JAVASCRIPT:0, 1);
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// First day for weeks // First day for weeks
print '<tr><td class="titlefield">'.$langs->trans("WeekStartOnDay").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("WeekStartOnDay").'</td><td>';
print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1'), 'MAIN_START_WEEK', 0); print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1'), 'MAIN_START_WEEK', 0);
@@ -468,17 +468,21 @@ else // Show
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td></tr>';
// Disable javascript/ajax
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableJavascript").'</td><td>';
print yn($conf->global->MAIN_DISABLE_JAVASCRIPT);
print ' <span class="opacitymedium"> &nbsp; - &nbsp; '.$langs->trans("DisableJavascriptNote").'</span>';
print "</td>";
print "</tr>";
// Max size of lists
print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeList").'</td><td>' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '</td>'; print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeList").'</td><td>' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '</td>';
print "</tr>"; print "</tr>";
// Max size of short lists
print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeShortList").'</td><td>' . $conf->global->MAIN_SIZE_SHORTLIST_LIMIT . '</td>'; print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeShortList").'</td><td>' . $conf->global->MAIN_SIZE_SHORTLIST_LIMIT . '</td>';
print "</tr>"; print "</tr>";
// Disable javascript/ajax
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableJavascript").'</td><td>';
print yn($conf->global->MAIN_DISABLE_JAVASCRIPT)."</td>";
print "</tr>";
// First day for weeks // First day for weeks
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("WeekStartOnDay").'</td><td>'; print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("WeekStartOnDay").'</td><td>';
print $langs->trans("Day".(isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1')); print $langs->trans("Day".(isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1'));

View File

@@ -1635,7 +1635,7 @@ class Commande extends CommonOrder
$sql.= ', c.date_livraison'; $sql.= ', c.date_livraison';
$sql.= ', c.fk_shipping_method'; $sql.= ', c.fk_shipping_method';
$sql.= ', c.fk_warehouse'; $sql.= ', c.fk_warehouse';
$sql.= ', c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as billed'; $sql.= ', c.fk_projet as fk_project, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as billed';
$sql.= ', c.note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.last_main_doc, c.fk_delivery_address, c.extraparams'; $sql.= ', c.note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.last_main_doc, c.fk_delivery_address, c.extraparams';
$sql.= ', c.fk_incoterms, c.location_incoterms'; $sql.= ', c.fk_incoterms, c.location_incoterms';
$sql.= ", c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva, c.multicurrency_total_ttc"; $sql.= ", c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva, c.multicurrency_total_ttc";
@@ -1696,7 +1696,7 @@ class Commande extends CommonOrder
$this->note = $obj->note_private; // deprecated $this->note = $obj->note_private; // deprecated
$this->note_private = $obj->note_private; $this->note_private = $obj->note_private;
$this->note_public = $obj->note_public; $this->note_public = $obj->note_public;
$this->fk_project = $obj->fk_projet; $this->fk_project = $obj->fk_project;
$this->modelpdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf;
$this->last_main_doc = $obj->last_main_doc; $this->last_main_doc = $obj->last_main_doc;
$this->mode_reglement_id = $obj->fk_mode_reglement; $this->mode_reglement_id = $obj->fk_mode_reglement;
@@ -3466,7 +3466,7 @@ class Commande extends CommonOrder
$statusType=''; $statusType='';
$mode = 0; $mode = 0;
} }
return dolGetStatus($labelstatut, $labelstatutShort, '', $statusType, $mode); return dolGetStatus($labelstatut, $labelstatutShort, '', $statusType, $mode);
} }

View File

@@ -381,7 +381,7 @@ class FactureRec extends CommonInvoice
$sql.= ', f.date_lim_reglement as dlr'; $sql.= ', f.date_lim_reglement as dlr';
$sql.= ', f.note_private, f.note_public, f.fk_user_author'; $sql.= ', f.note_private, f.note_public, f.fk_user_author';
$sql.= ', f.modelpdf'; $sql.= ', f.modelpdf';
$sql.= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet'; $sql.= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet as fk_project';
$sql.= ', f.fk_account'; $sql.= ', f.fk_account';
$sql.= ', f.frequency, f.unit_frequency, f.date_when, f.date_last_gen, f.nb_gen_done, f.nb_gen_max, f.usenewprice, f.auto_validate'; $sql.= ', f.frequency, f.unit_frequency, f.date_when, f.date_last_gen, f.nb_gen_done, f.nb_gen_max, f.usenewprice, f.auto_validate';
$sql.= ', f.generate_pdf'; $sql.= ', f.generate_pdf';
@@ -438,7 +438,7 @@ class FactureRec extends CommonInvoice
$this->cond_reglement_code = $obj->cond_reglement_code; $this->cond_reglement_code = $obj->cond_reglement_code;
$this->cond_reglement = $obj->cond_reglement_libelle; $this->cond_reglement = $obj->cond_reglement_libelle;
$this->cond_reglement_doc = $obj->cond_reglement_libelle_doc; $this->cond_reglement_doc = $obj->cond_reglement_libelle_doc;
$this->fk_project = $obj->fk_projet; $this->fk_project = $obj->fk_project;
$this->fk_account = $obj->fk_account; $this->fk_account = $obj->fk_account;
$this->fk_facture_source = $obj->fk_facture_source; $this->fk_facture_source = $obj->fk_facture_source;
$this->note_private = $obj->note_private; $this->note_private = $obj->note_private;

View File

@@ -1321,7 +1321,7 @@ class Facture extends CommonInvoice
$sql.= ', f.tms as datem'; $sql.= ', f.tms as datem';
$sql.= ', f.note_private, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.model_pdf, f.last_main_doc'; $sql.= ', f.note_private, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.model_pdf, f.last_main_doc';
$sql.= ', f.fk_facture_source'; $sql.= ', f.fk_facture_source';
$sql.= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet, f.extraparams'; $sql.= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet as fk_project, f.extraparams';
$sql.= ', f.situation_cycle_ref, f.situation_counter, f.situation_final'; $sql.= ', f.situation_cycle_ref, f.situation_counter, f.situation_final';
$sql.= ', f.fk_account'; $sql.= ', f.fk_account';
$sql.= ", f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc"; $sql.= ", f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc";
@@ -1386,7 +1386,7 @@ class Facture extends CommonInvoice
$this->cond_reglement = $obj->cond_reglement_libelle; $this->cond_reglement = $obj->cond_reglement_libelle;
$this->cond_reglement_doc = $obj->cond_reglement_libelle_doc; $this->cond_reglement_doc = $obj->cond_reglement_libelle_doc;
$this->fk_account = ($obj->fk_account>0)?$obj->fk_account:null; $this->fk_account = ($obj->fk_account>0)?$obj->fk_account:null;
$this->fk_project = $obj->fk_projet; $this->fk_project = $obj->fk_project;
$this->fk_facture_source = $obj->fk_facture_source; $this->fk_facture_source = $obj->fk_facture_source;
$this->note = $obj->note_private; // deprecated $this->note = $obj->note_private; // deprecated
$this->note_private = $obj->note_private; $this->note_private = $obj->note_private;

View File

@@ -152,7 +152,7 @@ class FormFile
$out .= (!empty($accept)?' accept="'.$accept.'"':' accept=""'); $out .= (!empty($accept)?' accept="'.$accept.'"':' accept=""');
$out .= '>'; $out .= '>';
$out .= ' '; $out .= ' ';
$out .= '<input type="submit" class="button" name="sendit" value="'.$langs->trans("Upload").'"'; $out .= '<input type="submit" class="button reposition" name="sendit" value="'.$langs->trans("Upload").'"';
$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled':''); $out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled':'');
$out .= '>'; $out .= '>';

View File

@@ -2951,7 +2951,7 @@ function dol_trunc($string, $size = 40, $trunc = 'right', $stringencoding = 'UTF
* @param string $alt Force alt for bind people * @param string $alt Force alt for bind people
* @param string $morecss Add more class css on img tag (For example 'myclascss'). Work only if $moreatt is empty. * @param string $morecss Add more class css on img tag (For example 'myclascss'). Work only if $moreatt is empty.
* @return string Return img tag * @return string Return img tag
* @see #img_object, #img_picto_common * @see img_object(), img_picto_common()
*/ */
function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly = 0, $notitle = 0, $alt = '', $morecss = '') function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly = 0, $notitle = 0, $alt = '', $morecss = '')
{ {
@@ -2981,7 +2981,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
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', 'listlight', 'note', 'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'bank', 'close_title', 'delete', 'edit', 'ellipsis-h', 'filter', 'grip', 'grip_title', 'list', 'listlight', 'note', 'off', 'on', 'play', 'playdisabled', 'printer', 'resize',
'note', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'unlink', 'uparrow', '1downarrow', '1uparrow', '1leftarrow', '1rightarrow', 'note', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'unlink', 'uparrow', '1downarrow', '1uparrow', '1leftarrow', '1rightarrow',
'jabber','skype','twitter','facebook','linkedin' 'jabber','skype','twitter','facebook','linkedin',
'chevron-left','chevron-right','chevron-down','chevron-top'
) )
)) { )) {
$fa='fa'; $fa='fa';

View File

@@ -898,6 +898,7 @@ function show_theme($fuser, $edit = 0, $foruserprofile = false)
// Use MAIN_OPTIMIZEFORTEXTBROWSER // Use MAIN_OPTIMIZEFORTEXTBROWSER
if ($foruserprofile) if ($foruserprofile)
{ {
//$default=yn($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER);
$default=$langs->trans('No'); $default=$langs->trans('No');
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_OPTIMIZEFORTEXTBROWSER").'</td>'; print '<td>'.$langs->trans("MAIN_OPTIMIZEFORTEXTBROWSER").'</td>';
@@ -918,14 +919,32 @@ function show_theme($fuser, $edit = 0, $foruserprofile = false)
if (empty($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) print ' ('.$langs->trans("ForcedByGlobalSetup").')'; if (empty($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) print ' ('.$langs->trans("ForcedByGlobalSetup").')';
} }
} }
print ' &nbsp; ('.$langs->trans("Default").': <strong>'.yn(0).'</strong>) '; print ' &nbsp; ('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
print $form->textwithpicto('', $langs->trans("MAIN_OPTIMIZEFORTEXTBROWSERDesc")); print $form->textwithpicto('', $langs->trans("MAIN_OPTIMIZEFORTEXTBROWSERDesc"));
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
else else
{ {
// TODO /*var_dump($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER);
$default=$langs->trans('No');
print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_OPTIMIZEFORTEXTBROWSER").'</td>';
print '<td colspan="'.($colspan-1).'">';
if ($edit)
{
print $form->selectyesno('MAIN_OPTIMIZEFORTEXTBROWSER', $conf->global->MAIN_OPTIMIZEFORTEXTBROWSER, 1);
}
else
{
print yn($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER);
}
print ' &nbsp; ('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
print $form->textwithpicto('', $langs->trans("MAIN_OPTIMIZEFORTEXTBROWSERDesc"));
print '</span>';
print '</td>';
print '</tr>';
*/
} }
print '</table>'; print '</table>';

View File

@@ -52,7 +52,7 @@ if (in_array($modulepart, array('product', 'produit', 'societe', 'user', 'ticket
if ($action == 'delete') if ($action == 'delete')
{ {
$langs->load("companies"); // Need for string DeleteFile+ConfirmDeleteFiles $langs->load("companies"); // Need for string DeleteFile+ConfirmDeleteFiles
print $form->formconfirm( print $form->formconfirm(
$_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode(GETPOST("urlfile")) . '&linkid=' . GETPOST('linkid', 'int') . (empty($param)?'':$param), $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode(GETPOST("urlfile")) . '&linkid=' . GETPOST('linkid', 'int') . (empty($param)?'':$param),
$langs->trans('DeleteFile'), $langs->trans('DeleteFile'),
$langs->trans('ConfirmDeleteFile'), $langs->trans('ConfirmDeleteFile'),

View File

@@ -2058,9 +2058,9 @@ else
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {
print '<td>'; print '<td>';
if ($line->fk_projet > 0) if ($line->fk_project > 0)
{ {
$projecttmp->id=$line->fk_projet; $projecttmp->id=$line->fk_project;
$projecttmp->ref=$line->projet_ref; $projecttmp->ref=$line->projet_ref;
print $projecttmp->getNomUrl(1); print $projecttmp->getNomUrl(1);
} }
@@ -2135,7 +2135,7 @@ else
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {
print '<td>'; print '<td>';
$formproject->select_projects(-1, $line->fk_projet, 'fk_projet', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth300'); $formproject->select_projects(-1, $line->fk_project, 'fk_projet', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth300');
print '</td>'; print '</td>';
} }
@@ -2202,12 +2202,54 @@ else
if (! empty($conf->projet->enabled)) $colspan++; if (! empty($conf->projet->enabled)) $colspan++;
if ($action != 'editline') $colspan++; if ($action != 'editline') $colspan++;
$nbFiles = $nbLinks = 0;
$arrayoffiles = array();
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$upload_dir = $conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref);
$arrayoffiles=dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png|'.preg_quote(dol_sanitizeFileName($object->ref.'.pdf'), '/').')$');
$nbFiles = count($arrayoffiles);
$nbLinks=Link::count($db, $object->element, $object->id);
}
// Add line with link to add new file or attach to an existing file
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="'.$colspan.'" class="liste_titre">'; print '<td colspan="'.$colspan.'" class="liste_titre">';
print $langs->trans("UploadANewFileNow"); print '<a href="" class="commonlink auploadnewfilenow reposition">'.$langs->trans("UploadANewFileNow");
print img_picto($langs->trans("UploadANewFileNow"), 'chevron-down', '', false, 0, 0, '', 'marginleftonly');
print '</a>';
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
print ' &nbsp; - &nbsp; '.'<a href="" class="commonlink aattachtodoc reposition">'.$langs->trans("AttachTheNewLineToTheDocument");
print img_picto($langs->trans("AttachTheNewLineToTheDocument"), 'chevron-down', '', false, 0, 0, '', 'marginleftonly');
print '</a>';
}
print '<script language="javascript">'."\n";
print '$(document).ready(function() {
$( ".auploadnewfilenow" ).click(function() {
jQuery(".truploadnewfilenow").toggle();
return false;
});
$( ".aattachtodoc" ).click(function() {
jQuery(".trattachnewfilenow").toggle();
return false;
});';
if (is_array(GETPOST('attachfile','array')) && count(GETPOST('attachfile','array')))
{
print 'jQuery(".trattachnewfilenow").toggle();'."\n";
}
print '
});
';
print '</script>'."\n";
print '</td></tr>'; print '</td></tr>';
print '<tr class="oddeven">'; // Add line to upload new file
print '<tr class="oddeven truploadnewfilenow"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display: none"':'').'>';
print '<td colspan="'.$colspan.'">'; print '<td colspan="'.$colspan.'">';
$modulepart = 'expensereport'; $modulepart = 'expensereport';
@@ -2251,6 +2293,65 @@ else
print '</td></tr>'; print '</td></tr>';
// Add line to select existing file
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$upload_dir = $conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref);
$arrayoffiles=dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png|'.preg_quote(dol_sanitizeFileName($object->ref.'.pdf'), '/').')$');
$nbFiles = count($arrayoffiles);
$nbLinks=Link::count($db, $object->element, $object->id);
if ($nbFiles >= 0)
{
print '<tr class="oddeven trattachnewfilenow"'.(! GETPOSTISSET('sendit') && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display: none"':'').'>';
print '<td colspan="'.$colspan.'">';
//print '<span class="opacitymedium">'.$langs->trans("AttachTheNewLineToTheDocument").'</span><br>';
$modulepart='expensereport';$maxheightmini=48;
$relativepath=(! empty($object->ref)?dol_sanitizeFileName($object->ref):'').'/';
foreach($arrayoffiles as $file)
{
print '<div class="inline-block margintoponly marginleftonly marginrightonly center">';
$fileinfo = pathinfo($file['name']);
if (image_format_supported($file['name']) > 0)
{
$minifile=getImageFileNameForSize($file['name'], '_mini'); // For new thumbs using same ext (in lower case howerver) than original
//if (! dol_is_file($file['path'].'/'.$minifile)) $minifile=getImageFileNameForSize($file['name'], '_mini', '.png'); // For backward compatibility of old thumbs that were created with filename in lower case and with .png extension
//print $file['path'].'/'.$minifile.'<br>';
$urlforhref=getAdvancedPreviewUrl($modulepart, $fileinfo['relativename'].'.'.strtolower($fileinfo['extension']), 1, '&entity='.(!empty($object->entity)?$object->entity:$conf->entity));
if (empty($urlforhref)) {
$urlforhref=DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity)?$object->entity:$conf->entity).'&file='.urlencode($fileinfo['relativename'].'.'.strtolower($fileinfo['extension']));
print '<a href="'.$urlforhref.'" class="aphoto" target="_blank">';
} else {
print '<a href="'.$urlforhref['url'].'" class="'.$urlforhref['css'].'" target="'.$urlforhref['target'].'" mime="'.$urlforhref['mime'].'">';
}
print '<img class="photo" height="'.$maxheightmini.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity)?$object->entity:$conf->entity).'&file='.urlencode($relativepath.$minifile).'" title="">';
print '</a>';
}
else print '&nbsp;';
print '<br>';
$checked='';
//var_dump(GETPOST($file['relativename'])); var_dump($file['relativename']); var_dump($_FILES['userfile']['name']);
foreach($_FILES['userfile']['name'] as $tmpfile)
{
if ($file['relativename'] == (GETPOST('savingdocmask','alpha') ? dol_sanitizeFileName($object->ref.'-') : '').$tmpfile)
{
$checked=' checked';
break;
}
elseif ($file['relativename'] && in_array($file['relativename'], GETPOST('attachfile','array'))) {
$checked=' checked';
break;
}
}
print '<input type="checkbox"'.$checked.' name="attachfile[]" value="'.$file['relativename'].'"> '.$file['relativename'];
print '</div>';
}
print '</td></tr>';
}
}
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td></td>'; print '<td></td>';
print '<td align="center">'.$langs->trans('Date').'</td>'; print '<td align="center">'.$langs->trans('Date').'</td>';
@@ -2332,16 +2433,6 @@ else
print '<td align="center"><input type="submit" value="'.$langs->trans("Add").'" name="bouton" class="button"></td>'; print '<td align="center"><input type="submit" value="'.$langs->trans("Add").'" name="bouton" class="button"></td>';
print '</tr>'; print '</tr>';
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
print '<tr class="oddeven"><td colspan="'.$colspan.'">';
print $langs->trans("AttachTheNewLineToTheDocument");
print '...';
print '</td></tr>';
}
} // Fin si c'est payé/validé } // Fin si c'est payé/validé
print '</table>'; print '</table>';

View File

@@ -971,7 +971,7 @@ class ExpenseReport extends CommonObject
$this->lines=array(); $this->lines=array();
$sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date, de.rang,'; $sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date, de.rang,';
$sql.= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_c_exp_tax_cat, de.fk_projet, de.tva_tx,'; $sql.= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_c_exp_tax_cat, de.fk_projet as fk_project, de.tva_tx,';
$sql.= ' de.total_ht, de.total_tva, de.total_ttc,'; $sql.= ' de.total_ht, de.total_tva, de.total_ttc,';
$sql.= ' ctf.code as code_type_fees, ctf.label as libelle_type_fees,'; $sql.= ' ctf.code as code_type_fees, ctf.label as libelle_type_fees,';
$sql.= ' p.ref as ref_projet, p.title as title_projet'; $sql.= ' p.ref as ref_projet, p.title as title_projet';
@@ -1010,7 +1010,8 @@ class ExpenseReport extends CommonObject
$deplig->fk_expensereport = $objp->fk_expensereport; $deplig->fk_expensereport = $objp->fk_expensereport;
$deplig->fk_c_type_fees = $objp->fk_c_type_fees; $deplig->fk_c_type_fees = $objp->fk_c_type_fees;
$deplig->fk_c_exp_tax_cat = $objp->fk_c_exp_tax_cat; $deplig->fk_c_exp_tax_cat = $objp->fk_c_exp_tax_cat;
$deplig->fk_projet = $objp->fk_projet; $deplig->fk_projet = $objp->fk_project;
$deplig->fk_project = $objp->fk_project;
$deplig->total_ht = $objp->total_ht; $deplig->total_ht = $objp->total_ht;
$deplig->total_tva = $objp->total_tva; $deplig->total_tva = $objp->total_tva;
@@ -1994,7 +1995,8 @@ class ExpenseReport extends CommonObject
$this->line->fk_expensereport= $expensereport_id; $this->line->fk_expensereport= $expensereport_id;
$this->line->fk_c_type_fees = $type_fees_id; $this->line->fk_c_type_fees = $type_fees_id;
$this->line->fk_c_exp_tax_cat = $fk_c_exp_tax_cat; $this->line->fk_c_exp_tax_cat = $fk_c_exp_tax_cat;
$this->line->fk_projet = $projet_id; $this->line->fk_projet = $projet_id; // deprecated
$this->line->fk_project = $projet_id;
$this->line->vat_src_code = $vat_src_code; $this->line->vat_src_code = $vat_src_code;
$this->line->vatrate = price2num($vatrate); $this->line->vatrate = price2num($vatrate);
@@ -2513,7 +2515,7 @@ class ExpenseReportLine
*/ */
public function fetch($rowid) public function fetch($rowid)
{ {
$sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_c_exp_tax_cat, fde.fk_projet, fde.date,'; $sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_c_exp_tax_cat, fde.fk_projet as fk_project, fde.date,';
$sql.= ' fde.tva_tx as vatrate, fde.vat_src_code, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,'; $sql.= ' fde.tva_tx as vatrate, fde.vat_src_code, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,';
$sql.= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,'; $sql.= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,';
$sql.= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref'; $sql.= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref';
@@ -2539,7 +2541,8 @@ class ExpenseReportLine
$this->value_unit = $objp->value_unit; $this->value_unit = $objp->value_unit;
$this->fk_c_type_fees = $objp->fk_c_type_fees; $this->fk_c_type_fees = $objp->fk_c_type_fees;
$this->fk_c_exp_tax_cat = $objp->fk_c_exp_tax_cat; $this->fk_c_exp_tax_cat = $objp->fk_c_exp_tax_cat;
$this->fk_projet = $objp->fk_projet; $this->fk_projet = $objp->fk_project; // deprecated
$this->fk_project = $objp->fk_project;
$this->type_fees_code = $objp->type_fees_code; $this->type_fees_code = $objp->type_fees_code;
$this->type_fees_libelle = $objp->type_fees_libelle; $this->type_fees_libelle = $objp->type_fees_libelle;
$this->projet_ref = $objp->projet_ref; $this->projet_ref = $objp->projet_ref;
@@ -2585,7 +2588,7 @@ class ExpenseReportLine
$sql.= ' tva_tx, vat_src_code, comments, qty, value_unit, total_ht, total_tva, total_ttc, date, rule_warning_message, fk_c_exp_tax_cat)'; $sql.= ' tva_tx, vat_src_code, comments, qty, value_unit, total_ht, total_tva, total_ttc, date, rule_warning_message, fk_c_exp_tax_cat)';
$sql.= " VALUES (".$this->db->escape($this->fk_expensereport).","; $sql.= " VALUES (".$this->db->escape($this->fk_expensereport).",";
$sql.= " ".$this->db->escape($this->fk_c_type_fees).","; $sql.= " ".$this->db->escape($this->fk_c_type_fees).",";
$sql.= " ".$this->db->escape($this->fk_projet>0?$this->fk_projet:'null').","; $sql.= " ".$this->db->escape($this->fk_project>0?$this->fk_project:($this->fk_projet>0?$this->fk_projet:'null')).",";
$sql.= " ".$this->db->escape($this->vatrate).","; $sql.= " ".$this->db->escape($this->vatrate).",";
$sql.= " '".$this->db->escape($this->vat_src_code)."',"; $sql.= " '".$this->db->escape($this->vat_src_code)."',";
$sql.= " '".$this->db->escape($this->comments)."',"; $sql.= " '".$this->db->escape($this->comments)."',";
@@ -2713,7 +2716,7 @@ class ExpenseReportLine
$sql.= ",fk_c_exp_tax_cat=".$this->db->escape($this->fk_c_exp_tax_cat); $sql.= ",fk_c_exp_tax_cat=".$this->db->escape($this->fk_c_exp_tax_cat);
if ($this->fk_c_type_fees) $sql.= ",fk_c_type_fees=".$this->db->escape($this->fk_c_type_fees); if ($this->fk_c_type_fees) $sql.= ",fk_c_type_fees=".$this->db->escape($this->fk_c_type_fees);
else $sql.= ",fk_c_type_fees=null"; else $sql.= ",fk_c_type_fees=null";
if ($this->fk_projet) $sql.= ",fk_projet=".$this->db->escape($this->fk_projet); if ($this->fk_project > 0) $sql.= ",fk_projet=".$this->db->escape($this->fk_project);
else $sql.= ",fk_projet=null"; else $sql.= ",fk_projet=null";
$sql.= " WHERE rowid = ".$this->db->escape($this->rowid); $sql.= " WHERE rowid = ".$this->db->escape($this->rowid);

View File

@@ -162,6 +162,7 @@ if ($action == 'add') {
if ($object->socid > 0) { if ($object->socid > 0) {
$newinter->socid=$object->socid; $newinter->socid=$object->socid;
$newinter->fk_projet=$object->fk_projet; $newinter->fk_projet=$object->fk_projet;
$newinter->fk_project=$object->fk_projet;
$newinter->fk_contrat=$object->fk_contrat; $newinter->fk_contrat=$object->fk_contrat;
} else } else
$newinter->socid=GETPOST("socid"); $newinter->socid=GETPOST("socid");
@@ -772,8 +773,8 @@ $date_next_execution = (GETPOST('remonth') ? dol_mktime(
/* /*
* List mode * List mode
*/ */
$sql = "SELECT f.rowid as fich_rec, s.nom as name, s.rowid as socid, f.rowid as facid, f.titre, "; $sql = "SELECT f.rowid as fich_rec, s.nom as name, s.rowid as socid, f.rowid as facid, f.titre,";
$sql.= " f.duree, f.fk_contrat, f.fk_projet, f.frequency, f.nb_gen_done, f.nb_gen_max,"; $sql.= " f.duree, f.fk_contrat, f.fk_projet as fk_project, f.frequency, f.nb_gen_done, f.nb_gen_max,";
$sql.= " f.date_last_gen, f.date_when, f.datec"; $sql.= " f.date_last_gen, f.date_when, f.datec";
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter_rec as f"; $sql.= " FROM ".MAIN_DB_PREFIX."fichinter_rec as f";
@@ -863,7 +864,7 @@ $date_next_execution = (GETPOST('remonth') ? dol_mktime(
if (! empty($conf->projet->enabled)) { if (! empty($conf->projet->enabled)) {
print '<td>'; print '<td>';
if ($objp->fk_project > 0) { if ($objp->fk_project > 0) {
$projectstatic->fetch($objp->fk_projet); $projectstatic->fetch($objp->fk_project);
print $projectstatic->getNomUrl(1); print $projectstatic->getNomUrl(1);
} }
print '</td>'; print '</td>';

View File

@@ -2310,6 +2310,7 @@ class CommandeFournisseur extends CommonOrder
{ {
$this->oldcopy= clone $this; $this->oldcopy= clone $this;
$this->fk_projet = $id_projet; $this->fk_projet = $id_projet;
$this->fk_project = $id_projet;
} }
if (! $notrigger && empty($error)) if (! $notrigger && empty($error))

View File

@@ -578,7 +578,7 @@ class FactureFournisseur extends CommonInvoice
$sql.= " t.fk_user_author,"; $sql.= " t.fk_user_author,";
$sql.= " t.fk_user_valid,"; $sql.= " t.fk_user_valid,";
$sql.= " t.fk_facture_source,"; $sql.= " t.fk_facture_source,";
$sql.= " t.fk_projet,"; $sql.= " t.fk_projet as fk_project,";
$sql.= " t.fk_cond_reglement,"; $sql.= " t.fk_cond_reglement,";
$sql.= " t.fk_account,"; $sql.= " t.fk_account,";
$sql.= " t.fk_mode_reglement,"; $sql.= " t.fk_mode_reglement,";
@@ -641,8 +641,8 @@ class FactureFournisseur extends CommonInvoice
$this->author = $obj->fk_user_author; $this->author = $obj->fk_user_author;
$this->fk_user_valid = $obj->fk_user_valid; $this->fk_user_valid = $obj->fk_user_valid;
$this->fk_facture_source = $obj->fk_facture_source; $this->fk_facture_source = $obj->fk_facture_source;
$this->fk_project = $obj->fk_projet; $this->fk_project = $obj->fk_project;
$this->cond_reglement_id = $obj->fk_cond_reglement; $this->cond_reglement_id = $obj->fk_cond_reglement;
$this->cond_reglement_code = $obj->cond_reglement_code; $this->cond_reglement_code = $obj->cond_reglement_code;
$this->cond_reglement = $obj->cond_reglement_libelle; $this->cond_reglement = $obj->cond_reglement_libelle;
$this->cond_reglement_doc = $obj->cond_reglement_libelle; $this->cond_reglement_doc = $obj->cond_reglement_libelle;

View File

@@ -65,7 +65,8 @@ DictionarySetup=Dictionary setup
Dictionary=Dictionaries Dictionary=Dictionaries
ErrorReservedTypeSystemSystemAuto=Value 'system' and 'systemauto' for type is reserved. You can use 'user' as value to add your own record ErrorReservedTypeSystemSystemAuto=Value 'system' and 'systemauto' for type is reserved. You can use 'user' as value to add your own record
ErrorCodeCantContainZero=Code can't contain value 0 ErrorCodeCantContainZero=Code can't contain value 0
DisableJavascript=Disable JavaScript and Ajax functions (Recommended for blind person or text browsers) DisableJavascript=Disable JavaScript and Ajax functions
DisableJavascriptNote=Note: For test or debug purpose. For optimization for blind person or text browsers, you may prefer to use the setup on the profile of user
UseSearchToSelectCompanyTooltip=Also if you have a large number of third parties (> 100 000), you can increase speed by setting constant COMPANY_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string. UseSearchToSelectCompanyTooltip=Also if you have a large number of third parties (> 100 000), you can increase speed by setting constant COMPANY_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string.
UseSearchToSelectContactTooltip=Also if you have a large number of third parties (> 100 000), you can increase speed by setting constant CONTACT_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string. UseSearchToSelectContactTooltip=Also if you have a large number of third parties (> 100 000), you can increase speed by setting constant CONTACT_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string.
DelaiedFullListToSelectCompany=Wait until a key is pressed before loading content of Third Parties combo list.<br>This may increase performance if you have a large number of third parties, but it is less convenient. DelaiedFullListToSelectCompany=Wait until a key is pressed before loading content of Third Parties combo list.<br>This may increase performance if you have a large number of third parties, but it is less convenient.

View File

@@ -148,3 +148,4 @@ nolimitbyEX_EXP=by line (no limitation)
CarCategory=Category of car CarCategory=Category of car
ExpenseRangeOffset=Offset amount: %s ExpenseRangeOffset=Offset amount: %s
RangeIk=Mileage range RangeIk=Mileage range
AttachTheNewLineToTheDocument=Attach the new line to an existing document

View File

@@ -704,7 +704,7 @@ class Task extends CommonObject
{ {
$this->id=0; $this->id=0;
$this->fk_projet=''; $this->fk_project='';
$this->ref='TK01'; $this->ref='TK01';
$this->fk_task_parent=null; $this->fk_task_parent=null;
$this->label='Specimen task TK01'; $this->label='Specimen task TK01';

View File

@@ -57,7 +57,8 @@ input.select2-input {
.liste_titre input[name=search_day_lim], .liste_titre input[name=search_day_start], .liste_titre input[name=search_day_end], .liste_titre input[name=search_day_create], .liste_titre input[name=search_day_lim], .liste_titre input[name=search_day_start], .liste_titre input[name=search_day_end], .liste_titre input[name=search_day_create],
.liste_titre input[name=search_day_create], .liste_titre input[name=search_day_start], .liste_titre input[name=search_day_end], .liste_titre input[name=search_day_create], .liste_titre input[name=search_day_start], .liste_titre input[name=search_day_end],
.liste_titre input[name=search_day_date_when], .liste_titre input[name=search_month_date_when], .liste_titre input[name=search_year_date_when], .liste_titre input[name=search_day_date_when], .liste_titre input[name=search_month_date_when], .liste_titre input[name=search_year_date_when],
.liste_titre input[name=search_dtstartday], .liste_titre input[name=search_dtendday], .liste_titre input[name=search_dtstartmonth], .liste_titre input[name=search_dtendmonth] .liste_titre input[name=search_dtstartday], .liste_titre input[name=search_dtendday], .liste_titre input[name=search_dtstartmonth], .liste_titre input[name=search_dtendmonth],
select#date_startday, select#date_startmonth, select#date_endday, select#date_endmonth, select#reday, select#remonth
{ {
margin-right: 4px; margin-right: 4px;
} }
@@ -511,6 +512,9 @@ select.flat.selectlimit {
.nomarginleft { .nomarginleft {
margin-left: 0px !important; margin-left: 0px !important;
} }
.margintoponly {
margin-top: 10px !important;
}
.marginbottomonly { .marginbottomonly {
margin-bottom: 10px !important; margin-bottom: 10px !important;
} }

View File

@@ -294,7 +294,8 @@ textarea.cke_source:focus
.liste_titre input[name=search_day_lim], .liste_titre input[name=search_day_start], .liste_titre input[name=search_day_end], .liste_titre input[name=search_day_create], .liste_titre input[name=search_day_lim], .liste_titre input[name=search_day_start], .liste_titre input[name=search_day_end], .liste_titre input[name=search_day_create],
.liste_titre input[name=search_day_create], .liste_titre input[name=search_day_start], .liste_titre input[name=search_day_end], .liste_titre input[name=search_day_create], .liste_titre input[name=search_day_start], .liste_titre input[name=search_day_end],
.liste_titre input[name=search_day_date_when], .liste_titre input[name=search_month_date_when], .liste_titre input[name=search_year_date_when], .liste_titre input[name=search_day_date_when], .liste_titre input[name=search_month_date_when], .liste_titre input[name=search_year_date_when],
.liste_titre input[name=search_dtstartday], .liste_titre input[name=search_dtendday], .liste_titre input[name=search_dtstartmonth], .liste_titre input[name=search_dtendmonth] .liste_titre input[name=search_dtstartday], .liste_titre input[name=search_dtendday], .liste_titre input[name=search_dtstartmonth], .liste_titre input[name=search_dtendmonth],
select#date_startday, select#date_startmonth, select#date_endday, select#date_endmonth, select#reday, select#remonth
{ {
margin-right: 4px; margin-right: 4px;
} }
@@ -744,6 +745,9 @@ select.flat.selectlimit {
.nomarginleft { .nomarginleft {
margin-left: 0px !important; margin-left: 0px !important;
} }
.margintoponly {
margin-top: 10px !important;
}
.marginbottomonly { .marginbottomonly {
margin-bottom: 10px !important; margin-bottom: 10px !important;
} }