Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into dev_scrunit

This commit is contained in:
florian HENRY 2018-03-21 08:34:31 +01:00
commit 6cd5d12a31
54 changed files with 1097 additions and 409 deletions

View File

@ -627,8 +627,8 @@ if ($action == 'exportcsv') {
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep; print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . $langs->trans("Code_tiers") . '"' . $sep; print '"' . $langs->trans("Thirdparty") . '"' . $sep;
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep; print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Thirdparty") . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep;
print '"' . $journal . '"' ; print '"' . $journal . '"' ;
@ -694,7 +694,7 @@ if ($action == 'exportcsv') {
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . $langs->trans("Code_tiers") . '"' . $sep; print '"' . $langs->trans("Thirdparty") . '"' . $sep;
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . ' NPR"' . $sep; print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . ' NPR"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep;

View File

@ -578,8 +578,8 @@ if ($action == 'exportcsv') {
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep; print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . $langs->trans("Code_tiers") . '"' . $sep; print '"' . $langs->trans("Thirdparty") . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep; print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Thirdparty") . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . $journal . '"'; print '"' . $journal . '"';

View File

@ -1614,7 +1614,7 @@ class Adherent extends CommonObject
// Generate PDF (whatever is option MAIN_DISABLE_PDF_AUTOUPDATE) so we can include it into email // Generate PDF (whatever is option MAIN_DISABLE_PDF_AUTOUPDATE) so we can include it into email
//if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) //if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
$invoice->generateDocument($invoice->modelpdf, $outputlangs, 0, 0, 0); $invoice->generateDocument($invoice->modelpdf, $outputlangs);
} }
} }

248
htdocs/admin/accountant.php Normal file
View File

@ -0,0 +1,248 @@
<?php
/* Copyright (C) 2018 Alexandre Spangaro <aspangaro@zendsi.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/admin/accountant.php
* \ingroup accountant
* \brief Setup page to configure accountant / auditor
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$action=GETPOST('action','aZ09');
$langs->load("admin");
$langs->load("companies");
if (! $user->admin) accessforbidden();
$error=0;
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$contextpage=array('adminaccoutant','globaladmin');
$hookmanager->initHooks($contextpage);
/*
* Actions
*/
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if ( ($action == 'update' && ! GETPOST("cancel",'alpha'))
|| ($action == 'updateedit') )
{
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NAME", GETPOST("nom",'nohtml'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ADDRESS", GETPOST("address",'nohtml'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_TOWN", GETPOST("town",'nohtml'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ZIP", GETPOST("zipcode",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_STATE", GETPOST("state_id",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_REGION", GETPOST("region_code",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_COUNTRY", GETPOST('country_id','int'), 'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_PHONE", GETPOST("tel",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_FAX", GETPOST("fax",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_MAIL", GETPOST("mail",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_WEB", GETPOST("web",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NOTE", GETPOST("note",'none'),'chaine',0,'',$conf->entity);
if ($action != 'updateedit' && ! $error)
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
}
/*
* View
*/
$help_url='';
llxHeader('',$langs->trans("CompanyFoundation"),$help_url);
print load_fiche_titre($langs->trans("CompanyFoundation"),'','title_setup');
$head = company_admin_prepare_head();
dol_fiche_head($head, 'accountant', $langs->trans("Company"), -1, 'company');
$form=new Form($db);
$formother=new FormOther($db);
$formcompany=new FormCompany($db);
$countrynotdefined='<font class="error">'.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')</font>';
print $langs->trans("AccountantDesc")."<br>\n";
print "<br>\n";
if ($action == 'edit' || $action == 'updateedit')
{
/**
* Edit parameters
*/
print "\n".'<script type="text/javascript" language="javascript">';
print '$(document).ready(function () {
$("#selectcountry_id").change(function() {
document.form_index.action.value="updateedit";
document.form_index.submit();
});
});';
print '</script>'."\n";
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'" name="form_index">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
// Name
print '<tr class="oddeven"><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
print '<input name="nom" id="name" class="minwidth200" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_NAME?$conf->global->MAIN_INFO_ACCOUNTANT_NAME: GETPOST("nom",'nohtml')) . '" autofocus="autofocus"></td></tr>'."\n";
// Address
print '<tr class="oddeven"><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>';
print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'. ($conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS?$conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS: GETPOST("address",'nohtml')) . '</textarea></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="zipcode">'.$langs->trans("CompanyZip").'</label></td><td>';
print '<input class="minwidth100" name="zipcode" id="zipcode" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_ZIP?$conf->global->MAIN_INFO_ACCOUNTANT_ZIP: GETPOST("zipcode",'alpha')) . '"></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="town">'.$langs->trans("CompanyTown").'</label></td><td>';
print '<input name="town" class="minwidth100" id="town" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_TOWN?$conf->global->MAIN_INFO_ACCOUNTANT_TOWN: GETPOST("town",'nohtml')) . '"></td></tr>'."\n";
// Country
print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">';
//if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization
print $form->select_country($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">';
$formcompany->select_departement($conf->global->MAIN_INFO_ACCOUNTANT_STATE, $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'state_id');
print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
print '<input name="tel" id="phone" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_PHONE . '"></td></tr>';
print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
print '<input name="fax" id="fax" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_FAX . '"></td></tr>';
print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
print '<input name="mail" id="email" class="minwidth200" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_MAIL . '"></td></tr>';
print '</td></tr>'."\n";
// Web
print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>';
print '<input name="web" id="web" class="minwidth300" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_WEB . '"></td></tr>';
print '</td></tr>'."\n";
// Note
print '<tr class="oddeven"><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>';
print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(GETPOST('note','none') ? GETPOST('note','none') : $conf->global->MAIN_INFO_ACCOUNTANT_NOTE).'</textarea></td></tr>';
print '</td></tr>';
print '</table>';
print '<br><div class="center">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '<br>';
print '</form>';
}
else
{
/*
* Show parameters
*/
// Actions buttons
//print '<div class="tabsAction">';
//print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
//print '</div><br>';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("CompanyInfo").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven"><td class="titlefield wordbreak">'.$langs->trans("CompanyName").'</td><td>';
print $conf->global->MAIN_INFO_ACCOUNTANT_NAME;
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CompanyAddress").'</td><td>' . nl2br(empty($conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS)?'':$conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS) . '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CompanyZip").'</td><td>' . (empty($conf->global->MAIN_INFO_ACCOUNTANT_ZIP)?'':$conf->global->MAIN_INFO_ACCOUNTANT_ZIP) . '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CompanyTown").'</td><td>' . (empty($conf->global->MAIN_INFO_ACCOUNTANT_TOWN)?'':$conf->global->MAIN_INFO_ACCOUNTANT_TOWN) . '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CompanyCountry").'</td><td>';
if (! empty($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY))
{
$code = getCountry($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 2);
$img=picto_from_langcode($code);
print $img?$img.' ':'';
print getCountry($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY,1);
}
print '</td></tr>';
if (! empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT)) print '<tr class="oddeven"><td>'.$langs->trans("Region-State").'</td><td>';
else print '<tr class="oddeven"><td>'.$langs->trans("State").'</td><td>';
if (! empty($conf->global->MAIN_INFO_ACCOUNTANT_STATE)) print getState($conf->global->MAIN_INFO_ACCOUNTANT_STATE,$conf->global->MAIN_SHOW_STATE_CODE,0,$conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT);
else print '&nbsp;';
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("Phone").'</td><td>' . dol_print_phone($conf->global->MAIN_INFO_ACCOUNTANT_PHONE,$mysoc->country_code) . '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("Fax").'</td><td>' . dol_print_phone($conf->global->MAIN_INFO_ACCOUNTANT_FAX,$mysoc->country_code) . '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("Mail").'</td><td>' . dol_print_email($conf->global->MAIN_INFO_ACCOUNTANT_MAIL,0,0,0,80) . '</td></tr>';
// Web
print '<tr class="oddeven"><td>'.$langs->trans("Web").'</td><td>' . dol_print_url($conf->global->MAIN_INFO_ACCOUNTANT_WEB,'_blank',80) . '</td></tr>';
print '<tr class="oddeven"><td class="tdtop">'.$langs->trans("Note").'</td><td>' . (! empty($conf->global->MAIN_INFO_ACCOUNTANT_NOTE) ? nl2br($conf->global->MAIN_INFO_ACCOUNTANT_NOTE) : '') . '</td></tr>';
print '</table>';
print "</div>";
print '</form>';
// Actions buttons
print '<div class="tabsAction">';
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a></div>';
print '</div>';
}
llxFooter();
$db->close();

View File

@ -295,6 +295,10 @@ $countrynotdefined='<font class="error">'.$langs->trans("ErrorSetACountryFirst")
print load_fiche_titre($langs->trans("CompanyFoundation"),'','title_setup'); print load_fiche_titre($langs->trans("CompanyFoundation"),'','title_setup');
$head = company_admin_prepare_head();
dol_fiche_head($head, 'company', $langs->trans("Company"), -1, 'company');
print $langs->trans("CompanyFundationDesc")."<br>\n"; print $langs->trans("CompanyFundationDesc")."<br>\n";
print "<br>\n"; print "<br>\n";
@ -1134,8 +1138,6 @@ else
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a></div>';
print '</div>'; print '</div>';
print '<br>';
} }

View File

@ -69,6 +69,7 @@ $object = new Commande($db);
/* /*
* Actions * Actions
*/ */
if ($object->fetch($id)) if ($object->fetch($id))
{ {
$object->fetch_thirdparty(); $object->fetch_thirdparty();

View File

@ -15,6 +15,7 @@
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr> * Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@zendsi.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -43,6 +44,9 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
require_once DOL_DOCUMENT_ROOT.'/margin/lib/margins.lib.php'; require_once DOL_DOCUMENT_ROOT.'/margin/lib/margins.lib.php';
require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php'; require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
/** /**
* Class to manage invoices * Class to manage invoices
*/ */
@ -1476,6 +1480,9 @@ class Facture extends CommonInvoice
$line->fk_prev_id = $objp->fk_prev_id; $line->fk_prev_id = $objp->fk_prev_id;
$line->fk_unit = $objp->fk_unit; $line->fk_unit = $objp->fk_unit;
// Accountancy
$line->fk_accounting_account = $objp->fk_code_ventilation;
// Multicurrency // Multicurrency
$line->fk_multicurrency = $objp->fk_multicurrency; $line->fk_multicurrency = $objp->fk_multicurrency;
$line->multicurrency_code = $objp->multicurrency_code; $line->multicurrency_code = $objp->multicurrency_code;
@ -1560,19 +1567,18 @@ class Facture extends CommonInvoice
// Update request // Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."facture SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."facture SET";
$sql.= " facnumber=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").","; $sql.= " facnumber=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").",";
$sql.= " type=".(isset($this->type)?$this->type:"null").","; $sql.= " type=".(isset($this->type)?$this->db->escape($this->type):"null").",";
$sql.= " ref_client=".(isset($this->ref_client)?"'".$this->db->escape($this->ref_client)."'":"null").","; $sql.= " ref_client=".(isset($this->ref_client)?"'".$this->db->escape($this->ref_client)."'":"null").",";
$sql.= " increment=".(isset($this->increment)?"'".$this->db->escape($this->increment)."'":"null").","; $sql.= " increment=".(isset($this->increment)?"'".$this->db->escape($this->increment)."'":"null").",";
$sql.= " fk_soc=".(isset($this->socid)?$this->socid:"null").","; $sql.= " fk_soc=".(isset($this->socid)?$this->db->escape($this->socid):"null").",";
$sql.= " datec=".(strval($this->date_creation)!='' ? "'".$this->db->idate($this->date_creation)."'" : 'null').","; $sql.= " datec=".(strval($this->date_creation)!='' ? "'".$this->db->idate($this->date_creation)."'" : 'null').",";
$sql.= " datef=".(strval($this->date)!='' ? "'".$this->db->idate($this->date)."'" : 'null').","; $sql.= " datef=".(strval($this->date)!='' ? "'".$this->db->idate($this->date)."'" : 'null').",";
$sql.= " date_pointoftax=".(strval($this->date_pointoftax)!='' ? "'".$this->db->idate($this->date_pointoftax)."'" : 'null').","; $sql.= " date_pointoftax=".(strval($this->date_pointoftax)!='' ? "'".$this->db->idate($this->date_pointoftax)."'" : 'null').",";
$sql.= " date_valid=".(strval($this->date_validation)!='' ? "'".$this->db->idate($this->date_validation)."'" : 'null').","; $sql.= " date_valid=".(strval($this->date_validation)!='' ? "'".$this->db->idate($this->date_validation)."'" : 'null').",";
$sql.= " paye=".(isset($this->paye)?$this->paye:"null").","; $sql.= " paye=".(isset($this->paye)?$this->db->escape($this->paye):"null").",";
$sql.= " remise_percent=".(isset($this->remise_percent)?$this->remise_percent:"null").","; $sql.= " remise_percent=".(isset($this->remise_percent)?$this->db->escape($this->remise_percent):"null").",";
$sql.= " remise_absolue=".(isset($this->remise_absolue)?$this->remise_absolue:"null").","; $sql.= " remise_absolue=".(isset($this->remise_absolue)?$this->db->escape($this->remise_absolue):"null").",";
$sql.= " close_code=".(isset($this->close_code)?"'".$this->db->escape($this->close_code)."'":"null").","; $sql.= " close_code=".(isset($this->close_code)?"'".$this->db->escape($this->close_code)."'":"null").",";
$sql.= " close_note=".(isset($this->close_note)?"'".$this->db->escape($this->close_note)."'":"null").","; $sql.= " close_note=".(isset($this->close_note)?"'".$this->db->escape($this->close_note)."'":"null").",";
$sql.= " tva=".(isset($this->total_tva)?$this->total_tva:"null").","; $sql.= " tva=".(isset($this->total_tva)?$this->total_tva:"null").",";
@ -1580,23 +1586,22 @@ class Facture extends CommonInvoice
$sql.= " localtax2=".(isset($this->total_localtax2)?$this->total_localtax2:"null").","; $sql.= " localtax2=".(isset($this->total_localtax2)?$this->total_localtax2:"null").",";
$sql.= " total=".(isset($this->total_ht)?$this->total_ht:"null").","; $sql.= " total=".(isset($this->total_ht)?$this->total_ht:"null").",";
$sql.= " total_ttc=".(isset($this->total_ttc)?$this->total_ttc:"null").","; $sql.= " total_ttc=".(isset($this->total_ttc)?$this->total_ttc:"null").",";
$sql.= " revenuestamp=".((isset($this->revenuestamp) && $this->revenuestamp != '')?$this->revenuestamp:"null").","; $sql.= " revenuestamp=".((isset($this->revenuestamp) && $this->revenuestamp != '')?$this->db->escape($this->revenuestamp):"null").",";
$sql.= " fk_statut=".(isset($this->statut)?$this->statut:"null").","; $sql.= " fk_statut=".(isset($this->statut)?$this->db->escape($this->statut):"null").",";
$sql.= " fk_user_author=".(isset($this->user_author)?$this->user_author:"null").","; $sql.= " fk_user_author=".(isset($this->user_author)?$this->db->escape($this->user_author):"null").",";
$sql.= " fk_user_valid=".(isset($this->fk_user_valid)?$this->fk_user_valid:"null").","; $sql.= " fk_user_valid=".(isset($this->fk_user_valid)?$this->db->escape($this->fk_user_valid):"null").",";
$sql.= " fk_facture_source=".(isset($this->fk_facture_source)?$this->fk_facture_source:"null").","; $sql.= " fk_facture_source=".(isset($this->fk_facture_source)?$this->db->escape($this->fk_facture_source):"null").",";
$sql.= " fk_projet=".(isset($this->fk_project)?$this->fk_project:"null").","; $sql.= " fk_projet=".(isset($this->fk_project)?$this->db->escape($this->fk_project):"null").",";
$sql.= " fk_cond_reglement=".(isset($this->cond_reglement_id)?$this->cond_reglement_id:"null").","; $sql.= " fk_cond_reglement=".(isset($this->cond_reglement_id)?$this->db->escape($this->cond_reglement_id):"null").",";
$sql.= " fk_mode_reglement=".(isset($this->mode_reglement_id)?$this->mode_reglement_id:"null").","; $sql.= " fk_mode_reglement=".(isset($this->mode_reglement_id)?$this->db->escape($this->mode_reglement_id):"null").",";
$sql.= " date_lim_reglement=".(strval($this->date_lim_reglement)!='' ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'null').","; $sql.= " date_lim_reglement=".(strval($this->date_lim_reglement)!='' ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'null').",";
$sql.= " note_private=".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null").","; $sql.= " note_private=".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null").",";
$sql.= " note_public=".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null").","; $sql.= " note_public=".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null").",";
$sql.= " model_pdf=".(isset($this->modelpdf)?"'".$this->db->escape($this->modelpdf)."'":"null").","; $sql.= " model_pdf=".(isset($this->modelpdf)?"'".$this->db->escape($this->modelpdf)."'":"null").",";
$sql.= " import_key=".(isset($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null"); $sql.= " import_key=".(isset($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null").",";
$sql.= ", situation_cycle_ref=".(empty($this->situation_cycle_ref)?"null":$this->situation_cycle_ref); $sql.= " situation_cycle_ref=".(empty($this->situation_cycle_ref)?"null":$this->db->escape($this->situation_cycle_ref)).",";
$sql.= ", situation_counter=".(empty($this->situation_counter)?"null":$this->situation_counter); $sql.= " situation_counter=".(empty($this->situation_counter)?"null":$this->db->escape($this->situation_counter)).",";
$sql.= ", situation_final=".(empty($this->situation_counter)?"0":$this->situation_counter); $sql.= " situation_final=".(empty($this->situation_counter)?"0":$this->db->escape($this->situation_counter));
$sql.= " WHERE rowid=".$this->id; $sql.= " WHERE rowid=".$this->id;
$this->db->begin(); $this->db->begin();

View File

@ -1705,14 +1705,11 @@ else
print '</tr>'; print '</tr>';
} }
// Display lines extrafields // Display lines extrafields
if (is_array($extralabelslines) && count($extralabelslines)>0) { if (is_array($extralabelslines) && count($extralabelslines)>0) {
print '<tr '.$bcnd[$var].'>';
$line = new ContratLigne($db); $line = new ContratLigne($db);
$line->fetch_optionals($objp->rowid); $line->fetch_optionals($objp->rowid);
print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bcnd[$var], 'colspan'=>$colspan)); print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bcnd[$var], 'colspan'=>$colspan), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
print '</tr>';
} }
} }
// Ligne en mode update // Ligne en mode update
@ -1767,6 +1764,7 @@ else
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button" name="save" value="'.$langs->trans("Modify").'">';
print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</td>'; print '</td>';
print '</tr>';
$colspan=6; $colspan=6;
if (! empty($conf->margin->enabled) && ! empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) $colspan++; if (! empty($conf->margin->enabled) && ! empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) $colspan++;
@ -1780,16 +1778,13 @@ else
print ' &nbsp;&nbsp;'.$langs->trans("DateEndPlanned").' '; print ' &nbsp;&nbsp;'.$langs->trans("DateEndPlanned").' ';
$form->select_date($db->jdate($objp->date_fin),"date_end_update",$usehm,$usehm,($db->jdate($objp->date_fin)>0?0:1),"update"); $form->select_date($db->jdate($objp->date_fin),"date_end_update",$usehm,$usehm,($db->jdate($objp->date_fin)>0?0:1),"update");
print '</td>'; print '</td>';
print '</tr>';
if (is_array($extralabelslines) && count($extralabelslines)>0) { if (is_array($extralabelslines) && count($extralabelslines)>0) {
print '<tr '.$bcnd[$var].'>';
$line = new ContratLigne($db); $line = new ContratLigne($db);
$line->fetch_optionals($objp->rowid); $line->fetch_optionals($objp->rowid);
print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$colspan)); print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$colspan), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
print '</tr>';
} }
print '</tr>';
} }
$db->free($result); $db->free($result);

View File

@ -124,5 +124,13 @@ if ($action == 'remove_file' && $permissioncreate)
$ret=dol_delete_file($file,0,0,0,$object); $ret=dol_delete_file($file,0,0,0,$object);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", $filetodelete), null, 'mesgs'); if ($ret) setEventMessages($langs->trans("FileWasRemoved", $filetodelete), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", $filetodelete), null, 'errors'); else setEventMessages($langs->trans("ErrorFailToDeleteFile", $filetodelete), null, 'errors');
// Make a redirect to avoid to keep the remove_file into the url that create side effects
$urltoredirect = $_SERVER['REQUEST_URI'];
$urltoredirect = preg_replace('/#builddoc$/', '', $urltoredirect);
$urltoredirect = preg_replace('/action=remove_file&?/', '', $urltoredirect);
header('Location: '.$urltoredirect);
exit;
} }

View File

@ -4340,6 +4340,8 @@ abstract class CommonObject
} }
if ($this->element == 'commande' && ! empty($conf->global->ORDER_ALLOW_EXTERNAL_DOWNLOAD)) $setsharekey=true; if ($this->element == 'commande' && ! empty($conf->global->ORDER_ALLOW_EXTERNAL_DOWNLOAD)) $setsharekey=true;
if ($this->element == 'facture' && ! empty($conf->global->INVOICE_ALLOW_EXTERNAL_DOWNLOAD)) $setsharekey=true; if ($this->element == 'facture' && ! empty($conf->global->INVOICE_ALLOW_EXTERNAL_DOWNLOAD)) $setsharekey=true;
if ($this->element == 'bank_account' && ! empty($conf->global->BANK_ACCOUNT_ALLOW_EXTERNAL_DOWNLOAD)) $setsharekey=true;
if ($setsharekey) if ($setsharekey)
{ {
if (empty($ecmfile->share)) // Because object not found or share not set yet if (empty($ecmfile->share)) // Because object not found or share not set yet
@ -5911,10 +5913,10 @@ abstract class CommonObject
* @param array $params Optional parameters * @param array $params Optional parameters
* @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names) * @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names)
* @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names) * @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names)
* * @param string $onetrtd All fields in same tr td
* @return string * @return string
*/ */
function showOptionals($extrafields, $mode='view', $params=null, $keysuffix='', $keyprefix='') function showOptionals($extrafields, $mode='view', $params=null, $keysuffix='', $keyprefix='', $onetrtd=0)
{ {
global $_POST, $conf, $langs, $action; global $_POST, $conf, $langs, $action;
@ -5978,15 +5980,13 @@ abstract class CommonObject
$csstyle=$params['style']; $csstyle=$params['style'];
} }
} }
if ( !empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0)
{
$out .= '<tr '.$class.$csstyle.' class="'.$this->element.'_extras_'.$key.'">'; $out .= '<tr '.$class.$csstyle.' class="'.$this->element.'_extras_'.$key.'">';
$colspan='0'; if (empty($onetrtd))
}
else
{ {
$out .= '<tr '.$class.$csstyle.' class="'.$this->element.'_extras_'.$key.'">'; if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { $colspan='0'; }
} }
// Convert date into timestamp format (value in memory must be a timestamp) // Convert date into timestamp format (value in memory must be a timestamp)
if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
{ {
@ -6004,10 +6004,17 @@ abstract class CommonObject
{ {
$labeltoshow = '<span'.($mode != 'view' ? ' class="fieldrequired"':'').'>'.$labeltoshow.'</span>'; $labeltoshow = '<span'.($mode != 'view' ? ' class="fieldrequired"':'').'>'.$labeltoshow.'</span>';
} }
$out .= '<td>'.$labeltoshow.'</td>';
if (empty($onetrtd)) $out .= '<td>';
else $out .= '<td'.($colspan?' colspan="'.($colspan+1).'"':'').'>';
$out .= $labeltoshow;
if (empty($onetrtd)) $out .= '</td><td'.($colspan?' colspan="'.($colspan).'"':'').'>';
else $out.=' ';
$html_id = !empty($this->id) ? $this->element.'_extras_'.$key.'_'.$this->id : ''; $html_id = !empty($this->id) ? $this->element.'_extras_'.$key.'_'.$this->id : '';
$out .='<td id="'.$html_id.'" class="'.$this->element.'_extras_'.$key.'" '.($colspan?' colspan="'.$colspan.'"':'').'>'; $out .='<span id="'.$html_id.'" class="'.$this->element.'_extras_'.$key.'">';
switch($mode) { switch($mode) {
case "view": case "view":
@ -6019,9 +6026,8 @@ abstract class CommonObject
} }
$out .= '</td>'; $out .= '</td>';
$out .= '</tr>';
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) $out .= '</tr>';
else $out .= '</tr>';
$e++; $e++;
} }
} }

View File

@ -425,7 +425,7 @@ class Conf
if (empty($this->global->MAIN_MONNAIE)) $this->global->MAIN_MONNAIE='EUR'; if (empty($this->global->MAIN_MONNAIE)) $this->global->MAIN_MONNAIE='EUR';
$this->currency=$this->global->MAIN_MONNAIE; $this->currency=$this->global->MAIN_MONNAIE;
if (empty($conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY)) $conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY = 30; // Less than 1 minutes to be sure if (empty($this->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY)) $this->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY = 30; // Less than 1 minutes to be sure
// conf->global->ACCOUNTING_MODE = Option des modules Comptabilites (simple ou expert). Defini le mode de calcul des etats comptables (CA,...) // conf->global->ACCOUNTING_MODE = Option des modules Comptabilites (simple ou expert). Defini le mode de calcul des etats comptables (CA,...)
if (empty($this->global->ACCOUNTING_MODE)) $this->global->ACCOUNTING_MODE='RECETTES-DEPENSES'; // By default. Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES' if (empty($this->global->ACCOUNTING_MODE)) $this->global->ACCOUNTING_MODE='RECETTES-DEPENSES'; // By default. Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES'
@ -584,13 +584,15 @@ class Conf
if (! isset($this->global->THEME_HIDE_BORDER_ON_INPUT)) $this->global->THEME_HIDE_BORDER_ON_INPUT=0; if (! isset($this->global->THEME_HIDE_BORDER_ON_INPUT)) $this->global->THEME_HIDE_BORDER_ON_INPUT=0;
// Save inconsistent option // Save inconsistent option
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && (! isset($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $conf->global->AGENDA_DEFAULT_FILTER_TYPE == 'AC_NON_AUTO')) if (empty($this->global->AGENDA_USE_EVENT_TYPE) && (! isset($this->global->AGENDA_DEFAULT_FILTER_TYPE) || $this->global->AGENDA_DEFAULT_FILTER_TYPE == 'AC_NON_AUTO'))
{ {
$conf->global->AGENDA_DEFAULT_FILTER_TYPE='0'; // 'AC_NON_AUTO' does not exists when AGENDA_DEFAULT_FILTER_TYPE is not on. $this->global->AGENDA_DEFAULT_FILTER_TYPE='0'; // 'AC_NON_AUTO' does not exists when AGENDA_DEFAULT_FILTER_TYPE is not on.
} }
$conf->global->MAIN_MODULE_DOLISTORE_API_SRV='https://www.dolistore.com'; if (! isset($this->global->MAIN_EXTRAFIELDS_IN_ONE_TD)) $this->global->MAIN_EXTRAFIELDS_IN_ONE_TD = 1;
$conf->global->MAIN_MODULE_DOLISTORE_API_KEY='dolistorecatalogpublickey1234567';
$this->global->MAIN_MODULE_DOLISTORE_API_SRV='https://www.dolistore.com';
$this->global->MAIN_MODULE_DOLISTORE_API_KEY='dolistorecatalogpublickey1234567';
// For backward compatibility // For backward compatibility
if (isset($this->product)) $this->produit=$this->product; if (isset($this->product)) $this->produit=$this->product;

View File

@ -1447,7 +1447,7 @@ class Form
/** /**
* Return select list of users * Return select list of users
* *
* @param string $selected User id or user object of user preselected. If -1, we use id of current user. * @param string $selected User id or user object of user preselected. If 0 or < -2, we use id of current user. If -1, keep unselected (if empty is allowed)
* @param string $htmlname Field name in form * @param string $htmlname Field name in form
* @param int $show_empty 0=list with no empty value, 1=add also an empty value into list * @param int $show_empty 0=list with no empty value, 1=add also an empty value into list
* @param array $exclude Array list of users id to exclude * @param array $exclude Array list of users id to exclude
@ -1457,7 +1457,7 @@ class Form
* @param int $force_entity 0 or Id of environment to force * @param int $force_entity 0 or Id of environment to force
* @param int $maxlength Maximum length of string into list (0=no limit) * @param int $maxlength Maximum length of string into list (0=no limit)
* @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status * @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
* @param string $morefilter Add more filters into sql request * @param string $morefilter Add more filters into sql request (Example: 'employee = 1')
* @param integer $show_every 0=default list, 1=add also a value "Everybody" at beginning of list * @param integer $show_every 0=default list, 1=add also a value "Everybody" at beginning of list
* @param string $enableonlytext If option $enableonlytext is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty. * @param string $enableonlytext If option $enableonlytext is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty.
* @param string $morecss More css * @param string $morecss More css
@ -1530,7 +1530,6 @@ class Form
$sql.= " ORDER BY u.lastname ASC"; $sql.= " ORDER BY u.lastname ASC";
} }
dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG); dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)

View File

@ -1226,14 +1226,14 @@ class FormFile
if (in_array($modulepart, array('product','produit','service'))) $newmodulepart='produit|service'; if (in_array($modulepart, array('product','produit','service'))) $newmodulepart='produit|service';
$disablecrop=1; $disablecrop=1;
if (in_array($modulepart, array('societe','product','produit','service','expensereport','holiday','project','user'))) $disablecrop=0; if (in_array($modulepart, array('societe','product','produit','service','expensereport','holiday','member','project','ticketsup','user'))) $disablecrop=0;
if (! $disablecrop && image_format_supported($file['name']) > 0) if (! $disablecrop && image_format_supported($file['name']) > 0)
{ {
if ($permtoeditline) if ($permtoeditline)
{ {
// Link to resize // Link to resize
print '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?modulepart='.urlencode($newmodulepart).'&id='.$object->id.'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"),'resize','class="paddingrightonly"').'</a>'; print '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?modulepart='.urlencode($newmodulepart).'&id='.$object->id.'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])).'" title="'.dol_escape_htmltag($langs->trans("ResizeOrCrop")).'">'.img_picto($langs->trans("ResizeOrCrop"),'resize','class="paddingrightonly"').'</a>';
} }
} }

View File

@ -738,6 +738,10 @@ class Ldap
*/ */
function serverPing($host, $port=389, $timeout=1) function serverPing($host, $port=389, $timeout=1)
{ {
// Replace ldaps:// by ssl://
if (preg_match('/^ldaps:\/\/([^\/]+)\/?$/',$host, $regs)) {
$host = 'ssl://'.$regs[1];
}
$op = @fsockopen($host, $port, $errno, $errstr, $timeout); $op = @fsockopen($host, $port, $errno, $errstr, $timeout);
if (!$op) return false; //DC is N/A if (!$op) return false; //DC is N/A
else { else {

View File

@ -1154,7 +1154,7 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql
} }
/** /**
* Activate external modules mandatroy when country is country_code * Activate external modules mandatory when country is country_code
* *
* @param string $country_code CountryCode * @param string $country_code CountryCode
* @return int 1 * @return int 1
@ -1612,6 +1612,33 @@ function phpinfo_array()
return $info_arr; return $info_arr;
} }
/**
* Return array head with list of tabs to view object informations.
*
* @return array head array with tabs
*/
function company_admin_prepare_head()
{
global $langs, $conf, $user;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT."/admin/company.php";
$head[$h][1] = $langs->trans("Company");
$head[$h][2] = 'company';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/accountant.php";
$head[$h][1] = $langs->trans("Accountant");
$head[$h][2] = 'accountant';
$h++;
complete_head_from_modules($conf,$langs,null,$head,$h,'company_admin','remove');
return $head;
}
/** /**
* Return array head with list of tabs to view object informations. * Return array head with list of tabs to view object informations.
* *

View File

@ -352,7 +352,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5000__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/holiday/list.php?&leftmenu=hrm', 'CPTitreMenu', 0, 'holiday', '$user->rights->holiday->read', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5000__+MAX_llx_menu__, 'hrm', 'hrm', 15__+MAX_llx_menu__, '/holiday/list.php?&leftmenu=hrm', 'CPTitreMenu', 0, 'holiday', '$user->rights->holiday->read', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5001__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/card.php?&action=request', 'MenuAddCP', 1, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5001__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/card.php?&action=request', 'MenuAddCP', 1, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5002__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/list.php?&leftmenu=hrm', 'List', 1, 'holiday', '$user->rights->holiday->read', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5002__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/list.php?&leftmenu=hrm', 'List', 1, 'holiday', '$user->rights->holiday->read', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5003__+MAX_llx_menu__, 'hrm', '', 5002__+MAX_llx_menu__, '/holiday/list.php?select_statut=2&leftmenu=hrm', 'ListToApprove', 2, 'trips', '$user->rights->holiday->read', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5003__+MAX_llx_menu__, 'hrm', '', 5002__+MAX_llx_menu__, '/holiday/list.php?search_statut=2&leftmenu=hrm', 'ListToApprove', 2, 'trips', '$user->rights->holiday->read', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5004__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/define_holiday.php?&action=request', 'MenuConfCP', 1, 'holiday', '$user->rights->holiday->define_holiday', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5004__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/define_holiday.php?&action=request', 'MenuConfCP', 1, 'holiday', '$user->rights->holiday->define_holiday', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5005__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/view_log.php?&action=request', 'MenuLogCP', 1, 'holiday', '$user->rights->holiday->define_holiday', '', 0, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5005__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/view_log.php?&action=request', 'MenuLogCP', 1, 'holiday', '$user->rights->holiday->define_holiday', '', 0, 3, __ENTITY__);
-- HRM - Trips and expenses (old module) -- HRM - Trips and expenses (old module)

View File

@ -1371,12 +1371,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/holiday/list.php?leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'hrm'); $newmenu->add("/holiday/list.php?leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'hrm');
$newmenu->add("/holiday/card.php?action=request", $langs->trans("New"), 1,$user->rights->holiday->write); $newmenu->add("/holiday/card.php?action=request", $langs->trans("New"), 1,$user->rights->holiday->write);
$newmenu->add("/holiday/list.php?leftmenu=hrm", $langs->trans("List"), 1,$user->rights->holiday->read); $newmenu->add("/holiday/list.php?leftmenu=hrm", $langs->trans("List"), 1,$user->rights->holiday->read);
if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?select_statut=1&leftmenu=hrm", $langs->trans("DraftCP"), 2, $user->rights->holiday->read); if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?search_statut=1&leftmenu=hrm", $langs->trans("DraftCP"), 2, $user->rights->holiday->read);
if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?select_statut=2&leftmenu=hrm", $langs->trans("ToReviewCP"), 2, $user->rights->holiday->read); if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?search_statut=2&leftmenu=hrm", $langs->trans("ToReviewCP"), 2, $user->rights->holiday->read);
if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?select_statut=3&leftmenu=hrm", $langs->trans("ApprovedCP"), 2, $user->rights->holiday->read); if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?search_statut=3&leftmenu=hrm", $langs->trans("ApprovedCP"), 2, $user->rights->holiday->read);
if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?select_statut=4&leftmenu=hrm", $langs->trans("CancelCP"), 2, $user->rights->holiday->read); if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?search_statut=4&leftmenu=hrm", $langs->trans("CancelCP"), 2, $user->rights->holiday->read);
if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?select_statut=5&leftmenu=hrm", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read); if ($usemenuhider || empty($leftmenu) || $leftmenu=="hrm") $newmenu->add("/holiday/list.php?search_statut=5&leftmenu=hrm", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read);
$newmenu->add("/holiday/define_holiday.php?action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read); $newmenu->add("/holiday/define_holiday.php?action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read);
$newmenu->add("/holiday/month_report.php", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->read_all);
$newmenu->add("/holiday/view_log.php?action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday); $newmenu->add("/holiday/view_log.php?action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday);
} }

View File

@ -53,16 +53,22 @@ elseif ($modulepart == 'project')
if (! $user->rights->projet->lire) accessforbidden(); if (! $user->rights->projet->lire) accessforbidden();
$accessallowed=1; $accessallowed=1;
} }
elseif ($modulepart == 'expensereport')
{
$result=restrictedArea($user,'expensereport',$id,'expensereport');
if (! $user->rights->expensereport->lire) accessforbidden();
$accessallowed=1;
}
elseif ($modulepart == 'holiday') elseif ($modulepart == 'holiday')
{ {
$result=restrictedArea($user,'holiday',$id,'holiday'); $result=restrictedArea($user,'holiday',$id,'holiday');
if (! $user->rights->holiday->read) accessforbidden(); if (! $user->rights->holiday->read) accessforbidden();
$accessallowed=1; $accessallowed=1;
} }
elseif ($modulepart == 'expensereport') elseif ($modulepart == 'member')
{ {
$result=restrictedArea($user,'expensereport',$id,'expensereport'); $result=restrictedArea($user, 'adherent', $id, '', '', 'fk_soc', 'rowid');
if (! $user->rights->expensereport->lire) accessforbidden(); if (! $user->rights->adherent->lire) accessforbidden();
$accessallowed=1; $accessallowed=1;
} }
elseif ($modulepart == 'user') elseif ($modulepart == 'user')
@ -77,6 +83,12 @@ elseif ($modulepart == 'societe')
if (! $user->rights->societe->lire) accessforbidden(); if (! $user->rights->societe->lire) accessforbidden();
$accessallowed=1; $accessallowed=1;
} }
elseif ($modulepart == 'ticketsup')
{
$result=restrictedArea($user,'ticketsup',$id,'ticketsup');
if (! $user->rights->ticketsup->read) accessforbidden();
$accessallowed=1;
}
// Security: // Security:
// Limit access if permissions are wrong // Limit access if permissions are wrong
@ -121,6 +133,17 @@ elseif ($modulepart == 'holiday')
$dir=$conf->holiday->dir_output; // By default $dir=$conf->holiday->dir_output; // By default
} }
} }
elseif ($modulepart == 'member')
{
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$object = new Adherent($db);
if ($id > 0)
{
$result = $object->fetch($id);
if ($result <= 0) dol_print_error($db,'Failed to load object');
$dir=$conf->adherent->dir_output; // By default
}
}
elseif ($modulepart == 'societe') elseif ($modulepart == 'societe')
{ {
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
@ -154,15 +177,31 @@ elseif ($modulepart == 'expensereport')
$dir=$conf->expensereport->dir_output; // By default $dir=$conf->expensereport->dir_output; // By default
} }
} }
elseif ($modulepart == 'ticketsup')
{
require_once DOL_DOCUMENT_ROOT.'/ticketsup/class/ticketsup.class.php';
$object = new Ticketsup($db);
if ($id > 0)
{
$result = $object->fetch($id);
if ($result <= 0) dol_print_error($db,'Failed to load object');
$dir=$conf->ticketsup->dir_output; // By default
}
}
else {
print 'Action crop for module part '.$modulepart.' is not supported yet.';
}
if (empty($backtourl)) if (empty($backtourl))
{ {
if (in_array($modulepart, array('product','produit','service','produit|service'))) $backtourl=DOL_URL_ROOT."/product/document.php?id=".$id.'&file='.urldecode($_POST["file"]); if (in_array($modulepart, array('product','produit','service','produit|service'))) $backtourl=DOL_URL_ROOT."/product/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
else if (in_array($modulepart, array('expensereport'))) $backtourl=DOL_URL_ROOT."/expensereport/document.php?id=".$id.'&file='.urldecode($_POST["file"]); else if (in_array($modulepart, array('expensereport'))) $backtourl=DOL_URL_ROOT."/expensereport/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
else if (in_array($modulepart, array('holiday'))) $backtourl=DOL_URL_ROOT."/holiday/document.php?id=".$id.'&file='.urldecode($_POST["file"]); else if (in_array($modulepart, array('holiday'))) $backtourl=DOL_URL_ROOT."/holiday/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
else if (in_array($modulepart, array('member'))) $backtourl=DOL_URL_ROOT."/adherents/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
else if (in_array($modulepart, array('project'))) $backtourl=DOL_URL_ROOT."/projet/document.php?id=".$id.'&file='.urldecode($_POST["file"]); else if (in_array($modulepart, array('project'))) $backtourl=DOL_URL_ROOT."/projet/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
else if (in_array($modulepart, array('user'))) $backtourl=DOL_URL_ROOT."/user/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
else if (in_array($modulepart, array('societe'))) $backtourl=DOL_URL_ROOT."/societe/document.php?id=".$id.'&file='.urldecode($_POST["file"]); else if (in_array($modulepart, array('societe'))) $backtourl=DOL_URL_ROOT."/societe/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
else if (in_array($modulepart, array('ticketsup'))) $backtourl=DOL_URL_ROOT."/ticketsup/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
else if (in_array($modulepart, array('user'))) $backtourl=DOL_URL_ROOT."/user/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
} }

View File

@ -229,7 +229,7 @@ if ($permission) {
</div> </div>
<div class="tagtd nowrap right"> <div class="tagtd nowrap right">
<?php if ($permission) { ?> <?php if ($permission) { ?>
&nbsp;<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=deletecontact&amp;lineid='.$tab[$i]['rowid']; ?>"><?php echo img_delete(); ?></a> &nbsp;<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=deletecontact&amp;lineid='.$tab[$i]['rowid']; ?>"><?php echo img_picto($langs->trans('Unlink'), 'unlink'); ?></a>
<?php } ?> <?php } ?>
</div> </div>
</form> </form>

View File

@ -58,6 +58,37 @@ if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
$colspan = 3; // Col total ht + col edit + col delete $colspan = 3; // Col total ht + col edit + col delete
if (in_array($object->element,array('propal','commande','order','facture','facturerec','invoice','supplier_proposal','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button if (in_array($object->element,array('propal','commande','order','facture','facturerec','invoice','supplier_proposal','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button
//print $object->element; //print $object->element;
// Lines for extrafield
$objectline = null;
if (!empty($extrafieldsline))
{
if ($this->table_element_line=='commandedet') {
$objectline = new OrderLine($this->db);
}
elseif ($this->table_element_line=='propaldet') {
$objectline = new PropaleLigne($this->db);
}
elseif ($this->table_element_line=='supplier_proposaldet') {
$objectline = new SupplierProposalLine($this->db);
}
elseif ($this->table_element_line=='facturedet') {
$objectline = new FactureLigne($this->db);
}
elseif ($this->table_element_line=='contratdet') {
$objectline = new ContratLigne($this->db);
}
elseif ($this->table_element_line=='commande_fournisseurdet') {
$objectline = new CommandeFournisseurLigne($this->db);
}
elseif ($this->table_element_line=='facture_fourn_det') {
$objectline = new SupplierInvoiceLine($this->db);
}
elseif ($this->table_element_line=='facturedet_rec') {
$objectline = new FactureLigneRec($this->db);
}
}
?> ?>
<!-- BEGIN PHP TEMPLATE objectline_create.tpl.php --> <!-- BEGIN PHP TEMPLATE objectline_create.tpl.php -->
@ -384,40 +415,13 @@ else {
<td class="nobottom linecoledit" align="center" valign="middle" colspan="<?php echo $colspan; ?>"> <td class="nobottom linecoledit" align="center" valign="middle" colspan="<?php echo $colspan; ?>">
<input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline" id="addline"> <input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline" id="addline">
</td> </td>
</tr>
<?php <?php
// Lines for extrafield if (is_object($objectline)) {
if (!empty($extrafieldsline)) print $objectline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay+8), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
{
if ($this->table_element_line=='commandedet') {
$newline = new OrderLine($this->db);
}
elseif ($this->table_element_line=='propaldet') {
$newline = new PropaleLigne($this->db);
}
elseif ($this->table_element_line=='supplier_proposaldet') {
$newline = new SupplierProposalLine($this->db);
}
elseif ($this->table_element_line=='facturedet') {
$newline = new FactureLigne($this->db);
}
elseif ($this->table_element_line=='contratdet') {
$newline = new ContratLigne($this->db);
}
elseif ($this->table_element_line=='commande_fournisseurdet') {
$newline = new CommandeFournisseurLigne($this->db);
}
elseif ($this->table_element_line=='facture_fourn_det') {
$newline = new SupplierInvoiceLine($this->db);
}
elseif ($this->table_element_line=='facturedet_rec') {
$newline = new FactureLigneRec($this->db);
}
if (is_object($newline)) {
print $newline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay+8));
}
} }
?> ?>
</tr>
<?php <?php
if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') // We show date field if required if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') // We show date field if required

View File

@ -240,15 +240,15 @@ $coldisplay=-1; // We remove first td
<input type="submit" class="button" id="savelinebutton" name="save" value="<?php echo $langs->trans("Save"); ?>"><br> <input type="submit" class="button" id="savelinebutton" name="save" value="<?php echo $langs->trans("Save"); ?>"><br>
<input type="submit" class="button" id="cancellinebutton" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>"> <input type="submit" class="button" id="cancellinebutton" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>">
</td> </td>
</tr>
<?php <?php
//Line extrafield //Line extrafield
if (!empty($extrafieldsline)) if (!empty($extrafieldsline))
{ {
print $line->showOptionals($extrafieldsline,'edit',array('style'=>$bc[$var],'colspan'=>$coldisplay)); print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var],'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
} }
?> ?>
</tr>
<?php if (! empty($conf->service->enabled) && $line->product_type == 1 && $dateSelector) { ?> <?php if (! empty($conf->service->enabled) && $line->product_type == 1 && $dateSelector) { ?>
<tr id="service_duration_area" <?php echo $bc[$var]; ?>> <tr id="service_duration_area" <?php echo $bc[$var]; ?>>

View File

@ -154,6 +154,14 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
print (! empty($line->description) && $line->description!=$line->product_label)?'<br>'.dol_htmlentitiesbr($line->description):''; print (! empty($line->description) && $line->description!=$line->product_label)?'<br>'.dol_htmlentitiesbr($line->description):'';
} }
} }
if (! empty($conf->accounting->enabled) && $line->fk_accounting_account > 0)
{
$accountingaccount=new AccountingAccount($this->db);
$accountingaccount->fetch($line->fk_accounting_account);
echo '<div class="clearboth"></div><br><span class="opacitymedium">' . $langs->trans('AccountingAffectation') . ' : </span>' . $accountingaccount->getNomUrl(0,1,1);
}
?> ?>
</td> </td>
<?php <?php
@ -296,13 +304,14 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
<td colspan="3"><?php $coldisplay=$coldisplay+3; ?></td> <td colspan="3"><?php $coldisplay=$coldisplay+3; ?></td>
<?php } ?> <?php } ?>
</tr>
<?php <?php
//Line extrafield //Line extrafield
if (!empty($extrafieldsline)) if (!empty($extrafieldsline))
{ {
print $line->showOptionals($extrafieldsline,'view',array('style'=>$bcdd[$var],'colspan'=>$coldisplay)); print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bcdd[$var],'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
} }
?> ?>
</tr>
<!-- END PHP TEMPLATE objectline_view.tpl.php --> <!-- END PHP TEMPLATE objectline_view.tpl.php -->

View File

@ -593,7 +593,7 @@ if (empty($reshook))
// FROM // FROM
$expediteur = new User($db); $expediteur = new User($db);
$expediteur->fetch($object->fk_user_valid); $expediteur->fetch($object->fk_user_approve > 0 ? $object->fk_user_approve : $object->fk_user_validator);
$emailFrom = $expediteur->email; $emailFrom = $expediteur->email;
if ($emailFrom && $emailTo) if ($emailFrom && $emailTo)

View File

@ -44,7 +44,6 @@ class ExpenseReport extends CommonObject
public $date_fin; public $date_fin;
var $fk_user_validator;
var $status; var $status;
var $fk_statut; // -- 0=draft, 2=validated (attente approb), 4=canceled, 5=approved, 6=payed, 99=denied var $fk_statut; // -- 0=draft, 2=validated (attente approb), 4=canceled, 5=approved, 6=payed, 99=denied
var $fk_c_paiement; var $fk_c_paiement;
@ -78,14 +77,16 @@ class ExpenseReport extends CommonObject
var $detail_cancel; var $detail_cancel;
var $fk_user_cancel; var $fk_user_cancel;
var $fk_user_validator; // User that is defined to approve
// Validation // Validation
var $date_valid; var $date_valid; // User making validation
var $fk_user_valid; var $fk_user_valid;
var $user_valid_infos; var $user_valid_infos;
// Approve // Approve
var $date_approve; var $date_approve;
var $fk_user_approve; var $fk_user_approve; // User that has approved
// Paiement // Paiement
var $user_paid_infos; var $user_paid_infos;
@ -179,6 +180,7 @@ class ExpenseReport extends CommonObject
$sql.= ",date_create"; $sql.= ",date_create";
$sql.= ",fk_user_author"; $sql.= ",fk_user_author";
$sql.= ",fk_user_validator"; $sql.= ",fk_user_validator";
$sql.= ",fk_user_approve";
$sql.= ",fk_user_modif"; $sql.= ",fk_user_modif";
$sql.= ",fk_statut"; $sql.= ",fk_statut";
$sql.= ",fk_c_paiement"; $sql.= ",fk_c_paiement";
@ -196,6 +198,7 @@ class ExpenseReport extends CommonObject
$sql.= ", '".$this->db->idate($now)."'"; $sql.= ", '".$this->db->idate($now)."'";
$sql.= ", ".$fuserid; $sql.= ", ".$fuserid;
$sql.= ", ".($this->fk_user_validator > 0 ? $this->fk_user_validator:"null"); $sql.= ", ".($this->fk_user_validator > 0 ? $this->fk_user_validator:"null");
$sql.= ", ".($this->fk_user_approve > 0 ? $this->fk_user_approve:"null");
$sql.= ", ".($this->fk_user_modif > 0 ? $this->fk_user_modif:"null"); $sql.= ", ".($this->fk_user_modif > 0 ? $this->fk_user_modif:"null");
$sql.= ", ".($this->fk_statut > 1 ? $this->fk_statut:0); $sql.= ", ".($this->fk_statut > 1 ? $this->fk_statut:0);
$sql.= ", ".($this->modepaymentid?$this->modepaymentid:"null"); $sql.= ", ".($this->modepaymentid?$this->modepaymentid:"null");
@ -386,6 +389,7 @@ class ExpenseReport extends CommonObject
} }
$sql.= " , fk_user_validator = ".($this->fk_user_validator > 0 ? $this->fk_user_validator:"null"); $sql.= " , fk_user_validator = ".($this->fk_user_validator > 0 ? $this->fk_user_validator:"null");
$sql.= " , fk_user_valid = ".($this->fk_user_valid > 0 ? $this->fk_user_valid:"null"); $sql.= " , fk_user_valid = ".($this->fk_user_valid > 0 ? $this->fk_user_valid:"null");
$sql.= " , fk_user_approve = ".($this->fk_user_approve > 0 ? $this->fk_user_approve:"null");
$sql.= " , fk_user_modif = ".$user->id; $sql.= " , fk_user_modif = ".$user->id;
$sql.= " , fk_statut = ".($this->fk_statut >= 0 ? $this->fk_statut:'0'); $sql.= " , fk_statut = ".($this->fk_statut >= 0 ? $this->fk_statut:'0');
$sql.= " , fk_c_paiement = ".($this->fk_c_paiement > 0 ? $this->fk_c_paiement:"null"); $sql.= " , fk_c_paiement = ".($this->fk_c_paiement > 0 ? $this->fk_c_paiement:"null");
@ -495,7 +499,8 @@ class ExpenseReport extends CommonObject
$this->user_author_infos = dolGetFirstLastname($user_author->firstname, $user_author->lastname); $this->user_author_infos = dolGetFirstLastname($user_author->firstname, $user_author->lastname);
$user_approver = new User($this->db); $user_approver = new User($this->db);
if ($this->fk_user_validator > 0) $user_approver->fetch($this->fk_user_validator); if ($this->fk_user_approve > 0) $user_approver->fetch($this->fk_user_approve);
elseif ($this->fk_user_validator > 0) $user_approver->fetch($this->fk_user_validator); // For backward compatibility
$this->user_validator_infos = dolGetFirstLastname($user_approver->firstname, $user_approver->lastname); $this->user_validator_infos = dolGetFirstLastname($user_approver->firstname, $user_approver->lastname);
$this->fk_statut = $obj->status; $this->fk_statut = $obj->status;
@ -744,9 +749,9 @@ class ExpenseReport extends CommonObject
$this->fk_statut = 5; $this->fk_statut = 5;
$this->fk_user_author = $user->id; $this->fk_user_author = $user->id;
$this->fk_user_validator = $user->id;
$this->fk_user_valid = $user->id; $this->fk_user_valid = $user->id;
$this->fk_user_approve = $user->id; $this->fk_user_approve = $user->id;
$this->fk_user_validator = $user->id;
$this->note_private='Private note'; $this->note_private='Private note';
$this->note_public='SPECIMEN'; $this->note_public='SPECIMEN';

View File

@ -50,6 +50,18 @@ $now=dol_now();
$langs->load("holiday"); $langs->load("holiday");
$childids = $user->getAllChildIds(1);
$cancreate = 0;
if (! empty($user->rights->holiday->write_all)) $cancreate=1;
if (! empty($user->rights->holiday->write) && in_array($fuserid, $childids)) $cancreate=1;
$candelete = 0;
if (! empty($user->rights->holiday->delete)) $candelete=1;
$morefilter = 'AND employee = 1';
if (! empty($conf->global->HOLIDAY_FOR_NON_SALARIES_TOO)) $morefilter = '';
/* /*
* Actions * Actions
@ -61,8 +73,7 @@ if ($action == 'create')
$object = new Holiday($db); $object = new Holiday($db);
// If no right to create a request // If no right to create a request
$fuserid = GETPOST('fuserid','int'); if (! $cancreate)
if (($fuserid == $user->id && empty($user->rights->holiday->write)) || ($fuserid != $user->id && empty($user->rights->holiday->write_all)))
{ {
$error++; $error++;
setEventMessages($langs->trans('CantCreateCP'), null, 'errors'); setEventMessages($langs->trans('CantCreateCP'), null, 'errors');
@ -201,13 +212,11 @@ if ($action == 'update')
$object = new Holiday($db); $object = new Holiday($db);
$object->fetch($id); $object->fetch($id);
$canedit=(($user->id == $object->fk_user && $user->rights->holiday->write) || ($user->id != $object->fk_user && $user->rights->holiday->write_all));
// If under validation // If under validation
if ($object->statut == 1) if ($object->statut == 1)
{ {
// If this is the requestor or has read/write rights // If this is the requestor or has read/write rights
if ($canedit) if ($cancreate)
{ {
$valideur = $_POST['valideur']; $valideur = $_POST['valideur'];
$description = trim($_POST['description']); $description = trim($_POST['description']);
@ -280,13 +289,11 @@ if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes' && $user->rights-
$object = new Holiday($db); $object = new Holiday($db);
$object->fetch($id); $object->fetch($id);
$canedit=(($user->id == $object->fk_user && $user->rights->holiday->write) || ($user->id != $object->fk_user && $user->rights->holiday->write_all));
// If this is a rough draft, approved, canceled or refused // If this is a rough draft, approved, canceled or refused
if ($object->statut == 1 || $object->statut == 4 || $object->statut == 5) if ($object->statut == 1 || $object->statut == 4 || $object->statut == 5)
{ {
// Si l'utilisateur à le droit de lire cette demande, il peut la supprimer // Si l'utilisateur à le droit de lire cette demande, il peut la supprimer
if ($canedit) if ($candelete)
{ {
$result=$object->delete($user); $result=$object->delete($user);
} }
@ -314,10 +321,8 @@ if ($action == 'confirm_send')
$object = new Holiday($db); $object = new Holiday($db);
$object->fetch($id); $object->fetch($id);
$canedit=(($user->id == $object->fk_user && $user->rights->holiday->write) || ($user->id != $object->fk_user && $user->rights->holiday->write_all));
// Si brouillon et créateur // Si brouillon et créateur
if($object->statut == 1 && $canedit) if($object->statut == 1 && $cancreate)
{ {
$object->statut = 2; $object->statut = 2;
@ -615,7 +620,7 @@ if ($action == 'confirm_cancel' && GETPOST('confirm') == 'yes')
$object->fetch($id); $object->fetch($id);
// Si statut en attente de validation et valideur = valideur ou utilisateur, ou droits de faire pour les autres // Si statut en attente de validation et valideur = valideur ou utilisateur, ou droits de faire pour les autres
if (($object->statut == 2 || $object->statut == 3) && ($user->id == $object->fk_validator || $user->id == $object->fk_user || ! empty($user->rights->holiday->write_all))) if (($object->statut == 2 || $object->statut == 3) && ($user->id == $object->fk_validator || in_array($object->fk_user, $childids) || ! empty($user->rights->holiday->write_all)))
{ {
$db->begin(); $db->begin();
@ -814,6 +819,8 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" onsubmit="return valider()" name="demandeCP">'."\n"; print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" onsubmit="return valider()" name="demandeCP">'."\n";
print '<input type="hidden" name="action" value="create" />'."\n"; print '<input type="hidden" name="action" value="create" />'."\n";
if (empty($conf->global->HOLIDAY_HIDE_BALANCE))
{
dol_fiche_head('', '', '', -1); dol_fiche_head('', '', '', -1);
$out=''; $out='';
@ -828,7 +835,11 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
print $out; print $out;
dol_fiche_end(); dol_fiche_end();
}
elseif(! is_numeric($conf->global->HOLIDAY_HIDE_BALANCE))
{
print $langs->trans($conf->global->HOLIDAY_HIDE_BALANCE).'<br>';
}
dol_fiche_head(); dol_fiche_head();
@ -843,10 +854,10 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
print '<td>'; print '<td>';
if (empty($user->rights->holiday->write_all)) if (empty($user->rights->holiday->write_all))
{ {
print $form->select_dolusers($fuserid, 'useridbis', 0, '', 1, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); print $form->select_dolusers(($fuserid?$fuserid:$user->id), 'fuserid', 0, '', 0, 'hierarchyme', '', 0, 0, 0, $morefilter, 0, '', 'maxwidth300');
print '<input type="hidden" name="fuserid" value="'.($fuserid?$fuserid:$user->id).'">'; //print '<input type="hidden" name="fuserid" value="'.($fuserid?$fuserid:$user->id).'">';
} }
else print $form->select_dolusers(GETPOST('fuserid','int')?GETPOST('fuserid','int'):$user->id,'fuserid',0,'',0); else print $form->select_dolusers(GETPOST('fuserid','int')?GETPOST('fuserid','int'):$user->id, 'fuserid', 0, '', 0, '', '', 0, 0, 0, $morefilter, 0, '', 'maxwidth300');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -858,11 +869,11 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
$arraytypeleaves=array(); $arraytypeleaves=array();
foreach($typeleaves as $key => $val) foreach($typeleaves as $key => $val)
{ {
$labeltoshow = $val['label']; $labeltoshow = ($langs->trans($val['code'])!=$val['code'] ? $langs->trans($val['code']) : $val['label']);
$labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')':''); $labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')':'');
$arraytypeleaves[$val['rowid']]=$labeltoshow; $arraytypeleaves[$val['rowid']]=$labeltoshow;
} }
print $form->selectarray('type', $arraytypeleaves, (GETPOST('type')?GETPOST('type'):''), 1); print $form->selectarray('type', $arraytypeleaves, (GETPOST('type','alpha')?GETPOST('type','alpha'):''), 1);
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -878,11 +889,11 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
if (! GETPOST('date_debut_')) { if (! GETPOST('date_debut_')) {
$form->select_date(-1, 'date_debut_', 0, 0, 0, '', 1, 1); $form->select_date(-1, 'date_debut_', 0, 0, 0, '', 1, 1);
} else { } else {
$tmpdate = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year')); $tmpdate = dol_mktime(0, 0, 0, GETPOST('date_debut_month','int'), GETPOST('date_debut_day','int'), GETPOST('date_debut_year','int'));
$form->select_date($tmpdate, 'date_debut_', 0, 0, 0, '', 1, 1); $form->select_date($tmpdate, 'date_debut_', 0, 0, 0, '', 1, 1);
} }
print ' &nbsp; &nbsp; '; print ' &nbsp; &nbsp; ';
print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday')?GETPOST('starthalfday'):'morning')); print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday','alpha')?GETPOST('starthalfday','alpha'):'morning'));
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -897,11 +908,11 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
if (! GETPOST('date_fin_')) { if (! GETPOST('date_fin_')) {
$form->select_date(-1,'date_fin_', 0, 0, 0, '', 1, 1); $form->select_date(-1,'date_fin_', 0, 0, 0, '', 1, 1);
} else { } else {
$tmpdate = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year')); $tmpdate = dol_mktime(0, 0, 0, GETPOST('date_fin_month','int'), GETPOST('date_fin_day','int'), GETPOST('date_fin_year','int'));
$form->select_date($tmpdate,'date_fin_', 0, 0, 0, '', 1, 1); $form->select_date($tmpdate,'date_fin_', 0, 0, 0, '', 1, 1);
} }
print ' &nbsp; &nbsp; '; print ' &nbsp; &nbsp; ';
print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday')?GETPOST('endhalfday'):'afternoon')); print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday','alpha')?GETPOST('endhalfday','alpha'):'afternoon'));
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -909,7 +920,7 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
print '<tr>'; print '<tr>';
print '<td class="fieldrequired">'.$langs->trans("ReviewedByCP").'</td>'; print '<td class="fieldrequired">'.$langs->trans("ReviewedByCP").'</td>';
print '<td>'; print '<td>';
print $form->select_dolusers((GETPOST('valideur')>0?GETPOST('valideur'):$user->fk_user), "valideur", 1, ($user->admin ? '' : array($user->id)), 0, '', 0, 0, 0, 0, '', 0, '', '', 1); // By default, hierarchical parent print $form->select_dolusers((GETPOST('valideur','int')>0?GETPOST('valideur','int'):$user->fk_user), "valideur", 1, ($user->admin ? '' : array($user->id)), 0, '', 0, 0, 0, 0, '', 0, '', '', 1); // By default, hierarchical parent
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -917,7 +928,7 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("DescCP").'</td>'; print '<td>'.$langs->trans("DescCP").'</td>';
print '<td class="tdtop">'; print '<td class="tdtop">';
$doleditor = new DolEditor('description', GETPOST('description'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); $doleditor = new DolEditor('description', GETPOST('description','none'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
print '</td></tr>'; print '</td></tr>';
@ -951,8 +962,6 @@ else
{ {
$object->fetch($id); $object->fetch($id);
$canedit=(($user->id == $object->fk_user && $user->rights->holiday->write) || ($user->id != $object->fk_user && $user->rights->holiday->write_all));
$valideur = new User($db); $valideur = new User($db);
$valideur->fetch($object->fk_validator); $valideur->fetch($object->fk_validator);
@ -999,7 +1008,7 @@ else
} }
// On vérifie si l'utilisateur à le droit de lire cette demande // On vérifie si l'utilisateur à le droit de lire cette demande
if ($canedit) if ($cancreate)
{ {
if ($action == 'delete') if ($action == 'delete')
{ {
@ -1065,6 +1074,7 @@ else
print '<table class="border centpercent">'; print '<table class="border centpercent">';
print '<tbody>'; print '<tbody>';
// User
print '<tr>'; print '<tr>';
print '<td class="titlefield">'.$langs->trans("User").'</td>'; print '<td class="titlefield">'.$langs->trans("User").'</td>';
print '<td>'; print '<td>';
@ -1076,7 +1086,8 @@ else
print '<td>'.$langs->trans("Type").'</td>'; print '<td>'.$langs->trans("Type").'</td>';
print '<td>'; print '<td>';
$typeleaves=$object->getTypes(1,-1); $typeleaves=$object->getTypes(1,-1);
print empty($typeleaves[$object->fk_type]['label']) ? $langs->trans("TypeWasDisabledOrRemoved",$object->fk_type) : $typeleaves[$object->fk_type]['label']; $labeltoshow = (($typeleaves[$object->fk_type]['code'] && $langs->trans($typeleaves[$object->fk_type]['code'])!=$typeleaves[$object->fk_type]['code']) ? $langs->trans($typeleaves[$object->fk_type]['code']) : $typeleaves[$object->fk_type]['label']);
print empty($labeltoshow) ? $langs->trans("TypeWasDisabledOrRemoved",$object->fk_type) : $labeltoshow;
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -1086,7 +1097,7 @@ else
if(!$edit) if(!$edit)
{ {
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')</td>'; print '<td class="nowrap">'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')</td>';
print '<td>'.dol_print_date($object->date_debut,'day'); print '<td>'.dol_print_date($object->date_debut,'day');
print ' &nbsp; &nbsp; '; print ' &nbsp; &nbsp; ';
print '<span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).'</span>'; print '<span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).'</span>';
@ -1096,7 +1107,7 @@ else
else else
{ {
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')</td>'; print '<td class="nowrap">'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')</td>';
print '<td>'; print '<td>';
$form->select_date($object->date_debut,'date_debut_'); $form->select_date($object->date_debut,'date_debut_');
print ' &nbsp; &nbsp; '; print ' &nbsp; &nbsp; ';
@ -1108,7 +1119,7 @@ else
if (!$edit) if (!$edit)
{ {
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')</td>'; print '<td class="nowrap">'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')</td>';
print '<td>'.dol_print_date($object->date_fin,'day'); print '<td>'.dol_print_date($object->date_fin,'day');
print ' &nbsp; &nbsp; '; print ' &nbsp; &nbsp; ';
print '<span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).'</span>'; print '<span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).'</span>';
@ -1118,7 +1129,7 @@ else
else else
{ {
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')</td>'; print '<td class="nowrap">'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')</td>';
print '<td>'; print '<td>';
$form->select_date($object->date_fin,'date_fin_'); $form->select_date($object->date_fin,'date_fin_');
print ' &nbsp; &nbsp; '; print ' &nbsp; &nbsp; ';
@ -1126,6 +1137,7 @@ else
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
// Nb of days
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans('NbUseDaysCP').'</td>'; print '<td>'.$langs->trans('NbUseDaysCP').'</td>';
print '<td>'.num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday).'</td>'; print '<td>'.num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday).'</td>';
@ -1183,7 +1195,10 @@ else
// Validator // Validator
if (!$edit) { if (!$edit) {
print '<tr>'; print '<tr>';
print '<td class="titlefield">'.$langs->trans('ReviewedByCP').'</td>'; print '<td class="titlefield">';
if ($object->statut == 3 || $object->statut == 4) print $langs->trans('ApprovedBy');
else print $langs->trans('ReviewedByCP');
print '</td>';
print '<td>'.$valideur->getNomUrl(-1).'</td>'; print '<td>'.$valideur->getNomUrl(-1).'</td>';
print '</tr>'; print '</tr>';
} else { } else {
@ -1199,10 +1214,10 @@ else
print '<td>'.$langs->trans('DateCreateCP').'</td>'; print '<td>'.$langs->trans('DateCreateCP').'</td>';
print '<td>'.dol_print_date($object->date_create,'dayhour').'</td>'; print '<td>'.dol_print_date($object->date_create,'dayhour').'</td>';
print '</tr>'; print '</tr>';
if ($object->statut == 3) { if ($object->statut == 3 || $object->statut == 4) {
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans('DateValidCP').'</td>'; print '<td>'.$langs->trans('DateValidCP').'</td>';
print '<td>'.dol_print_date($object->date_valid,'dayhour').'</td>'; print '<td>'.dol_print_date($object->date_valid,'dayhour').'</td>'; // warning: date_valid is approval date on holiday module
print '</tr>'; print '</tr>';
} }
if ($object->statut == 4) { if ($object->statut == 4) {
@ -1232,7 +1247,7 @@ else
if ($action == 'edit' && $object->statut == 1) if ($action == 'edit' && $object->statut == 1)
{ {
print '<div align="center">'; print '<div align="center">';
if ($canedit && $object->statut == 1) if ($cancreate && $object->statut == 1)
{ {
print '<input type="submit" value="'.$langs->trans("Save").'" class="button">'; print '<input type="submit" value="'.$langs->trans("Save").'" class="button">';
} }
@ -1247,11 +1262,11 @@ else
print '<div class="tabsAction">'; print '<div class="tabsAction">';
// Boutons d'actions // Boutons d'actions
if ($canedit && $object->statut == 1) if ($cancreate && $object->statut == 1)
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit" class="butAction">'.$langs->trans("EditCP").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit" class="butAction">'.$langs->trans("EditCP").'</a>';
} }
if ($canedit && $object->statut == 1) if ($cancreate && $object->statut == 1) // If draft
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=sendToValidate" class="butAction">'.$langs->trans("Validate").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=sendToValidate" class="butAction">'.$langs->trans("Validate").'</a>';
} }
@ -1260,7 +1275,7 @@ else
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete" class="butActionDelete">'.$langs->trans("DeleteCP").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete" class="butActionDelete">'.$langs->trans("DeleteCP").'</a>';
} }
if ($object->statut == 2) if ($object->statut == 2) // If validated
{ {
if ($user->id == $object->fk_validator) if ($user->id == $object->fk_validator)
{ {
@ -1274,13 +1289,13 @@ else
} }
} }
if (($user->id == $object->fk_validator || $user->id == $object->fk_user || ! empty($user->rights->holiday->write_all)) && ($object->statut == 2 || $object->statut == 3)) // Status validated or approved if (($user->id == $object->fk_validator || in_array($object->fk_user, $childids) || ! empty($user->rights->holiday->write_all)) && ($object->statut == 2 || $object->statut == 3)) // Status validated or approved
{ {
if (($object->date_debut > dol_now()) || $user->admin) print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=cancel" class="butAction">'.$langs->trans("ActionCancelCP").'</a>'; if (($object->date_debut > dol_now()) || $user->admin) print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=cancel" class="butAction">'.$langs->trans("ActionCancelCP").'</a>';
else print '<a href="#" class="butActionRefused" title="'.$langs->trans("HolidayStarted").'">'.$langs->trans("ActionCancelCP").'</a>'; else print '<a href="#" class="butActionRefused" title="'.$langs->trans("HolidayStarted").'">'.$langs->trans("ActionCancelCP").'</a>';
} }
if ($canedit && $object->statut == 4) if ($cancreate && $object->statut == 4)
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=backtodraft" class="butAction">'.$langs->trans("SetToDraft").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=backtodraft" class="butAction">'.$langs->trans("SetToDraft").'</a>';
} }

View File

@ -50,7 +50,7 @@ class Holiday extends CommonObject
var $date_fin=''; // Date end in PHP server TZ var $date_fin=''; // Date end in PHP server TZ
var $date_debut_gmt=''; // Date start in GMT var $date_debut_gmt=''; // Date start in GMT
var $date_fin_gmt=''; // Date end in GMT var $date_fin_gmt=''; // Date end in GMT
var $halfday=''; var $halfday=''; // 0:Full days, 2:Start afternoon end morning, -1:Start afternoon end afternoon, 1:Start morning end morning
var $statut=''; // 1=draft, 2=validated, 3=approved var $statut=''; // 1=draft, 2=validated, 3=approved
var $fk_validator; var $fk_validator;
var $date_valid=''; var $date_valid='';
@ -957,10 +957,11 @@ class Holiday extends CommonObject
/** /**
* Affiche un select HTML des statuts de congés payés * Affiche un select HTML des statuts de congés payés
* *
* @param int $selected int du statut séléctionné par défaut * @param int $selected Id of preselected status
* @return string affiche le select des statuts * @param string $htmlname Name of HTML select field
* @return string Show select of status
*/ */
function selectStatutCP($selected='') { function selectStatutCP($selected='', $htmlname='select_statut') {
global $langs; global $langs;
@ -969,7 +970,7 @@ class Holiday extends CommonObject
$nb = count($name)+1; $nb = count($name)+1;
// Select HTML // Select HTML
$statut = '<select name="select_statut" class="flat">'."\n"; $statut = '<select name="'.$htmlname.'" class="flat">'."\n";
$statut.= '<option value="-1">&nbsp;</option>'."\n"; $statut.= '<option value="-1">&nbsp;</option>'."\n";
// Boucle des statuts // Boucle des statuts

View File

@ -286,7 +286,8 @@ else
{ {
foreach($typeleaves as $key => $val) foreach($typeleaves as $key => $val)
{ {
print_liste_field_titre($val['label'], $_SERVER["PHP_SELF"], '', '', '', 'align="center"'); $labeltype = ($langs->trans($val['code'])!=$val['code']) ? $langs->trans($val['code']) : $langs->trans($val['label']);
print_liste_field_titre($labeltype, $_SERVER["PHP_SELF"], '', '', '', 'align="center"');
} }
} }
else else

View File

@ -48,6 +48,18 @@ $contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'myobjectl
$backtopage = GETPOST('backtopage','alpha'); // Go back to a dedicated page $backtopage = GETPOST('backtopage','alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss','aZ'); // Option for the css output (always '' except when 'print') $optioncss = GETPOST('optioncss','aZ'); // Option for the css output (always '' except when 'print')
$childis = $user->getAllChildIds(1);
// Security check
$socid=0;
if ($user->societe_id > 0) // Protection if external user
{
//$socid = $user->societe_id;
accessforbidden();
}
$result = restrictedArea($user, 'holiday', $id, '');
$id = GETPOST('id','int');
// Load variable for pagination // Load variable for pagination
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha'); $sortfield = GETPOST('sortfield','alpha');
@ -71,19 +83,21 @@ $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search
if (! $sortfield) $sortfield="cp.rowid"; if (! $sortfield) $sortfield="cp.rowid";
if (! $sortorder) $sortorder="DESC"; if (! $sortorder) $sortorder="DESC";
$id = GETPOST('id','int');
$sall = trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); $sall = trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$search_ref = GETPOST('search_ref'); $search_ref = GETPOST('search_ref','alpha');
$month_create = GETPOST('month_create'); $search_day_create = GETPOST('search_day_create','int');
$year_create = GETPOST('year_create'); $search_month_create = GETPOST('search_month_create','int');
$month_start = GETPOST('month_start'); $search_year_create = GETPOST('search_year_create','int');
$year_start = GETPOST('year_start'); $search_day_start = GETPOST('search_day_start','int');
$month_end = GETPOST('month_end'); $search_month_start = GETPOST('search_month_start','int');
$year_end = GETPOST('year_end'); $search_year_start = GETPOST('search_year_start','int');
$search_employee = GETPOST('search_employee'); $search_day_end = GETPOST('search_day_end','int');
$search_valideur = GETPOST('search_valideur'); $search_month_end = GETPOST('search_month_end','int');
$search_statut = GETPOST('select_statut'); $search_year_end = GETPOST('search_year_end','int');
$search_employee = GETPOST('search_employee','int');
$search_valideur = GETPOST('search_valideur','int');
$search_statut = GETPOST('search_statut','int');
$search_type = GETPOST('search_type','int'); $search_type = GETPOST('search_type','int');
// List of fields to search into when doing a "search in all" // List of fields to search into when doing a "search in all"
@ -93,6 +107,7 @@ $fieldstosearchall = array(
'uu.firstname'=>'EmployeeFirstname' 'uu.firstname'=>'EmployeeFirstname'
); );
$childids = $user->getAllChildIds(1);
/* /*
@ -115,12 +130,12 @@ if (empty($reshook))
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{ {
$search_ref=""; $search_ref="";
$month_create=""; $search_month_create="";
$year_create=""; $search_year_create="";
$month_start=""; $search_month_start="";
$year_start=""; $search_year_start="";
$month_end=""; $search_month_end="";
$year_end=""; $search_year_end="";
$search_employee=""; $search_employee="";
$search_valideur=""; $search_valideur="";
$search_statut=""; $search_statut="";
@ -157,9 +172,6 @@ $holiday = new Holiday($db);
$holidaystatic=new Holiday($db); $holidaystatic=new Holiday($db);
$fuser = new User($db); $fuser = new User($db);
$childids = $user->getAllChildIds();
$childids[]=$user->id;
// Update sold // Update sold
$result = $holiday->updateBalance(); $result = $holiday->updateBalance();
@ -178,47 +190,47 @@ if(!empty($search_ref))
} }
// Start date // Start date
if($year_start > 0) { if($search_year_start > 0) {
if($month_start > 0) { if($search_month_start > 0) {
$filter .= " AND (cp.date_debut BETWEEN '".$db->idate(dol_get_first_day($year_start,$month_start,1))."' AND '".$db->idate(dol_get_last_day($year_start,$month_start,1))."')"; $filter .= " AND (cp.date_debut BETWEEN '".$db->idate(dol_get_first_day($search_year_start,$search_month_start,1))."' AND '".$db->idate(dol_get_last_day($search_year_start,$search_month_start,1))."')";
//$filter.= " AND date_format(cp.date_debut, '%Y-%m') = '$year_start-$month_start'"; //$filter.= " AND date_format(cp.date_debut, '%Y-%m') = '$search_year_start-$search_month_start'";
} else { } else {
$filter .= " AND (cp.date_debut BETWEEN '".$db->idate(dol_get_first_day($year_start,1,1))."' AND '".$db->idate(dol_get_last_day($year_start,12,1))."')"; $filter .= " AND (cp.date_debut BETWEEN '".$db->idate(dol_get_first_day($search_year_start,1,1))."' AND '".$db->idate(dol_get_last_day($search_year_start,12,1))."')";
//$filter.= " AND date_format(cp.date_debut, '%Y') = '$year_start'"; //$filter.= " AND date_format(cp.date_debut, '%Y') = '$search_year_start'";
} }
} else { } else {
if($month_start > 0) { if($search_month_start > 0) {
$filter.= " AND date_format(cp.date_debut, '%m') = '".$db->escape($month_start)."'"; $filter.= " AND date_format(cp.date_debut, '%m') = '".$db->escape($search_month_start)."'";
} }
} }
// End date // End date
if($year_end > 0) { if($search_year_end > 0) {
if($month_end > 0) { if($search_month_end > 0) {
$filter .= " AND (cp.date_fin BETWEEN '".$db->idate(dol_get_first_day($year_end,$month_end,1))."' AND '".$db->idate(dol_get_last_day($year_end,$month_end,1))."')"; $filter .= " AND (cp.date_fin BETWEEN '".$db->idate(dol_get_first_day($search_year_end,$search_month_end,1))."' AND '".$db->idate(dol_get_last_day($search_year_end,$search_month_end,1))."')";
//$filter.= " AND date_format(cp.date_fin, '%Y-%m') = '$year_end-$month_end'"; //$filter.= " AND date_format(cp.date_fin, '%Y-%m') = '$search_year_end-$search_month_end'";
} else { } else {
$filter .= " AND (cp.date_fin BETWEEN '".$db->idate(dol_get_first_day($year_end,1,1))."' AND '".$db->idate(dol_get_last_day($year_end,12,1))."')"; $filter .= " AND (cp.date_fin BETWEEN '".$db->idate(dol_get_first_day($search_year_end,1,1))."' AND '".$db->idate(dol_get_last_day($search_year_end,12,1))."')";
//$filter.= " AND date_format(cp.date_fin, '%Y') = '$year_end'"; //$filter.= " AND date_format(cp.date_fin, '%Y') = '$search_year_end'";
} }
} else { } else {
if($month_end > 0) { if($search_month_end > 0) {
$filter.= " AND date_format(cp.date_fin, '%m') = '".$db->escape($month_end)."'"; $filter.= " AND date_format(cp.date_fin, '%m') = '".$db->escape($search_month_end)."'";
} }
} }
// Create date // Create date
if($year_create > 0) { if($search_year_create > 0) {
if($month_create > 0) { if($search_month_create > 0) {
$filter .= " AND (cp.date_create BETWEEN '".$db->idate(dol_get_first_day($year_create,$month_create,1))."' AND '".$db->idate(dol_get_last_day($year_create,$month_create,1))."')"; $filter .= " AND (cp.date_create BETWEEN '".$db->idate(dol_get_first_day($search_year_create,$search_month_create,1))."' AND '".$db->idate(dol_get_last_day($search_year_create,$search_month_create,1))."')";
//$filter.= " AND date_format(cp.date_create, '%Y-%m') = '$year_create-$month_create'"; //$filter.= " AND date_format(cp.date_create, '%Y-%m') = '$search_year_create-$search_month_create'";
} else { } else {
$filter .= " AND (cp.date_create BETWEEN '".$db->idate(dol_get_first_day($year_create,1,1))."' AND '".$db->idate(dol_get_last_day($year_create,12,1))."')"; $filter .= " AND (cp.date_create BETWEEN '".$db->idate(dol_get_first_day($search_year_create,1,1))."' AND '".$db->idate(dol_get_last_day($search_year_create,12,1))."')";
//$filter.= " AND date_format(cp.date_create, '%Y') = '$year_create'"; //$filter.= " AND date_format(cp.date_create, '%Y') = '$search_year_create'";
} }
} else { } else {
if($month_create > 0) { if($search_month_create > 0) {
$filter.= " AND date_format(cp.date_create, '%m') = '".$db->escape($month_create)."'"; $filter.= " AND date_format(cp.date_create, '%m') = '".$db->escape($search_month_create)."'";
} }
} }
@ -289,9 +301,23 @@ $num = count($holiday->holiday);
$arrayofselected=is_array($toselect)?$toselect:array(); $arrayofselected=is_array($toselect)?$toselect:array();
$param=''; $param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
if ($search_day_create) $param.='&search_day_create='.urlencode($search_day_create);
if ($search_month_create) $param.='&search_month_create='.urlencode($search_month_create);
if ($search_year_create) $param.='&search_year_create='.urlencode($search_year_create);
if ($search_search_day_start) $param.='&search_day_start='.urlencode($search_day_start);
if ($search_month_start) $param.='&search_month_start='.urlencode($search_month_start);
if ($search_year_start) $param.='&search_year_start='.urlencode($search_year_start);
if ($search_day_end) $param.='&search_day_end='.urlencode($search_day_end);
if ($search_month_end) $param.='&search_month_end='.urlencode($search_month_end);
if ($search_year_end) $param.='&search_year_end='.urlencode($search_year_end);
if ($search_employee > 0) $param.='&search_employee='.urlencode($search_employee);
if ($search_valideur > 0) $param.='&search_valideur='.urlencode($search_valideur);
if ($search_type > 0) $param.='&search_type='.urlencode($search_type);
if ($search_statut > 0) $param.='&search_statut='.urlencode($search_statut);
// List of mass actions available // List of mass actions available
$arrayofmassactions = array( $arrayofmassactions = array(
@ -380,27 +406,39 @@ print '</td>';
// Create date // Create date
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month_create" value="'.dol_escape_htmltag($month_create).'">'; print '<input class="flat" type="text" size="1" maxlength="2" name="search_month_create" value="'.dol_escape_htmltag($search_month_create).'">';
$formother->select_year($year_create,'year_create',1, $min_year, 0); $formother->select_year($search_year_create,'search_year_create',1, $min_year, 0);
print '</td>'; print '</td>';
$morefilter = 'AND employee = 1';
if (! empty($conf->global->HOLIDAY_FOR_NON_SALARIES_TOO)) $morefilter = '';
// User // User
if ($user->rights->holiday->write_all) $disabled=0;
// If into the tab holiday of a user ($id is set in such a case)
if ($id && ! GETPOSTISSET('search_employee'))
{ {
$search_employee=$id;
$disabled=1;
}
if (! empty($user->rights->holiday->read_all)) // Can see all
{
if (GETPOSTISSET('search_employee')) $search_employee=GETPOST('search_employee','int');
print '<td class="liste_titre maxwidthonsmartphone" align="left">'; print '<td class="liste_titre maxwidthonsmartphone" align="left">';
print $form->select_dolusers($search_employee,"search_employee",1,"",0,'','',0,0,0,'',0,'','maxwidth200'); print $form->select_dolusers($search_employee, "search_employee", 1, "", $disabled, '', '', 0, 0, 0, $morefilter, 0, '', 'maxwidth200');
print '</td>'; print '</td>';
} }
else else
{ {
//print '<td class="liste_titre">&nbsp;</td>'; if (GETPOSTISSET('search_employee')) $search_employee=GETPOST('search_employee','int');
print '<td class="liste_titre maxwidthonsmartphone" align="left">'; print '<td class="liste_titre maxwidthonsmartphone" align="left">';
print $form->select_dolusers($user->id,"search_employee",1,"",1,'','',0,0,0,'',0,'','maxwidth200'); print $form->select_dolusers($search_employee, "search_employee", 1, "", $disabled, 'hierarchyme', '', 0, 0, 0, $morefilter, 0, '', 'maxwidth200');
print '</td>'; print '</td>';
} }
// Approve // Approve
if($user->rights->holiday->write_all) if ($user->rights->holiday->read_all)
{ {
print '<td class="liste_titre maxwidthonsmartphone" align="left">'; print '<td class="liste_titre maxwidthonsmartphone" align="left">';
@ -409,7 +447,7 @@ if($user->rights->holiday->write_all)
$valideurobjects = $validator->listUsersForGroup($excludefilter); $valideurobjects = $validator->listUsersForGroup($excludefilter);
$valideurarray = array(); $valideurarray = array();
foreach($valideurobjects as $val) $valideurarray[$val->id]=$val->id; foreach($valideurobjects as $val) $valideurarray[$val->id]=$val->id;
print $form->select_dolusers($search_valideur,"search_valideur",1,"",0,$valideurarray,'', 0, 0, 0, '', 0, '', 'maxwidth200'); print $form->select_dolusers($search_valideur, "search_valideur", 1, "", 0, $valideurarray, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth200');
print '</td>'; print '</td>';
} }
else else
@ -423,7 +461,7 @@ $typeleaves=$holidaystatic->getTypes(1,-1);
$arraytypeleaves=array(); $arraytypeleaves=array();
foreach($typeleaves as $key => $val) foreach($typeleaves as $key => $val)
{ {
$labeltoshow = $val['label']; $labeltoshow = ($langs->trans($val['code'])!=$val['code'] ? $langs->trans($val['code']) : $val['label']);
//$labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')':''); //$labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')':'');
$arraytypeleaves[$val['rowid']]=$labeltoshow; $arraytypeleaves[$val['rowid']]=$labeltoshow;
} }
@ -435,19 +473,19 @@ print '<td class="liste_titre">&nbsp;</td>';
// Start date // Start date
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month_start" value="'.dol_escape_htmltag($month_start).'">'; print '<input class="flat" type="text" size="1" maxlength="2" name="search_month_start" value="'.dol_escape_htmltag($search_month_start).'">';
$formother->select_year($year_start,'year_start',1, $min_year, $max_year); $formother->select_year($search_year_start,'search_year_start',1, $min_year, $max_year);
print '</td>'; print '</td>';
// End date // End date
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month_end" value="'.dol_escape_htmltag($month_end).'">'; print '<input class="flat" type="text" size="1" maxlength="2" name="search_month_end" value="'.dol_escape_htmltag($search_month_end).'">';
$formother->select_year($year_end,'year_end',1, $min_year, $max_year); $formother->select_year($search_year_end,'search_year_end',1, $min_year, $max_year);
print '</td>'; print '</td>';
// Status // Status
print '<td class="liste_titre maxwidthonsmartphone maxwidth200" align="right">'; print '<td class="liste_titre maxwidthonsmartphone maxwidth200" align="right">';
$holiday->selectStatutCP($search_statut); $holiday->selectStatutCP($search_statut, 'search_statut');
print '</td>'; print '</td>';
// Actions // Actions
@ -464,17 +502,25 @@ print_liste_field_titre("DateCreateCP",$_SERVER["PHP_SELF"],"cp.date_create","",
print_liste_field_titre("Employee",$_SERVER["PHP_SELF"],"cp.fk_user","",$param,'',$sortfield,$sortorder); print_liste_field_titre("Employee",$_SERVER["PHP_SELF"],"cp.fk_user","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("ValidatorCP",$_SERVER["PHP_SELF"],"cp.fk_validator","",$param,'',$sortfield,$sortorder); print_liste_field_titre("ValidatorCP",$_SERVER["PHP_SELF"],"cp.fk_validator","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder); print_liste_field_titre("Type",$_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder);
print_liste_field_titre("Duration",$_SERVER["PHP_SELF"],'','',$pram,'align="right"',$sortfield,$sortorder); print_liste_field_titre("NbUseDaysCPShort",$_SERVER["PHP_SELF"],'','',$pram,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("DateDebCP",$_SERVER["PHP_SELF"],"cp.date_debut","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre("DateDebCP",$_SERVER["PHP_SELF"],"cp.date_debut","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("DateFinCP",$_SERVER["PHP_SELF"],"cp.date_fin","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre("DateFinCP",$_SERVER["PHP_SELF"],"cp.date_fin","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"cp.statut","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"cp.statut","",$param,'align="right"',$sortfield,$sortorder);
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n"; print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],"",'',$param,'align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
print "</tr>\n"; print "</tr>\n";
$listhalfday=array('morning'=>$langs->trans("Morning"),"afternoon"=>$langs->trans("Afternoon")); $listhalfday=array('morning'=>$langs->trans("Morning"),"afternoon"=>$langs->trans("Afternoon"));
// If we ask a dedicated card and not allow to see it, we forc on user.
if ($id && empty($user->rights->holiday->read_all) && ! in_array($id, $childids))
{
$langs->load("errors");
print '<tr class="oddeven opacitymediuem"><td colspan="10">'.$langs->trans("NotEnoughPermissions").'</td></tr>';
$result = 0;
}
// Lines // Lines
if (! empty($holiday->holiday)) elseif (! empty($holiday->holiday))
{ {
$userstatic = new User($db); $userstatic = new User($db);
$approbatorstatic = new User($db); $approbatorstatic = new User($db);
@ -510,13 +556,14 @@ if (! empty($holiday->holiday))
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
print $holidaystatic->getNomUrl(1); print $holidaystatic->getNomUrl(1, 1);
print '</td>'; print '</td>';
print '<td style="text-align: center;">'.dol_print_date($date,'day').'</td>'; print '<td style="text-align: center;">'.dol_print_date($date,'day').'</td>';
print '<td>'.$userstatic->getNomUrl(-1, 'leave').'</td>'; print '<td>'.$userstatic->getNomUrl(-1, 'leave').'</td>';
print '<td>'.$approbatorstatic->getNomUrl(-1).'</td>'; print '<td>'.$approbatorstatic->getNomUrl(-1).'</td>';
print '<td>'; print '<td>';
print empty($typeleaves[$infos_CP['fk_type']]['label']) ? $langs->trans("TypeWasDisabledOrRemoved",$infos_CP['fk_type']) : $typeleaves[$infos_CP['fk_type']]['label']; $labeltypeleavetoshow = ($langs->trans($typeleaves[$infos_CP['fk_type']]['code'])!=$typeleaves[$infos_CP['fk_type']]['code'] ? $langs->trans($typeleaves[$infos_CP['fk_type']]['code']) : $typeleaves[$infos_CP['fk_type']]['label']);
print empty($typeleaves[$infos_CP['fk_type']]['label']) ? $langs->trans("TypeWasDisabledOrRemoved",$infos_CP['fk_type']) : $labeltypeleavetoshow;
print '</td>'; print '</td>';
print '<td align="right">'; print '<td align="right">';
$nbopenedday=num_open_day($infos_CP['date_debut_gmt'], $infos_CP['date_fin_gmt'], 0, 1, $infos_CP['halfday']); $nbopenedday=num_open_day($infos_CP['date_debut_gmt'], $infos_CP['date_fin_gmt'], 0, 1, $infos_CP['halfday']);

View File

@ -0,0 +1,198 @@
<?php
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 François Legastelois <flegastelois@teclib.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file month_report.php
* \ingroup holiday
* \brief Monthly report of leave requests.
*/
require('../main.inc.php');
require_once(DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php');
require_once(DOL_DOCUMENT_ROOT.'/user/class/user.class.php');
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
$langs->loadLangs(array("holiday"));
// Security check
$socid=0;
if ($user->societe_id > 0) // Protection if external user
{
//$socid = $user->societe_id;
accessforbidden();
}
$result = restrictedArea($user, 'holiday', $id, '');
/*
* View
*/
$holidaystatic = new Holiday($db);
$listhalfday=array('morning'=>$langs->trans("Morning"),"afternoon"=>$langs->trans("Afternoon"));
llxHeader('', $langs->trans('CPTitreMenu'));
print_fiche_titre($langs->trans('MenuReportMonth'));
$html = new Form($db);
$formother = new FormOther($db);
// Selection filter
print '<div class="tabBar">';
print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">' . "\n";
$search_month = GETPOST("remonth",'int')?GETPOST("remonth",'int'):date("m", time());
$search_year = GETPOST("reyear",'int')?GETPOST("reyear",'int'):date("Y", time());
$month_year = sprintf("%02d",$search_month).'-'.sprintf("%04d",$search_year);
$year_month = sprintf("%04d",$search_year).'-'.sprintf("%02d",$search_month);
print $formother->select_month($search_month,'remonth');
print $formother->select_year($search_year,'reyear');
print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Search")).'" />';
print '</form>';
$sql = "SELECT cp.rowid, cp.fk_user, cp.date_debut, cp.date_fin, ct.label, cp.description, cp.halfday";
$sql .= " FROM ".MAIN_DB_PREFIX."holiday cp";
$sql .= " LEFT JOIN llx_user u ON cp.fk_user = u.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_holiday_types ct ON cp.fk_type = ct.rowid";
$sql .= " WHERE cp.rowid > 0";
$sql .= " AND cp.statut = 3"; // Approved
$sql .= " AND (date_format(cp.date_debut, '%Y-%m') = '".$db->escape($year_month)."' OR date_format(cp.date_fin, '%Y-%m') = '".$db->escape($year_month)."')";
$sql .= " ORDER BY u.lastname, cp.date_debut";
$resql = $db->query($sql);
if (empty($resql))
{
dol_print_error($db);
exit;
}
$num = $db->num_rows($resql);
print '</div>';
print '<br>';
print '<div class="div-table-responsive">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>' . $langs->trans('Ref') . '</td>';
print '<td>' . $langs->trans('Employee') . '</td>';
print '<td>' . $langs->trans('Type') . '</td>';
print '<td align="center">' . $langs->trans('DateDebCP') . '</td>';
print '<td align="center">' . $langs->trans('DateFinCP') . '</td>';
print '<td align="right">' . $langs->trans('NbUseDaysCPShort') . '</td>';
print '<td align="center">' . $langs->trans('DateStartInMonth') . '</td>';
print '<td align="center">' . $langs->trans('DateEndInMonth') . '</td>';
print '<td align="right">' . $langs->trans('NbUseDaysCPShortInMonth') . '</td>';
print '<td class="maxwidth300">' . $langs->trans('DescCP') . '</td>';
print '</tr>';
if ($num == 0)
{
print '<tr><td colspan="6" class="opacitymedium">'.$langs->trans('None').'</td></tr>';
}
else
{
while ($obj = $db->fetch_object($resql))
{
$user = new User($db);
$user->fetch($obj->fk_user);
$date_start = $db->jdate($obj->date_debut, true);
$date_end = $db->jdate($obj->date_fin, true);
$tmpstart = dol_getdate($date_start);
$tmpend = dol_getdate($date_end);
$starthalfday=($obj->halfday == -1 || $obj->halfday == 2)?'afternoon':'morning';
$endhalfday=($obj->halfday == 1 || $obj->halfday == 2)?'morning':'afternoon';
$halfdayinmonth = $obj->halfday;
$starthalfdayinmonth = $starthalfday;
$endhalfdayinmonth = $endhalfday;
//0:Full days, 2:Start afternoon end morning, -1:Start afternoon end afternoon, 1:Start morning end morning
// Set date_start_gmt and date_end_gmt that are date to show for the selected month
$date_start_inmonth = $db->jdate($obj->date_debut, true);
$date_end_inmonth = $db->jdate($obj->date_fin, true);
if ($tmpstart['year'] < $search_year || $tmpstart['mon'] < $search_month)
{
$date_start_inmonth = dol_get_first_day($search_year, $search_month, true);
$starthalfdayinmonth = 'morning';
if ($halfdayinmonth == 2) $halfdayinmonth=1;
if ($halfdayinmonth == -1) $halfdayinmonth=0;
}
if ($tmpend['year'] > $search_year || $tmpend['mon'] > $search_month)
{
$date_end_inmonth = dol_get_last_day($search_year, $search_month, true) - ((24 * 3600) - 1);
$endhalfdayinmonth = 'afternoon';
if ($halfdayinmonth == 2) $halfdayinmonth=-1;
if ($halfdayinmonth == 1) $halfdayinmonth=0;
}
// Leave request
$holidaystatic->id=$obj->rowid;
$holidaystatic->ref=$obj->rowid;
print '<tr class="oddeven">';
print '<td>';
print $holidaystatic->getNomUrl(1, 1);
print '</td>';
print '<td>' . $user->getFullName($langs) . '</td>';
print '<td>' . $obj->label . '</td>';
print '<td align="center">' . dol_print_date($obj->date_debut, 'day');
print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$starthalfday]).')</span>';
print '</td>';
print '<td align="center">' . dol_print_date($obj->date_fin, 'day');
print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$endhalfday]).')</span>';
print '</td>';
print '<td align="right">' . num_open_day($date_start, $date_end, 0, 1, $obj->halfday) . '</td>';
print '<td align="center">' . dol_print_date($date_start_inmonth, 'day');
print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$starthalfdayinmonth]).')</span>';
print '</td>';
print '<td align="center">' . dol_print_date($date_end_inmonth, 'day');
print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$endhalfdayinmonth]).')</span>';
print '</td>';
print '<td align="right">' . num_open_day($date_start_inmonth, $date_end_inmonth, 0, 1, $halfdayinmonth) . '</td>';
print '<td class="maxwidth300">' . dol_escape_htmltag(dolGetFirstLineOfText($obj->description)) . '</td>';
print '</tr>';
}
}
print '</table>';
print '</div>';
// Fin de page
$db->close();
llxFooter();

View File

@ -117,7 +117,7 @@ foreach($cp->logs as $logs_CP)
print '<td>'.$user_update->getNomUrl(-1).'</td>'; print '<td>'.$user_update->getNomUrl(-1).'</td>';
print '<td>'.$logs_CP['type_action'].'</td>'; print '<td>'.$logs_CP['type_action'].'</td>';
print '<td>'; print '<td>';
$label=$alltypeleaves[$logs_CP['fk_type']]['label']; $label = (($alltypeleaves[$logs_CP['fk_type']]['code'] && $langs->trans($alltypeleaves[$logs_CP['fk_type']]['code'])!=$alltypeleaves[$logs_CP['fk_type']]['code']) ? $langs->trans($alltypeleaves[$logs_CP['fk_type']]['code']) : $alltypeleaves[$logs_CP['fk_type']]['label']);
print $label?$label:$logs_CP['fk_type']; print $label?$label:$logs_CP['fk_type'];
print '</td>'; print '</td>';
print '<td style="text-align: right;">'.price2num($logs_CP['prev_solde'],5).' '.$langs->trans('days').'</td>'; print '<td style="text-align: right;">'.price2num($logs_CP['prev_solde'],5).' '.$langs->trans('days').'</td>';

View File

@ -129,6 +129,8 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
if (! empty($conf->holiday->enabled)) if (! empty($conf->holiday->enabled))
{
if (empty($conf->global->HOLIDAY_HIDE_BALANCE))
{ {
$user_id = $user->id; $user_id = $user->id;
@ -152,6 +154,11 @@ if (! empty($conf->holiday->enabled))
print '</tr>'; print '</tr>';
print '</table><br>'; print '</table><br>';
} }
elseif (! is_numeric($conf->global->HOLIDAY_HIDE_BALANCE))
{
print $langs->trans($conf->global->HOLIDAY_HIDE_BALANCE).'<br>';
}
}
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">'; print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';

View File

@ -189,6 +189,8 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
else else
dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'sha1md5', 'chaine', 0, '', 0); // All entities dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'sha1md5', 'chaine', 0, '', 0); // All entities
} }
dolibarr_install_syslog('step5: DATABASE_PWD_ENCRYPTED = '.$conf->global->DATABASE_PWD_ENCRYPTED.' MAIN_SECURITY_HASH_ALGO = '.$conf->global->MAIN_SECURITY_HASH_ALGO, LOG_INFO);
} }
// Create user used to create the admin user // Create user used to create the admin user

View File

@ -149,7 +149,6 @@ ACCOUNTING_SERVICE_SOLD_ACCOUNT=Accounting account by default for the sold servi
Doctype=Type of document Doctype=Type of document
Docdate=Date Docdate=Date
Docref=Reference Docref=Reference
Code_tiers=Thirdparty
LabelAccount=Label account LabelAccount=Label account
LabelOperation=Label operation LabelOperation=Label operation
Sens=Sens Sens=Sens

View File

@ -837,11 +837,11 @@ Permission1251=Run mass imports of external data into database (data load)
Permission1321=Export customer invoices, attributes and payments Permission1321=Export customer invoices, attributes and payments
Permission1322=Reopen a paid bill Permission1322=Reopen a paid bill
Permission1421=Export customer orders and attributes Permission1421=Export customer orders and attributes
Permission20001=Read leave requests (yours and your subordinates) Permission20001=Read leave requests (your leaves and the one of your subordinates)
Permission20002=Create/modify your leave requests Permission20002=Create/modify your leave requests (yours leaves and the one of your subordinates)
Permission20003=Delete leave requests Permission20003=Delete leave requests
Permission20004=Read all leave requests (even user not subordinates) Permission20004=Read all leave requests (even of user not subordinates)
Permission20005=Create/modify leave requests for everybody Permission20005=Create/modify leave requests for everybody (even of user not subordinates)
Permission20006=Admin leave requests (setup and update balance) Permission20006=Admin leave requests (setup and update balance)
Permission23001=Read Scheduled job Permission23001=Read Scheduled job
Permission23002=Create/update Scheduled job Permission23002=Create/update Scheduled job
@ -1054,6 +1054,7 @@ AreaForAdminOnly=Setup parameters can be set by <b>administrator users</b> only.
SystemInfoDesc=System information is miscellaneous technical information you get in read only mode and visible for administrators only. SystemInfoDesc=System information is miscellaneous technical information you get in read only mode and visible for administrators only.
SystemAreaForAdminOnly=This area is available for administrator users only. None of the Dolibarr permissions can reduce this limit. SystemAreaForAdminOnly=This area is available for administrator users only. None of the Dolibarr permissions can reduce this limit.
CompanyFundationDesc=Edit on this page all known information of the company or foundation you need to manage (For this, click on "Modify" or "Save" button at bottom of page) CompanyFundationDesc=Edit on this page all known information of the company or foundation you need to manage (For this, click on "Modify" or "Save" button at bottom of page)
AccountantDesc=Edit on this page all known information of your accountant/auditor to manage (For this, click on "Modify" or "Save" button at bottom of page)
DisplayDesc=You can choose each parameter related to the Dolibarr look and feel here DisplayDesc=You can choose each parameter related to the Dolibarr look and feel here
AvailableModules=Available app/modules AvailableModules=Available app/modules
ToActivateModule=To activate modules, go on setup Area (Home->Setup->Modules). ToActivateModule=To activate modules, go on setup Area (Home->Setup->Modules).

View File

@ -237,3 +237,4 @@ ErrorBankAccountNotFound=Error: Bank account not found
FiscalPeriod=Accounting period FiscalPeriod=Accounting period
ListSocialContributionAssociatedProject=List of social contributions associated with the project ListSocialContributionAssociatedProject=List of social contributions associated with the project
DeleteFromCat=Remove from accounting group DeleteFromCat=Remove from accounting group
AccountingAffectation=Accounting assignement

View File

@ -39,6 +39,10 @@ TypeOfLeaveId=Type of leave ID
TypeOfLeaveCode=Type of leave code TypeOfLeaveCode=Type of leave code
TypeOfLeaveLabel=Type of leave label TypeOfLeaveLabel=Type of leave label
NbUseDaysCP=Number of days of vacation consumed NbUseDaysCP=Number of days of vacation consumed
NbUseDaysCPShort=Days consumed
NbUseDaysCPShortInMonth=Days consumed in month
DateStartInMonth=Start date in month
DateEndInMonth=End date in month
EditCP=Edit EditCP=Edit
DeleteCP=Delete DeleteCP=Delete
ActionRefuseCP=Refuse ActionRefuseCP=Refuse
@ -67,6 +71,7 @@ DateRefusCP=Date of refusal
DateCancelCP=Date of cancellation DateCancelCP=Date of cancellation
DefineEventUserCP=Assign an exceptional leave for a user DefineEventUserCP=Assign an exceptional leave for a user
addEventToUserCP=Assign leave addEventToUserCP=Assign leave
NotTheAssignedApprover=You are not the assigned approver
MotifCP=Reason MotifCP=Reason
UserCP=User UserCP=User
ErrorAddEventToUserCP=An error occurred while adding the exceptional leave. ErrorAddEventToUserCP=An error occurred while adding the exceptional leave.
@ -91,7 +96,10 @@ LastHolidays=Latest %s leave requests
AllHolidays=All leave requests AllHolidays=All leave requests
HalfDay=Half day HalfDay=Half day
NotTheAssignedApprover=You are not the assigned approver NotTheAssignedApprover=You are not the assigned approver
LEAVE_PAID=Paid vacation
LEAVE_SICK=Sick leave
LEAVE_OTHER=Other leave
LEAVE_PAID_FR=Paid vacation
## Configuration du Module ## ## Configuration du Module ##
LastUpdateCP=Latest automatic update of leaves allocation LastUpdateCP=Latest automatic update of leaves allocation
MonthOfLastMonthlyUpdate=Month of latest automatic update of leaves allocation MonthOfLastMonthlyUpdate=Month of latest automatic update of leaves allocation

View File

@ -185,6 +185,7 @@ ToLink=Link
Select=Select Select=Select
Choose=Choose Choose=Choose
Resize=Resize Resize=Resize
ResizeOrCrop=Resize or Crop
Recenter=Recenter Recenter=Recenter
Author=Author Author=Author
User=User User=User
@ -426,6 +427,7 @@ ActionDoneShort=Finished
ActionUncomplete=Uncomplete ActionUncomplete=Uncomplete
LatestLinkedEvents=Latest %s linked events LatestLinkedEvents=Latest %s linked events
CompanyFoundation=Company/Organization CompanyFoundation=Company/Organization
Accountant=Accountant
ContactsForCompany=Contacts for this third party ContactsForCompany=Contacts for this third party
ContactsAddressesForCompany=Contacts/addresses for this third party ContactsAddressesForCompany=Contacts/addresses for this third party
AddressesForCompany=Addresses for this third party AddressesForCompany=Addresses for this third party

View File

@ -39,7 +39,7 @@ STRIPE_TEST_WEBHOOK_KEY=Webhook test key
STRIPE_LIVE_SECRET_KEY=Secret live key STRIPE_LIVE_SECRET_KEY=Secret live key
STRIPE_LIVE_PUBLISHABLE_KEY=Publishable live key STRIPE_LIVE_PUBLISHABLE_KEY=Publishable live key
STRIPE_LIVE_WEBHOOK_KEY=Webhook live key STRIPE_LIVE_WEBHOOK_KEY=Webhook live key
ONLINE_PAYMENT_WAREHOUSE=Stock to use for stock decrease when payment online payment is done<br>(TODO When option to decrease stock is done on an action on invoice and the online payment generate itself the invoice ?) ONLINE_PAYMENT_WAREHOUSE=Stock to use for stock decrease when online payment is done<br>(TODO When option to decrease stock is done on an action on invoice and the online payment generate itself the invoice ?)
StripeLiveEnabled=Stripe live enabled (otherwise test/sandbox mode) StripeLiveEnabled=Stripe live enabled (otherwise test/sandbox mode)
StripeImportPayment=Import Stripe payments StripeImportPayment=Import Stripe payments
ExampleOfTestCreditCard=Example of credit card for test: %s (valid), %s (error CVC), %s (expired), %s (charge fails) ExampleOfTestCreditCard=Example of credit card for test: %s (valid), %s (error CVC), %s (expired), %s (charge fails)

View File

@ -21,17 +21,17 @@ ListToApprove=Waiting for approval
ExpensesArea=Expense reports area ExpensesArea=Expense reports area
ClassifyRefunded=Classify 'Refunded' ClassifyRefunded=Classify 'Refunded'
ExpenseReportWaitingForApproval=A new expense report has been submitted for approval ExpenseReportWaitingForApproval=A new expense report has been submitted for approval
ExpenseReportWaitingForApprovalMessage=A new expense report has been submitted and is waiting for approval.\n - User: %s\n - Period: %s\nClick here to validate: %s ExpenseReportWaitingForApprovalMessage=A new expense report has been submitted and is waiting for approval.<br> - User: %s<br> - Period: %s<br>Click here to validate: %s
ExpenseReportWaitingForReApproval=An expense report has been submitted for re-approval ExpenseReportWaitingForReApproval=An expense report has been submitted for re-approval
ExpenseReportWaitingForReApprovalMessage=An expense report has been submitted and is waiting for re-approval.\nThe %s, you refused to approve the expense report for this reason: %s.\nA new version has been proposed and waiting for your approval.\n - User: %s\n - Period: %s\nClick here to validate: %s ExpenseReportWaitingForReApprovalMessage=An expense report has been submitted and is waiting for re-approval.<br>The %s, you refused to approve the expense report for this reason: %s.<br>A new version has been proposed and waiting for your approval.<br> - User: %s<br> - Period: %s<br>Click here to validate: %s
ExpenseReportApproved=An expense report was approved ExpenseReportApproved=An expense report was approved
ExpenseReportApprovedMessage=The expense report %s was approved.\n - User: %s\n - Approved by: %s\nClick here to show the expense report: %s ExpenseReportApprovedMessage=The expense report %s was approved.<br> - User: %s<br> - Approved by: %s<br>Click here to show the expense report: %s
ExpenseReportRefused=An expense report was refused ExpenseReportRefused=An expense report was refused
ExpenseReportRefusedMessage=The expense report %s was refused.\n - User: %s\n - Refused by: %s\n - Motive for refusal: %s\nClick here to show the expense report: %s ExpenseReportRefusedMessage=The expense report %s was refused.<br> - User: %s<br> - Refused by: %s<br> - Motive for refusal: %s<br>Click here to show the expense report: %s
ExpenseReportCanceled=An expense report was canceled ExpenseReportCanceled=An expense report was canceled
ExpenseReportCanceledMessage=The expense report %s was canceled.\n - User: %s\n - Canceled by: %s\n - Motive for cancellation: %s\nClick here to show the expense report: %s ExpenseReportCanceledMessage=The expense report %s was canceled.<br> - User: %s<br> - Canceled by: %s<br> - Motive for cancellation: %s<br>Click here to show the expense report: %s
ExpenseReportPaid=An expense report was paid ExpenseReportPaid=An expense report was paid
ExpenseReportPaidMessage=The expense report %s was paid.\n - User: %s\n - Paid by: %s\nClick here to show the expense report: %s ExpenseReportPaidMessage=The expense report %s was paid.<br> - User: %s<br> - Paid by: %s<br>Click here to show the expense report: %s
TripId=Id expense report TripId=Id expense report
AnyOtherInThisListCanValidate=Person to inform for validation. AnyOtherInThisListCanValidate=Person to inform for validation.
TripSociete=Information company TripSociete=Information company

View File

@ -31,6 +31,10 @@ InfosWorkflowCP=Informations du workflow
RequestByCP=Demandée par RequestByCP=Demandée par
TitreRequestCP=Demande de congés TitreRequestCP=Demande de congés
NbUseDaysCP=Nombre de jours de congés consommés NbUseDaysCP=Nombre de jours de congés consommés
NbUseDaysCPShort=Jours consommés
NbUseDaysCPShortInMonth=Jours consommés dans le mois
DateStartInMonth=Start date in month
DateEndInMonth=End date in month
EditCP=Modifier EditCP=Modifier
DeleteCP=Supprimer DeleteCP=Supprimer
ActionRefuseCP=Refuser ActionRefuseCP=Refuser

View File

@ -98,9 +98,9 @@ $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search
if (! $sortfield) $sortfield="t.".key($object->fields); // Set here default search field. By default 1st field in definition. if (! $sortfield) $sortfield="t.".key($object->fields); // Set here default search field. By default 1st field in definition.
if (! $sortorder) $sortorder="ASC"; if (! $sortorder) $sortorder="ASC";
// Protection if external user // Security check
$socid=0; $socid=0;
if ($user->societe_id > 0) if ($user->societe_id > 0) // Protection if external user
{ {
//$socid = $user->societe_id; //$socid = $user->societe_id;
accessforbidden(); accessforbidden();

View File

@ -648,44 +648,12 @@ class Project extends CommonObject
} }
} }
// Fetch tasks
$this->getLinesArray($user);
// Delete tasks // Delete tasks
if (! $error) foreach($this->lines as &$task) {
{ $task->delete($user);
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_task_time";
$sql.= " WHERE fk_task IN (SELECT rowid FROM " . MAIN_DB_PREFIX . "projet_task WHERE fk_projet=" . $this->id . ")";
$resql = $this->db->query($sql);
if (!$resql)
{
$this->errors[] = $this->db->lasterror();
$error++;
}
}
if (! $error)
{
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_task_extrafields";
$sql.= " WHERE fk_object IN (SELECT rowid FROM " . MAIN_DB_PREFIX . "projet_task WHERE fk_projet=" . $this->id . ")";
$resql = $this->db->query($sql);
if (!$resql)
{
$this->errors[] = $this->db->lasterror();
$error++;
}
}
if (! $error)
{
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_task";
$sql.= " WHERE fk_projet=" . $this->id;
$resql = $this->db->query($sql);
if (!$resql)
{
$this->errors[] = $this->db->lasterror();
$error++;
}
} }
// Delete project // Delete project

View File

@ -435,8 +435,8 @@ $arrayofmassactions = array(
// 'builddoc'=>$langs->trans("PDFMerge"), // 'builddoc'=>$langs->trans("PDFMerge"),
); );
//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); //if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
if ($user->rights->societe->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
if ($user->rights->projet->creer) $arrayofmassactions['close']=$langs->trans("Close"); if ($user->rights->projet->creer) $arrayofmassactions['close']=$langs->trans("Close");
if ($user->rights->societe->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -41,17 +41,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php';
// Security check // Security check
// No check on module enabled. Done later according to $validpaymentmethod // No check on module enabled. Done later according to $validpaymentmethod
$langs->load("main"); $langs->loadLangs(array("main","other","dict","bills","companies","errors","paybox")); // File with generic data
$langs->load("other");
$langs->load("dict");
$langs->load("bills");
$langs->load("companies");
$langs->load("errors");
$langs->load("paybox"); // File with generic data
$action=GETPOST('action','aZ09'); $action=GETPOST('action','aZ09');
@ -273,16 +268,17 @@ if ($action == 'dopayment')
$PAYPAL_PAYMENT_TYPE='Sale'; $PAYPAL_PAYMENT_TYPE='Sale';
$origfulltag=GETPOST("fulltag",'alpha'); $origfulltag=GETPOST("fulltag",'alpha');
$shipToName=GETPOST("shipToName"); $shipToName=GETPOST("shipToName",'alpha');
$shipToStreet=GETPOST("shipToStreet"); $shipToStreet=GETPOST("shipToStreet",'alpha');
$shipToCity=GETPOST("shipToCity"); $shipToCity=GETPOST("shipToCity",'alpha');
$shipToState=GETPOST("shipToState"); $shipToState=GETPOST("shipToState",'alpha');
$shipToCountryCode=GETPOST("shipToCountryCode"); $shipToCountryCode=GETPOST("shipToCountryCode",'alpha');
$shipToZip=GETPOST("shipToZip"); $shipToZip=GETPOST("shipToZip",'alpha');
$shipToStreet2=GETPOST("shipToStreet2"); $shipToStreet2=GETPOST("shipToStreet2",'alpha');
$phoneNum=GETPOST("phoneNum"); $phoneNum=GETPOST("phoneNum",'alpha');
$email=GETPOST("email"); $email=GETPOST("email",'alpha');
$desc=GETPOST("desc",'alpha'); $desc=GETPOST("desc",'alpha');
$thirdparty_id=GETPOST('thirdparty_id', 'int');
$mesg=''; $mesg='';
if (empty($PAYPAL_API_PRICE) || ! is_numeric($PAYPAL_API_PRICE)) if (empty($PAYPAL_API_PRICE) || ! is_numeric($PAYPAL_API_PRICE))
@ -347,7 +343,8 @@ if ($action == 'dopayment')
if ($paymentmethod == 'paybox') if ($paymentmethod == 'paybox')
{ {
$PRICE=price2num(GETPOST("newamount"),'MT'); $PRICE=price2num(GETPOST("newamount"),'MT');
$email=GETPOST("email"); $email=GETPOST("email",'alpha');
$thirdparty_id=GETPOST('thirdparty_id', 'int');
$origfulltag=GETPOST("fulltag",'alpha'); $origfulltag=GETPOST("fulltag",'alpha');
@ -388,7 +385,7 @@ if ($action == 'dopayment')
// Called when choosing Stripe mode, after the 'dopayment' // Called when choosing Stripe mode, after the 'dopayment'
if ($action == 'charge') if ($action == 'charge' && ! empty($conf->stripe->enabled))
{ {
$amountstripe = $amount; $amountstripe = $amount;
@ -401,36 +398,112 @@ if ($action == 'charge')
dol_syslog("POST values: ".join(',', $_POST), LOG_DEBUG, 0, '_stripe'); dol_syslog("POST values: ".join(',', $_POST), LOG_DEBUG, 0, '_stripe');
$stripeToken = GETPOST("stripeToken",'alpha'); $stripeToken = GETPOST("stripeToken",'alpha');
$email = GETPOST("stripeEmail",'alpha'); $email = GETPOST("email",'alpha');
$thirdparty_id=GETPOST('thirdparty_id', 'int');
$vatnumber = GETPOST('vatnumber','alpha'); $vatnumber = GETPOST('vatnumber','alpha');
dol_syslog("stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_stripe'); dol_syslog("stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_stripe');
dol_syslog("email = ".$email, LOG_DEBUG, 0, '_stripe'); dol_syslog("email = ".$email, LOG_DEBUG, 0, '_stripe');
dol_syslog("thirdparty_id = ".$thirdparty_id, LOG_DEBUG, 0, '_stripe');
dol_syslog("vatnumber = ".$vatnumber, LOG_DEBUG, 0, '_stripe'); dol_syslog("vatnumber = ".$vatnumber, LOG_DEBUG, 0, '_stripe');
$error = 0; $error = 0;
try { try {
dol_syslog("Create customer card profile", LOG_DEBUG, 0, '_stripe'); $metadata = array(
'dol_version'=>DOL_VERSION,
'dol_entity'=>$conf->entity,
'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])
);
if (! empty($dol_id)) $metadata["dol_id"] = $dol_id;
if (! empty($dol_type)) $metadata["dol_type"] = $dol_type;
if (! empty($thirdparty_id)) $metadata["dol_thirdparty_id"] = $thirdparty_id;
if ($thirdparty_id > 0)
{
dol_syslog("Search existing customer profile for thirdparty_id=".$thirdparty_id, LOG_DEBUG, 0, '_stripe');
$service = 'StripeTest';
$servicestatus = 0;
if (! empty($conf->global->STRIPE_LIVE) && ! GETPOST('forcesandbox','alpha'))
{
$service = 'StripeLive';
$servicestatus = 1;
}
$stripeacc = null; // No Oauth/connect use for public pages
$thirdparty = new Societe($db);
$thirdparty->fetch($thirdparty_id);
include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
$stripe = new Stripe($db);
$customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 1);
$card = $customer->sources->create(array("source" => $stripeToken, "metadata" => $metadata));
if (empty($card))
{
$error++;
dol_syslog('Failed to create card record', LOG_WARNING, 0, '_stripe');
setEventMessages('Failed to create card record', null, 'errors');
$action='';
}
else
{
dol_syslog("Create charge on card ".$card->id, LOG_DEBUG, 0, '_stripe');
$charge = \Stripe\Charge::create(array(
'amount' => price2num($amountstripe, 'MU'),
'currency' => $currency,
'capture' => true, // Charge immediatly
'description' => 'Stripe payment: '.$FULLTAG,
'metadata' => array("FULLTAG" => $FULLTAG, 'Recipient' => $mysoc->name, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])),
'customer' => $customer->id,
'source' => $card,
'statement_descriptor' => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$FULLTAG, 22, 'right', 'UTF-8', 1) // 22 chars that appears on bank receipt
));
// Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...)
if (empty($charge))
{
$error++;
dol_syslog('Failed to charge card', LOG_WARNING, 0, '_stripe');
setEventMessages('Failed to charge card', null, 'errors');
$action='';
}
}
}
else
{
dol_syslog("Create anonymous customer card profile", LOG_DEBUG, 0, '_stripe');
$customer = \Stripe\Customer::create(array( $customer = \Stripe\Customer::create(array(
'email' => $email, 'email' => $email,
'description' => ($email?'Customer card profile for '.$email:null), 'description' => ($email?'Anonymous customer for '.$email:'Anonymous customer'),
'metadata' => array('ipaddress'=>$_SERVER['REMOTE_ADDR']), 'metadata' => $metadata,
'business_vat_id' => ($vatnumber?$vatnumber:null), 'business_vat_id' => ($vatnumber?$vatnumber:null),
'source' => $stripeToken // source can be a token OR array('object'=>'card', 'exp_month'=>xx, 'exp_year'=>xxxx, 'number'=>xxxxxxx, 'cvc'=>xxx, 'name'=>'Cardholder's full name', zip ?) 'source' => $stripeToken // source can be a token OR array('object'=>'card', 'exp_month'=>xx, 'exp_year'=>xxxx, 'number'=>xxxxxxx, 'cvc'=>xxx, 'name'=>'Cardholder's full name', zip ?)
)); ));
// Return $customer = array('id'=>'cus_XXXX', ...) // Return $customer = array('id'=>'cus_XXXX', ...)
// The customer was just created with a source, so we can make a charge
// with no card defined, the source just used for customer creation will be used.
dol_syslog("Create charge", LOG_DEBUG, 0, '_stripe'); dol_syslog("Create charge", LOG_DEBUG, 0, '_stripe');
$charge = \Stripe\Charge::create(array( $charge = \Stripe\Charge::create(array(
'customer' => $customer->id, 'customer' => $customer->id,
'amount' => price2num($amountstripe, 'MU'), 'amount' => price2num($amountstripe, 'MU'),
'currency' => $currency, 'currency' => $currency,
'capture' => true, // Charge immediatly
'description' => 'Stripe payment: '.$FULLTAG, 'description' => 'Stripe payment: '.$FULLTAG,
'metadata' => array("FULLTAG" => $FULLTAG, 'Recipient' => $mysoc->name), 'metadata' => array("FULLTAG" => $FULLTAG, 'Recipient' => $mysoc->name, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])),
'statement_descriptor' => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$FULLTAG, 22, 'right', 'UTF-8', 1) // 22 chars that appears on bank receipt 'statement_descriptor' => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$FULLTAG, 22, 'right', 'UTF-8', 1) // 22 chars that appears on bank receipt
)); ));
// Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...) // Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...)
if (empty($charge))
{
$error++;
dol_syslog('Failed to charge card', LOG_WARNING, 0, '_stripe');
setEventMessages('Failed to charge card', null, 'errors');
$action='';
}
}
} catch(\Stripe\Error\Card $e) { } catch(\Stripe\Error\Card $e) {
// Since it's a decline, \Stripe\Error\Card will be caught // Since it's a decline, \Stripe\Error\Card will be caught
$body = $e->getJsonBody(); $body = $e->getJsonBody();
@ -444,8 +517,8 @@ if ($action == 'charge')
print('Message is:' . $err['message'] . "\n"); print('Message is:' . $err['message'] . "\n");
$error++; $error++;
setEventMessages($e->getMessage(), null, 'errors');
dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe'); dol_syslog($e->getMessage(), LOG_WARNING, 0, '_stripe');
setEventMessages($e->getMessage(), null, 'errors');
$action=''; $action='';
} catch (\Stripe\Error\RateLimit $e) { } catch (\Stripe\Error\RateLimit $e) {
// Too many requests made to the API too quickly // Too many requests made to the API too quickly
@ -794,6 +867,7 @@ if ($source == 'order')
{ {
print '<!-- Shipping address not complete, so we don t use it -->'."\n"; print '<!-- Shipping address not complete, so we don t use it -->'."\n";
} }
print '<input type="hidden" name="thirdparty_id" value="'.$order->thirdparty->id.'">'."\n";
print '<input type="hidden" name="email" value="'.$order->thirdparty->email.'">'."\n"; print '<input type="hidden" name="email" value="'.$order->thirdparty->email.'">'."\n";
print '<input type="hidden" name="vatnumber" value="'.$order->thirdparty->tva_intra.'">'."\n"; print '<input type="hidden" name="vatnumber" value="'.$order->thirdparty->tva_intra.'">'."\n";
$labeldesc=$langs->trans("Order").' '.$order->ref; $labeldesc=$langs->trans("Order").' '.$order->ref;
@ -928,6 +1002,7 @@ if ($source == 'invoice')
{ {
print '<!-- Shipping address not complete, so we don t use it -->'."\n"; print '<!-- Shipping address not complete, so we don t use it -->'."\n";
} }
print '<input type="hidden" name="thirdparty_id" value="'.$invoice->thirdparty->id.'">'."\n";
print '<input type="hidden" name="email" value="'.$invoice->thirdparty->email.'">'."\n"; print '<input type="hidden" name="email" value="'.$invoice->thirdparty->email.'">'."\n";
print '<input type="hidden" name="vatnumber" value="'.$invoice->thirdparty->tva_intra.'">'."\n"; print '<input type="hidden" name="vatnumber" value="'.$invoice->thirdparty->tva_intra.'">'."\n";
$labeldesc=$langs->trans("Invoice").' '.$invoice->ref; $labeldesc=$langs->trans("Invoice").' '.$invoice->ref;
@ -1135,6 +1210,7 @@ if ($source == 'contractline')
{ {
print '<!-- Shipping address not complete, so we don t use it -->'."\n"; print '<!-- Shipping address not complete, so we don t use it -->'."\n";
} }
print '<input type="hidden" name="thirdparty_id" value="'.$contract->thirdparty->id.'">'."\n";
print '<input type="hidden" name="email" value="'.$contract->thirdparty->email.'">'."\n"; print '<input type="hidden" name="email" value="'.$contract->thirdparty->email.'">'."\n";
print '<input type="hidden" name="vatnumber" value="'.$contract->thirdparty->tva_intra.'">'."\n"; print '<input type="hidden" name="vatnumber" value="'.$contract->thirdparty->tva_intra.'">'."\n";
$labeldesc=$langs->trans("Contract").' '.$contract->ref; $labeldesc=$langs->trans("Contract").' '.$contract->ref;
@ -1438,6 +1514,8 @@ if (preg_match('/^dopayment/',$action))
print '<input type="hidden" name="amount" value="'.$amount.'">'."\n"; print '<input type="hidden" name="amount" value="'.$amount.'">'."\n";
print '<input type="hidden" name="currency" value="'.$currency.'">'."\n"; print '<input type="hidden" name="currency" value="'.$currency.'">'."\n";
print '<input type="hidden" name="forcesandbox" value="'.GETPOST('forcesandbox','alpha').'" />'; print '<input type="hidden" name="forcesandbox" value="'.GETPOST('forcesandbox','alpha').'" />';
print '<input type="hidden" name="email" value="'.GETPOST('email','alpha').'" />';
print '<input type="hidden" name="thirdparty_id" value="'.GETPOST('thirdparty_id','int').'" />';
print ' print '
<table id="dolpaymenttable" summary="Payment form" class="center"> <table id="dolpaymenttable" summary="Payment form" class="center">

View File

@ -219,7 +219,7 @@ if ($action == 'charge')
dol_syslog("POST values: ".join(',', $_POST), LOG_DEBUG, 0, '_stripe'); dol_syslog("POST values: ".join(',', $_POST), LOG_DEBUG, 0, '_stripe');
$stripeToken = GETPOST("stripeToken",'alpha'); $stripeToken = GETPOST("stripeToken",'alpha');
$email = GETPOST("stripeEmail",'alpha'); $email = GETPOST("email",'alpha');
$vatnumber = GETPOST('vatnumber','alpha'); $vatnumber = GETPOST('vatnumber','alpha');
dol_syslog("stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_stripe'); dol_syslog("stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_stripe');
@ -1149,6 +1149,8 @@ if (preg_match('/^dopayment/',$action))
print '<input type="hidden" name="amount" value="'.$amount.'">'."\n"; print '<input type="hidden" name="amount" value="'.$amount.'">'."\n";
print '<input type="hidden" name="currency" value="'.$currency.'">'."\n"; print '<input type="hidden" name="currency" value="'.$currency.'">'."\n";
print '<input type="hidden" name="forcesandbox" value="'.GETPOST('forcesandbox','alpha').'" />'; print '<input type="hidden" name="forcesandbox" value="'.GETPOST('forcesandbox','alpha').'" />';
print '<input type="hidden" name="email" value="'.GETPOST('email','alpha').'" />';
print '<input type="hidden" name="thirdparty_id" value="'.GETPOST('thirdparty_id','int').'" />';
print ' print '
<table id="dolpaymenttable" summary="Payment form" class="center"> <table id="dolpaymenttable" summary="Payment form" class="center">

View File

@ -46,11 +46,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$langs->load("companies"); $langs->loadLangs(array("companies","commercial","bills","banks","users"));
$langs->load("commercial");
$langs->load("bills");
$langs->load("banks");
$langs->load("users");
if (! empty($conf->categorie->enabled)) $langs->load("categories"); if (! empty($conf->categorie->enabled)) $langs->load("categories");
if (! empty($conf->incoterm->enabled)) $langs->load("incoterm"); if (! empty($conf->incoterm->enabled)) $langs->load("incoterm");
if (! empty($conf->notification->enabled)) $langs->load("mails"); if (! empty($conf->notification->enabled)) $langs->load("mails");

View File

@ -278,7 +278,9 @@ input.select2-input {
.liste_titre input[name=month_date_when], .liste_titre input[name=monthvalid], .liste_titre input[name=search_ordermonth], .liste_titre input[name=search_deliverymonth], .liste_titre input[name=month_date_when], .liste_titre input[name=monthvalid], .liste_titre input[name=search_ordermonth], .liste_titre input[name=search_deliverymonth],
.liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre select[name=month], .liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre select[name=month],
.liste_titre input[name=month_lim], .liste_titre input[name=month_start], .liste_titre input[name=month_end], .liste_titre input[name=month_create], .liste_titre input[name=month_lim], .liste_titre input[name=month_start], .liste_titre input[name=month_end], .liste_titre input[name=month_create],
.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_month_create], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end]
{
margin-right: 4px; margin-right: 4px;
} }
input[type=submit] { input[type=submit] {

View File

@ -291,7 +291,9 @@ textarea.cke_source:focus
.liste_titre input[name=month_date_when], .liste_titre input[name=monthvalid], .liste_titre input[name=search_ordermonth], .liste_titre input[name=search_deliverymonth], .liste_titre input[name=month_date_when], .liste_titre input[name=monthvalid], .liste_titre input[name=search_ordermonth], .liste_titre input[name=search_deliverymonth],
.liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month],
.liste_titre input[name=month_lim], .liste_titre input[name=month_start], .liste_titre input[name=month_end], .liste_titre input[name=month_create], .liste_titre input[name=month_lim], .liste_titre input[name=month_start], .liste_titre input[name=month_end], .liste_titre input[name=month_create],
.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_month_create], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end]
{
margin-right: 4px; margin-right: 4px;
} }
input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select {

View File

@ -33,12 +33,10 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT . "/core/lib/company.lib.php"; require_once DOL_DOCUMENT_ROOT . "/core/lib/company.lib.php";
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
$langs->load("companies"); $langs->loadLangs(array("companies","other","ticketsup"));
$langs->load('other');
$langs->load("ticketsup");
$action = GETPOST('action'); $action = GETPOST('action','alpha');
$confirm = GETPOST('confirm'); $confirm = GETPOST('confirm','alpha');
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$track_id = GETPOST('track_id', 'alpha'); $track_id = GETPOST('track_id', 'alpha');
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
@ -61,7 +59,6 @@ $pagenext = $page + 1;
if (!$sortorder) { if (!$sortorder) {
$sortorder = "ASC"; $sortorder = "ASC";
} }
if (!$sortfield) { if (!$sortfield) {
$sortfield = "name"; $sortfield = "name";
} }
@ -75,22 +72,22 @@ $object->ref = $object->track_id;
if ($result < 0) { if ($result < 0) {
setEventMessage($object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} else { } else {
$upload_dir = $conf->ticketsup->dir_output . "/" . dol_sanitizeFileName($object->track_id); $upload_dir = $conf->ticketsup->dir_output . "/" . dol_sanitizeFileName($object->track_id);
} }
/* /*
* Actions * Actions
*/ */
// Included file moved into Dolibarr 4, keep it for compatibility
$res=@include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
if (! $res) {
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
}
$object->ref = $old_ref; $object->ref = $old_ref;
/* /*
* View * View
*/ */
@ -155,10 +152,12 @@ if ($object->id) {
foreach ($filearray as $key => $file) { foreach ($filearray as $key => $file) {
$totalsize += $file['size']; $totalsize += $file['size'];
} }
// For compatibility we use track ID for directory // For compatibility we use track ID for directory
$object->ref = $object->track_id; $object->ref = $object->track_id;
$modulepart = 'ticketsup'; $modulepart = 'ticketsup';
$permission = $user->rights->ticketsup->write; $permission = $user->rights->ticketsup->write;
$permtoedit = $user->rights->ticketsup->write;
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';

View File

@ -460,7 +460,7 @@ else
if (! empty($user->admin)) if (! empty($user->admin))
{ {
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=removeuser&amp;user='.$useringroup->id.'">'; print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=removeuser&amp;user='.$useringroup->id.'">';
print img_delete($langs->trans("RemoveFromGroup")); print img_picto($langs->trans("RemoveFromGroup"), 'unlink');
print '</a>'; print '</a>';
} }
else else