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

This commit is contained in:
Laurent Destailleur 2019-06-05 08:17:28 +02:00
commit c200ec22da
62 changed files with 316 additions and 328 deletions

View File

@ -128,6 +128,7 @@ NEW: Upgrade jquery lib to 3.3.1
NEW: Add hook 'addHtmlHeader()'
NEW: Add hook 'createRecurringInvoices()'
NEW: Add hook 'afterSelectContactOptions'
NEW: Add hook 'getAccessForbiddenMessage'
NEW: Add hook support in accountancy index
NEW: Add hook support in list of template invoices
NEW: Add parameter 'replaceambiguouschars' on getRandomPassword function

View File

@ -447,11 +447,11 @@ $listofformat=AccountancyExport::getType();
if (count($filter)) $buttonLabel = $langs->trans("ExportFilteredList");
else $buttonLabel = $langs->trans("ExportList");
$newcardbutton = dolGetButtonTitle($buttonLabel, '', 'fa fa-file-export', $_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:''));
$newcardbutton = dolGetButtonTitle($buttonLabel, '', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:''));
$newcardbutton.= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-object-group', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param);
$newcardbutton.= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param);
$newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle', './card.php?action=create');
$newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create');
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit);

View File

@ -256,8 +256,8 @@ if ($action == 'delbookkeepingyear') {
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
$newcardbutton.= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
$newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle', './card.php?action=create');
$newcardbutton.= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
$newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create');
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);

View File

@ -143,9 +143,9 @@ $textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_cur
print load_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
print $langs->trans("DescVentilCustomer") . '<br>';
print '<span class="opacitymedium">'.$langs->trans("DescVentilCustomer") . '<br>';
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
print '<br>';
print '</span><br>';
$y = $year_current;

View File

@ -294,7 +294,7 @@ if ($result) {
print '<input type="hidden" name="page" value="'.$page.'">';
print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
print $langs->trans("DescVentilDoneCustomer") . '<br>';
print '<span class="opacitymedium">'.$langs->trans("DescVentilDoneCustomer") . '</span><br>';
print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle');

View File

@ -356,7 +356,7 @@ if ($result) {
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
print $langs->trans("DescVentilTodoCustomer") . '</br><br>';
print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoCustomer") . '</span></br><br>';
/*$topicmail="Information";
$modelmail="project";

View File

@ -139,9 +139,9 @@ $textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_cur
print load_fiche_titre($langs->trans("ExpenseReportsVentilation") . "&nbsp;" . $textprevyear . "&nbsp;" . $langs->trans("Year") . "&nbsp;" . $year_start . "&nbsp;" . $textnextyear, '', 'title_accountancy');
print $langs->trans("DescVentilExpenseReport") . '<br>';
print '<span class="opacitymedium">'.$langs->trans("DescVentilExpenseReport") . '<br>';
print $langs->trans("DescVentilExpenseReportMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
print '<br>';
print '</span><br>';
$y = $year_current;

View File

@ -248,7 +248,7 @@ if ($result) {
print_barre_liste($langs->trans("ExpenseReportLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
print $langs->trans("DescVentilDoneExpenseReport") . '<br>';
print '<span class="opacitymedium">'.$langs->trans("DescVentilDoneExpenseReport") . '</span><br>';
print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle');

View File

@ -289,7 +289,7 @@ if ($result) {
print_barre_liste($langs->trans("ExpenseReportLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
print $langs->trans("DescVentilTodoExpenseReport") . '</br><br>';
print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoExpenseReport") . '</span></br><br>';
/*$topicmail="Information";
$modelmail="project";

View File

@ -743,6 +743,7 @@ if (empty($action) || $action == 'view') {
// Button to write into Ledger
if (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
print '<br>';
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
}

View File

@ -680,6 +680,7 @@ if (empty($action) || $action == 'view') {
// Button to write into Ledger
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
print '<br>';
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
}

View File

@ -140,9 +140,9 @@ $textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_cur
print load_fiche_titre($langs->trans("SuppliersVentilation") . " " . $textprevyear . "&nbsp;" . $langs->trans("Year") . "&nbsp;" . $year_start . "&nbsp;" . $textnextyear, '', 'title_accountancy');
print $langs->trans("DescVentilSupplier") . '<br>';
print '<span class="opacitymedium">'.$langs->trans("DescVentilSupplier") . '<br>';
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
print '<br>';
print '</span><br>';
$y = $year_current;

View File

@ -297,7 +297,7 @@ if ($result) {
print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
print $langs->trans("DescVentilDoneSupplier") . '<br>';
print '<span class="opacitymedium">'.$langs->trans("DescVentilDoneSupplier") . '</span><br>';
print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle');

View File

@ -355,7 +355,7 @@ if ($result) {
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
print $langs->trans("DescVentilTodoCustomer") . '</br><br>';
print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoCustomer") . '</span></br><br>';
/*$topicmail="Information";
$modelmail="project";

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2017 Philippe Grand <philippe.grand@atoo-net.com>
@ -588,9 +588,8 @@ if ($action == 'edit' || $action == 'updateedit')
print '<td class="titlefield">'.$langs->trans("FiscalYearInformation").'</td><td>'.$langs->trans("Value").'</td>';
print "</tr>\n";
print '<tr class="oddeven"><td><label for="SOCIETE_FISCAL_MONTH_START">'.$langs->trans("FiscalMonthStart").'</label></td><td>';
print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START, 'SOCIETE_FISCAL_MONTH_START', 0, 1) . '</td></tr>';
print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START, 'SOCIETE_FISCAL_MONTH_START', 0, 1, 'maxwidth100') . '</td></tr>';
print "</table>";

View File

@ -48,6 +48,17 @@ if (! empty($conf->syslog->enabled))
*/
if ($action=='purge' && ! preg_match('/^confirm/i', $choice) && ($choice != 'allfiles' || $confirm == 'yes') )
{
// Increase limit of time. Works only if we are not in safe mode
$ExecTimeLimit=600;
if (!empty($ExecTimeLimit))
{
$err=error_reporting();
error_reporting(0); // Disable all errors
//error_reporting(E_ALL);
@set_time_limit($ExecTimeLimit); // Need more than 240 on Windows 7/64
error_reporting($err);
}
require_once DOL_DOCUMENT_ROOT.'/core/class/utils.class.php';
$utils = new Utils($db);
$result = $utils->purgeFiles($choice);

View File

@ -145,7 +145,7 @@ if ($object->id)
}
else
{
accessforbidden('', 0, 0);
accessforbidden('', 0, 1);
}
// End of page

View File

@ -143,7 +143,7 @@ if ($object->id)
}
else
{
accessforbidden('', 0, 0);
accessforbidden('', 0, 1);
}
// End of page

View File

@ -41,6 +41,12 @@ class BOM extends CommonObject
*/
public $table_element = 'bom_bom';
/**
* @var string Name of subtable if this object has sub lines
*/
public $table_element_line = 'bom_bomline';
public $fk_element = 'fk_bom';
/**
* @var int Does bom support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
*/
@ -57,9 +63,6 @@ class BOM extends CommonObject
public $picto = 'bom';
public $table_element_line = 'bom_bomline';
const STATUS_DRAFT = 0;
const STATUS_VALIDATED = 1;
const STATUS_CANCELED = 9;
@ -222,7 +225,13 @@ class BOM extends CommonObject
$this->db->begin();
// Load source object
$object->fetchCommon($fromid);
$result = $object->fetchCommon($fromid);
if ($result > 0 && ! empty($object->table_element_line)) $object->fetchLines();
// Get lines so they will be clone
//foreach($object->lines as $line)
// $line->fetch_optionals();
// Reset some properties
unset($object->id);
unset($object->fk_user_creat);
@ -231,7 +240,7 @@ class BOM extends CommonObject
// Clear fields
$object->ref = "copy_of_".$object->ref;
$object->title = $langs->trans("CopyOf")." ".$object->title;
// ...
// Clear extrafields that are unique
if (is_array($object->array_options) && count($object->array_options) > 0)
{
@ -256,6 +265,29 @@ class BOM extends CommonObject
$this->errors = $object->errors;
}
if (! $error)
{
// copy internal contacts
if ($this->copy_linked_contact($object, 'internal') < 0)
{
$error++;
}
}
if (! $error)
{
// copy external contacts if same company
if (property_exists($this, 'socid') && $this->socid == $object->socid)
{
if ($this->copy_linked_contact($object, 'external') < 0)
$error++;
}
}
// If there is lines, create lines too
unset($object->context['createfromclone']);
// End
@ -854,7 +886,7 @@ class BOM extends CommonObject
$this->lines=array();
$objectline = new BOMLine($this->db);
$result = $objectline->fetchAll('', '', 0, 0, array('customsql'=>'fk_bom = '.$this->id));
$result = $objectline->fetchAll('ASC', 'rank', 0, 0, array('customsql'=>'fk_bom = '.$this->id));
if (is_numeric($result))
{
@ -1071,71 +1103,6 @@ class BOMLine extends CommonObject
return $this->createCommon($user, $notrigger);
}
/**
* Clone an object into another one
*
* @param User $user User that creates
* @param int $fromid Id of object to clone
* @return mixed New object created, <0 if KO
*/
public function createFromClone(User $user, $fromid)
{
global $langs, $hookmanager, $extrafields;
$error = 0;
dol_syslog(__METHOD__, LOG_DEBUG);
$object = new self($this->db);
$this->db->begin();
// Load source object
$object->fetchCommon($fromid);
// Reset some properties
unset($object->id);
unset($object->fk_user_creat);
unset($object->import_key);
// Clear fields
$object->ref = "copy_of_".$object->ref;
$object->title = $langs->trans("CopyOf")." ".$object->title;
// ...
// Clear extrafields that are unique
if (is_array($object->array_options) && count($object->array_options) > 0)
{
$extrafields->fetch_name_optionals_label($this->element);
foreach($object->array_options as $key => $option)
{
$shortkey = preg_replace('/options_/', '', $key);
if (! empty($extrafields->attributes[$this->element]['unique'][$shortkey]))
{
//var_dump($key); var_dump($clonedObj->array_options[$key]); exit;
unset($object->array_options[$key]);
}
}
}
// Create clone
$object->context['createfromclone'] = 'createfromclone';
$result = $object->createCommon($user);
if ($result < 0) {
$error++;
$this->error = $object->error;
$this->errors = $object->errors;
}
unset($object->context['createfromclone']);
// End
if (!$error) {
$this->db->commit();
return $object;
} else {
$this->db->rollback();
return -1;
}
}
/**
* Load object in memory from the database
*

View File

@ -57,7 +57,7 @@ $domData .= ' data-qty="'.$line->qty.'"';
$domData .= ' data-product_type="'.$line->product_type.'"';
// Lines for extrafield
$objectline = new BOMLine($this->db);
$objectline = new BOMLine($object->db);
?>
<?php $coldisplay=0; ?>
@ -68,12 +68,9 @@ $objectline = new BOMLine($this->db);
<?php } ?>
<td class="linecoldescription minwidth300imp"><?php $coldisplay++; ?><div id="line_<?php echo $line->id; ?>"></div>
<?php
echo $form->textwithtooltip($text, $description, 3, '', '', $i, 0, (!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):''));
// Add description in form
if (! empty($conf->global->PRODUIT_DESC_IN_FORM))
{
print (! empty($line->description) && $line->description!=$line->product_label)?'<br>'.dol_htmlentitiesbr($line->description):'';
}
$tmpproduct = new Product($object->db);
$tmpproduct->fetch($line->fk_product);
print $tmpproduct->getNomUrl(1);
?>
</td>
<td class="linecolqty nowrap right"><?php $coldisplay++; ?>

View File

@ -65,7 +65,11 @@ $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css')
llxHeader('', $title, '', '', 0, 0, $arrayofjs, $arrayofcss);
$newcardbutton.= dolGetButtonTitle($langs->trans('NewCategory'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/categories/card.php?action=create&type='.$type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type));
$newcardbutton='';
if (! empty($user->rights->categorie->creer)) {
$newcardbutton.= dolGetButtonTitle($langs->trans('NewCategory'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/categories/card.php?action=create&type='.$type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type));
}
print load_fiche_titre($title, $newcardbutton);

View File

@ -321,7 +321,7 @@ if (empty($reshook))
$datep = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$date_delivery = dol_mktime(12, 0, 0, GETPOST('date_livraisonmonth'), GETPOST('date_livraisonday'), GETPOST('date_livraisonyear'));
$duration = GETPOST('duree_validite');
$duration = GETPOST('duree_validite', 'int');
if (empty($datep)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
@ -1622,7 +1622,7 @@ if ($action == 'create')
print '</td></tr>';
// Validaty duration
print '<tr><td class="fieldrequired">' . $langs->trans("ValidityDuration") . '</td><td><input name="duree_validite" size="5" value="' . $conf->global->PROPALE_VALIDITY_DURATION . '"> ' . $langs->trans("days") . '</td></tr>';
print '<tr><td class="fieldrequired">' . $langs->trans("ValidityDuration") . '</td><td><input name="duree_validite" class="width50" value="' . (GETPOST('duree_validite', 'int') ? GETPOST('duree_validite', 'int') : $conf->global->PROPALE_VALIDITY_DURATION) . '"> ' . $langs->trans("days") . '</td></tr>';
// Terms of payment
print '<tr><td class="nowrap">' . $langs->trans('PaymentConditionsShort') . '</td><td>';

View File

@ -1408,8 +1408,9 @@ if (empty($reshook))
{
// Don't add lines with qty 0 when coming from a shipment including all order lines
if($srcobject->element == 'shipping' && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS && $lines[$i]->qty == 0) continue;
// Don't add closed lines when coming from a contract
if($srcobject->element == 'contrat' && $lines[$i]->statut == 5) continue;
// Don't add closed lines when coming from a contract (Set constant to '0,5' to exclude also inactive lines)
if (! isset($conf->global->CONTRACT_EXCLUDE_SERVICES_STATUS_FOR_INVOICE)) $conf->global->CONTRACT_EXCLUDE_SERVICES_STATUS_FOR_INVOICE = '5';
if ($srcobject->element == 'contrat' && in_array($lines[$i]->statut, explode(',', $conf->global->CONTRACT_EXCLUDE_SERVICES_STATUS_FOR_INVOICE))) continue;
$label=(! empty($lines[$i]->label)?$lines[$i]->label:'');
$desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle);
@ -3382,7 +3383,9 @@ elseif ($id > 0 || ! empty($ref))
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
if ($user->societe_id > 0 && $user->societe_id != $object->socid)
accessforbidden('', 0);
{
accessforbidden('', 0, 1);
}
$result = $object->fetch_thirdparty();

View File

@ -848,7 +848,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
*/
if (! GETPOST('action', 'aZ09'))
{
if ($page == -1) $page = 0 ;
if (empty($page) || $page == -1) $page = 0;
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$offset = $limit * $page ;

View File

@ -55,7 +55,7 @@ $result = restrictedArea($user, 'tax', $id, 'chargesociales', 'charges');
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
if ($page == -1) {
if (empty($page) || $page == -1) {
$page = 0;
}
$offset = $conf->liste_limit * $page;

View File

@ -318,7 +318,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
$case = dol_print_date(dol_mktime(1, 1, 1, $mois_modulo, 1, $annee_decalage), "%Y-%m");
$caseprev = dol_print_date(dol_mktime(1, 1, 1, $mois_modulo, 1, $annee_decalage-1), "%Y-%m");
if ($annee >= $year_start)
if ($annee >= $year_start) // We ignore $annee < $year_start, we loop on it to be able to make delta, nothing is output.
{
if ($modecompta == 'CREANCES-DETTES') {
// Valeur CA du mois w/o VAT
@ -386,11 +386,12 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
else { print '&nbsp;'; }
print '</td>';
}
if ($annee_decalage != $year_end) print '<td width="15">&nbsp;</td>';
if ($annee_decalage < $year_end || ($annee_decalage == $year_end && $mois > 12 && $annee < $year_end)) print '<td width="15">&nbsp;</td>';
}
$total_ht[$annee]+=!empty($cum_ht[$case]) ? $cum_ht[$case] : 0;
$total[$annee]+=$cum[$case];
$total_ht[$annee] += ((! empty($cum_ht[$case])) ? $cum_ht[$case] : 0);
$total[$annee] += $cum[$case];
}
print '</tr>';

View File

@ -56,9 +56,10 @@ $result = restrictedArea($user, 'tax', $id, 'vat', 'charges');
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
if ($page == -1) {
if (empty($page) || $page == -1) {
$page = 0;
}
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;

View File

@ -244,7 +244,6 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ! empty($permissiontoadd)
$objectutil = dol_clone($object, 1); // To avoid to denaturate loaded object when setting some properties for clone or if createFromClone modifies the object. We use native clone to keep this->db valid.
//$objectutil->date = dol_mktime(12, 0, 0, GETPOST('newdatemonth', 'int'), GETPOST('newdateday', 'int'), GETPOST('newdateyear', 'int'));
// ...
$result=$objectutil->createFromClone($user, (($object->id > 0) ? $object->id : $id));
if (is_object($result) || $result > 0)
{

View File

@ -563,14 +563,16 @@ if ($massaction == 'confirm_createbills') // Create bills from orders
$objecttmp->socid = $cmd->socid;
$objecttmp->type = Facture::TYPE_STANDARD;
$objecttmp->cond_reglement_id = $cmd->cond_reglement_id;
$objecttmp->mode_reglement_id = $cmd->mode_reglement_id;
$objecttmp->fk_project = $cmd->fk_project;
$objecttmp->cond_reglement_id = $cmd->cond_reglement_id;
$objecttmp->mode_reglement_id = $cmd->mode_reglement_id;
$objecttmp->fk_project = $cmd->fk_project;
$objecttmp->multicurrency_code = $cmd->multicurrency_code;
if (empty($createbills_onebythird)) $objecttmp->ref_client = $cmd->ref_client;
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
$datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($datefacture))
{
$datefacture = dol_mktime(date("h"), date("M"), 0, date("m"), date("d"), date("Y"));
$datefacture = dol_now();
}
$objecttmp->date = $datefacture;

View File

@ -20,6 +20,11 @@
* \file htdocs/core/ajax/row.php
* \brief File to return Ajax response on Row move.
* This ajax page is called when doing an up or down drag and drop.
* Parameters:
* roworder (Example: '1,3,2,4'),
* table_element_line (Example: 'commandedet')
* fk_element (Example: 'fk_order')
* element_id (Example: 1)
*/
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disable token renewal

View File

@ -2443,8 +2443,9 @@ abstract class CommonObject
*/
public function updateRangOfLine($rowid, $rang)
{
$fieldposition = 'rang';
$fieldposition = 'rang'; // @TODO Rename 'rang' and 'position' into 'rank'
if (in_array($this->table_element_line, array('ecm_files', 'emailcollector_emailcollectoraction'))) $fieldposition = 'position';
if (in_array($this->table_element_line, array('bom_bomline'))) $fieldposition = 'rank';
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET '.$fieldposition.' = '.$rang;
$sql.= ' WHERE rowid = '.$rowid;
@ -3886,6 +3887,7 @@ abstract class CommonObject
{
$tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_create.tpl.php';
}
if (empty($conf->file->strict_mode)) {
$res=@include $tpl;
} else {
@ -4086,6 +4088,7 @@ abstract class CommonObject
{
$tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_view.tpl.php';
}
if (empty($conf->file->strict_mode)) {
$res=@include $tpl;
} else {
@ -4116,6 +4119,7 @@ abstract class CommonObject
{
$tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_edit.tpl.php';
}
if (empty($conf->file->strict_mode)) {
$res=@include $tpl;
} else {
@ -4191,9 +4195,10 @@ abstract class CommonObject
* @param CommonObjectLine $line Line
* @param string $var Var
* @param string $restrictlist ''=All lines, 'services'=Restrict to services only (strike line if not)
* @param string $defaulttpldir Directory where to find the template
* @return void
*/
public function printOriginLine($line, $var, $restrictlist = '')
public function printOriginLine($line, $var, $restrictlist = '', $defaulttpldir = '/core/tpl')
{
global $langs, $conf;
@ -4314,7 +4319,7 @@ abstract class CommonObject
// Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer
$dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
$dirtpls=array_merge($conf->modules_parts['tpl'], array($defaulttpldir));
foreach($dirtpls as $module => $reldir)
{
if (!empty($module))
@ -4325,6 +4330,7 @@ abstract class CommonObject
{
$tpl = DOL_DOCUMENT_ROOT.$reldir.'/originproductline.tpl.php';
}
if (empty($conf->file->strict_mode)) {
$res=@include $tpl;
} else {
@ -7245,6 +7251,31 @@ abstract class CommonObject
if ($result < 0) $error++;
}
// Create lines
if (! empty($this->table_element_line) && ! empty($this->fk_element))
{
$num=(is_array($this->lines) ? count($this->lines) : 0);
for ($i = 0; $i < $num; $i++)
{
$line = $this->lines[$i];
$keyforparent = $this->fk_element;
$line->$keyforparent = $this->id;
// Test and convert into object this->lines[$i]. When coming from REST API, we may still have an array
//if (! is_object($line)) $line=json_decode(json_encode($line), false); // convert recursively array into object.
if (! is_object($line)) $line = (object) $line;
$result = $line->create($user, 1);
if ($result < 0)
{
$this->error=$this->db->lasterror();
$this->db->rollback();
return -1;
}
}
}
// Triggers
if (! $error && ! $notrigger)
{

View File

@ -165,11 +165,12 @@ class HookManager
'formattachOptions',
'formBuilddocLineOptions',
'formatNotificationMessage',
'getFormMail',
'getIdProfUrl',
'getAccessForbiddenMessage',
'getDirList',
'getFormatedCustomerRef',
'getFormMail',
'getFormatedCustomerRef',
'getFormatedSupplierRef',
'getIdProfUrl',
'moveUploadedFile',
'moreHtmlStatus',
'pdf_build_address',

View File

@ -5274,10 +5274,10 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart)
/**
* Creation of a directory (this can create recursive subdir)
*
* @param string $dir Directory to create (Separator must be '/'. Example: '/mydir/mysubdir')
* @param string $dataroot Data root directory (To avoid having the data root in the loop. Using this will also lost the warning on first dir PHP has no permission when open_basedir is used)
* @param int $newmask Mask for new file (Defaults to $conf->global->MAIN_UMASK or 0755 if unavailable). Example: '0444'
* @return int < 0 if KO, 0 = already exists, > 0 if OK
* @param string $dir Directory to create (Separator must be '/'. Example: '/mydir/mysubdir')
* @param string $dataroot Data root directory (To avoid having the data root in the loop. Using this will also lost the warning on first dir PHP has no permission when open_basedir is used)
* @param string|null $newmask Mask for new file (Defaults to $conf->global->MAIN_UMASK or 0755 if unavailable). Example: '0444'
* @return int < 0 if KO, 0 = already exists, > 0 if OK
*/
function dol_mkdir($dir, $dataroot = '', $newmask = null)
{

View File

@ -659,7 +659,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
*/
function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $showonlymessage = 0)
{
global $conf, $db, $user, $langs;
global $conf, $db, $user, $langs, $hookmanager;
if (! is_object($langs))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php';
@ -681,14 +681,27 @@ function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $sho
print '<br>';
if (empty($showonlymessage))
{
if ($user->login)
global $action, $object;
if (empty($hookmanager))
{
print $langs->trans("CurrentLogin").': <font class="error">'.$user->login.'</font><br>';
print $langs->trans("ErrorForbidden2", $langs->trans("Home"), $langs->trans("Users"));
$hookmanager = new HookManager($db);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('main'));
}
else
$parameters = array('message'=>$message);
$reshook=$hookmanager->executeHooks('getAccessForbiddenMessage', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
print $hookmanager->resPrint;
if (empty($reshook))
{
print $langs->trans("ErrorForbidden3");
if ($user->login)
{
print $langs->trans("CurrentLogin").': <font class="error">'.$user->login.'</font><br>';
print $langs->trans("ErrorForbidden2", $langs->transnoentitiesnoconv("Home"), $langs->transnoentitiesnoconv("Users"));
}
else
{
print $langs->trans("ErrorForbidden3");
}
}
}
if ($printfooter && function_exists("llxFooter")) llxFooter();

View File

@ -1153,35 +1153,67 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$permtoshowmenu=(! empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire);
//$newmenu->add("/accountancy/index.php?leftmenu=accountancy", $langs->trans("MenuAccountancy"), 0, $permtoshowmenu, '', $mainmenu, 'accountancy');
// Configuration
$newmenu->add("/accountancy/index.php?leftmenu=accountancy_admin", $langs->trans("Setup"), 0, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin', 1);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/', $leftmenu)) {
$newmenu->add("/accountancy/admin/index.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("General"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_general', 10);
// Fiscal year - Not really yet used. In a future will lock some periods.
if ($conf->global->MAIN_FEATURES_LEVEL > 1) {
$newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 1, $user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear', 20);
}
$newmenu->add("/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingJournals"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_journal', 30);
$newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chartmodel', 40);
$newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 41);
$newmenu->add("/accountancy/admin/categories_list.php?id=32&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingCategory"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 50);
$newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 60);
if (! empty($conf->banque->enabled)) {
$newmenu->add("/compta/bank/list.php?mainmenu=accountancy&leftmenu=accountancy_admin&search_status=-1", $langs->trans("MenuBankAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_bank', 70);
}
if (! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled)) {
$newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 80);
}
if (! empty($conf->tax->enabled)) {
$newmenu->add("/admin/dict.php?id=7&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuTaxAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 90);
}
if (! empty($conf->expensereport->enabled)) {
$newmenu->add("/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuExpenseReportAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 100);
}
$newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 110);
$newmenu->add("/accountancy/admin/closure.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuClosureAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_closure', 120);
$newmenu->add("/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ExportOptions"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_export', 130);
}
// Transfer in accounting
$newmenu->add("/accountancy/index.php?leftmenu=accountancy_transfer", $langs->trans("TransferInAccounting"), 0, $user->rights->accounting->bind->write, '', $mainmenu, 'transfer', 1);
// Binding
// $newmenu->add("", $langs->trans("Binding"), 0, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch');
if (! empty($conf->facture->enabled))
{
$newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&amp;mainmenu=accountancy", $langs->trans("CustomersVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_customer');
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_customer/', $leftmenu)) {
$newmenu->add("/accountancy/customer/list.php?mainmenu=accountancy&amp;leftmenu=accountancy_dispatch_customer", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write);
$newmenu->add("/accountancy/customer/lines.php?mainmenu=accountancy&amp;leftmenu=accountancy_dispatch_customer", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write);
}
}
if (! empty($conf->supplier_invoice->enabled))
{
$newmenu->add("/accountancy/supplier/index.php?leftmenu=accountancy_dispatch_supplier&amp;mainmenu=accountancy", $langs->trans("SuppliersVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_supplier');
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_supplier/', $leftmenu)) {
$newmenu->add("/accountancy/supplier/list.php?mainmenu=accountancy&amp;leftmenu=accountancy_dispatch_supplier", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write);
$newmenu->add("/accountancy/supplier/lines.php?mainmenu=accountancy&amp;leftmenu=accountancy_dispatch_supplier", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write);
}
}
if (! empty($conf->expensereport->enabled))
{
$newmenu->add("/accountancy/expensereport/index.php?leftmenu=accountancy_dispatch_expensereport&amp;mainmenu=accountancy", $langs->trans("ExpenseReportsVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_expensereport');
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_expensereport/', $leftmenu)) {
$newmenu->add("/accountancy/expensereport/list.php?mainmenu=accountancy&amp;leftmenu=accountancy_dispatch_expensereport", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write);
$newmenu->add("/accountancy/expensereport/lines.php?mainmenu=accountancy&amp;leftmenu=accountancy_dispatch_expensereport", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write);
}
}
// Binding
// $newmenu->add("", $langs->trans("Binding"), 0, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch');
if (! empty($conf->facture->enabled))
{
$newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&amp;mainmenu=accountancy", $langs->trans("CustomersVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_customer');
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_customer/', $leftmenu)) {
$newmenu->add("/accountancy/customer/list.php?mainmenu=accountancy&amp;leftmenu=accountancy_dispatch_customer", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write);
$newmenu->add("/accountancy/customer/lines.php?mainmenu=accountancy&amp;leftmenu=accountancy_dispatch_customer", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write);
}
}
if (! empty($conf->supplier_invoice->enabled))
{
$newmenu->add("/accountancy/supplier/index.php?leftmenu=accountancy_dispatch_supplier&amp;mainmenu=accountancy", $langs->trans("SuppliersVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_supplier');
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_supplier/', $leftmenu)) {
$newmenu->add("/accountancy/supplier/list.php?mainmenu=accountancy&amp;leftmenu=accountancy_dispatch_supplier", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write);
$newmenu->add("/accountancy/supplier/lines.php?mainmenu=accountancy&amp;leftmenu=accountancy_dispatch_supplier", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write);
}
}
if (! empty($conf->expensereport->enabled))
{
$newmenu->add("/accountancy/expensereport/index.php?leftmenu=accountancy_dispatch_expensereport&amp;mainmenu=accountancy", $langs->trans("ExpenseReportsVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_expensereport');
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_expensereport/', $leftmenu)) {
$newmenu->add("/accountancy/expensereport/list.php?mainmenu=accountancy&amp;leftmenu=accountancy_dispatch_expensereport", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write);
$newmenu->add("/accountancy/expensereport/lines.php?mainmenu=accountancy&amp;leftmenu=accountancy_dispatch_expensereport", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write);
}
}
// Journals
if(! empty($conf->accounting->enabled) && ! empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy')
@ -1292,38 +1324,6 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
//$newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByVatRate"),3,$user->rights->accounting->comptarapport->lire);
}
}
// Configuration
$newmenu->add("/accountancy/index.php?leftmenu=accountancy_admin", $langs->trans("Setup"), 0, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin', 1);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/', $leftmenu)) {
$newmenu->add("/accountancy/admin/index.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("General"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_general', 10);
// Fiscal year - Not really yet used. In a future will lock some periods.
if ($conf->global->MAIN_FEATURES_LEVEL > 1) {
$newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 1, $user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear', 20);
}
$newmenu->add("/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingJournals"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_journal', 30);
$newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chartmodel', 40);
$newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 41);
$newmenu->add("/accountancy/admin/categories_list.php?id=32&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingCategory"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 50);
$newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 60);
if (! empty($conf->banque->enabled)) {
$newmenu->add("/compta/bank/list.php?mainmenu=accountancy&leftmenu=accountancy_admin&search_status=-1", $langs->trans("MenuBankAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_bank', 70);
}
if (! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled)) {
$newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 80);
}
if (! empty($conf->tax->enabled)) {
$newmenu->add("/admin/dict.php?id=7&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuTaxAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 90);
}
if (! empty($conf->expensereport->enabled)) {
$newmenu->add("/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuExpenseReportAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 100);
}
$newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 110);
$newmenu->add("/accountancy/admin/closure.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuClosureAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_closure', 120);
$newmenu->add("/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ExportOptions"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_export', 130);
}
}
// Accountancy (simple)

View File

@ -136,8 +136,8 @@ class modReceiptPrinter extends DolibarrModules
// Clean before activation
$this->remove($options);
$sql = array(
"CREATE TABLE IF NOT EXISTS llx_printer_receipt (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), fk_type integer, fk_profile integer, parameter varchar(128), entity integer) ENGINE=innodb;",
"CREATE TABLE IF NOT EXISTS llx_printer_receipt_template (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), template text, entity integer) ENGINE=innodb;",
"CREATE TABLE IF NOT EXISTS ".MAIN_DB_PREFIX."printer_receipt (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), fk_type integer, fk_profile integer, parameter varchar(128), entity integer) ENGINE=innodb;",
"CREATE TABLE IF NOT EXISTS ".MAIN_DB_PREFIX."printer_receipt_template (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), template text, entity integer) ENGINE=innodb;",
);
return $this->_init($sql, $options);
}

View File

@ -345,7 +345,7 @@ class modStock extends DolibarrModules
'ps.fk_product'=>"PREF123456",'ps.fk_entrepot'=>"ALM001",'ps.reel'=>"10"
);
$this->import_run_sql_after_array[$r]=array( // Because we may change data that are denormalized, we must update dernormalized data after.
'UPDATE llx_product p SET p.stock= (SELECT SUM(ps.reel) FROM llx_product_stock ps WHERE ps.fk_product = p.rowid);'
'UPDATE '.MAIN_DB_PREFIX.'product p SET p.stock= (SELECT SUM(ps.reel) FROM '.MAIN_DB_PREFIX.'product_stock ps WHERE ps.fk_product = p.rowid);'
);
}

View File

@ -799,7 +799,7 @@ if (empty($action) || $action == 'list')
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page=GETPOST("page", 'int');
if ($page == -1 || $page == null) { $page = 0 ; }
if (empty($page) || $page == -1) { $page = 0; }
$offset = $limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;

View File

@ -54,7 +54,7 @@ $sortfield = GETPOST("sortfield");
if (!$sortorder) $sortorder="DESC";
if (!$sortfield) $sortfield="e.rowid";
if ($page == -1) {
if (empty($page) || $page == -1) {
$page = 0 ;
}

View File

@ -227,6 +227,7 @@ CREATE TABLE llx_bom_bom(
) ENGINE=innodb;
ALTER TABLE llx_bom_bom ADD COLUMN efficiency double(8,4) DEFAULT 1;
ALTER TABLE llx_bom_bom ADD COLUMN entity integer DEFAULT 1 NOT NULL;
create table llx_bom_bom_extrafields
(
@ -272,6 +273,10 @@ ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_rowid (rowid);
ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_fk_product (fk_product);
ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_fk_bom (fk_bom);
ALTER TABLE llx_bom_bom ADD UNIQUE INDEX uk_bom_bom_ref(ref, entity);
ALTER TABLE llx_bom_bomline ADD CONSTRAINT llx_bom_bomline_fk_bom FOREIGN KEY (fk_bom) REFERENCES llx_bom_bom(rowid);
ALTER TABLE llx_product_fournisseur_price ADD COLUMN barcode varchar(180) DEFAULT NULL;
ALTER TABLE llx_product_fournisseur_price ADD COLUMN fk_barcode_type integer DEFAULT NULL;
ALTER TABLE llx_product_fournisseur_price ADD INDEX idx_product_barcode (barcode);

View File

@ -22,7 +22,7 @@ ALTER TABLE llx_bom_bom ADD INDEX idx_bom_bom_status (status);
ALTER TABLE llx_bom_bom ADD INDEX idx_bom_bom_fk_product (fk_product);
-- END MODULEBUILDER INDEXES
--ALTER TABLE llx_bom_bom ADD UNIQUE INDEX uk_bom_bom_fieldxy(fieldx, fieldy);
ALTER TABLE llx_bom_bom ADD UNIQUE INDEX uk_bom_bom_ref(ref, entity);
--ALTER TABLE llx_bom_bom ADD CONSTRAINT llx_bom_bom_fk_field FOREIGN KEY (fk_field) REFERENCES llx_bom_myotherobject(rowid);

View File

@ -22,5 +22,5 @@ ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_fk_bom (fk_bom);
--ALTER TABLE llx_bom_bomline ADD UNIQUE INDEX uk_bom_bomline_fieldxy(fieldx, fieldy);
--ALTER TABLE llx_bom_bomline ADD CONSTRAINT llx_bom_bomline_fk_field FOREIGN KEY (fk_field) REFERENCES llx_bom_myotherobject(rowid);
ALTER TABLE llx_bom_bomline ADD CONSTRAINT llx_bom_bomline_fk_bom FOREIGN KEY (fk_bom) REFERENCES llx_bom_bom(rowid);

View File

@ -847,7 +847,7 @@ if ($ok && GETPOST('clean_product_stock_batch', 'alpha'))
if ($resql2)
{
// We update product_stock, so we must field stock into product too.
$sql3='UPDATE llx_product p SET p.stock= (SELECT SUM(ps.reel) FROM llx_product_stock ps WHERE ps.fk_product = p.rowid)';
$sql3='UPDATE '.MAIN_DB_PREFIX.'product p SET p.stock= (SELECT SUM(ps.reel) FROM '.MAIN_DB_PREFIX.'product_stock ps WHERE ps.fk_product = p.rowid)';
$resql3=$db->query($sql3);
if (! $resql3)
{

View File

@ -699,8 +699,8 @@ function migrate_paiements_orphelins_1($db, $langs, $conf)
$sql = "SELECT distinct p.rowid, p.datec, p.amount as pamount, bu.fk_bank, b.amount as bamount,";
$sql.= " bu2.url_id as socid";
$sql.= " FROM (".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."bank_url as bu, ".MAIN_DB_PREFIX."bank as b)";
$sql.= " LEFT JOIN llx_paiement_facture as pf ON pf.fk_paiement = p.rowid";
$sql.= " LEFT JOIN llx_bank_url as bu2 ON (bu.fk_bank=bu2.fk_bank AND bu2.type = 'company')";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON pf.fk_paiement = p.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu2 ON (bu.fk_bank=bu2.fk_bank AND bu2.type = 'company')";
$sql.= " WHERE pf.rowid IS NULL AND (p.rowid=bu.url_id AND bu.type='payment') AND bu.fk_bank = b.rowid";
$sql.= " AND b.rappro = 1";
$sql.= " AND (p.fk_facture = 0 OR p.fk_facture IS NULL)";
@ -826,8 +826,8 @@ function migrate_paiements_orphelins_2($db, $langs, $conf)
$sql = "SELECT distinct p.rowid, p.datec, p.amount as pamount, bu.fk_bank, b.amount as bamount,";
$sql.= " bu2.url_id as socid";
$sql.= " FROM (".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."bank_url as bu, ".MAIN_DB_PREFIX."bank as b)";
$sql.= " LEFT JOIN llx_paiement_facture as pf ON pf.fk_paiement = p.rowid";
$sql.= " LEFT JOIN llx_bank_url as bu2 ON (bu.fk_bank = bu2.fk_bank AND bu2.type = 'company')";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON pf.fk_paiement = p.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu2 ON (bu.fk_bank = bu2.fk_bank AND bu2.type = 'company')";
$sql.= " WHERE pf.rowid IS NULL AND (p.fk_bank = bu.fk_bank AND bu.type = 'payment') AND bu.fk_bank = b.rowid";
$sql.= " AND (p.fk_facture = 0 OR p.fk_facture IS NULL)";
@ -1143,7 +1143,7 @@ function migrate_contracts_date1($db, $langs, $conf)
print '<br>';
print '<b>'.$langs->trans('MigrationContractsEmptyDatesUpdate')."</b><br>\n";
$sql="update llx_contrat set date_contrat=tms where date_contrat is null";
$sql="update ".MAIN_DB_PREFIX."contrat set date_contrat=tms where date_contrat is null";
dolibarr_install_syslog("upgrade2::migrate_contracts_date1");
$resql = $db->query($sql);
if (! $resql) dol_print_error($db);
@ -1152,7 +1152,7 @@ function migrate_contracts_date1($db, $langs, $conf)
else
print $langs->trans('MigrationContractsEmptyDatesNothingToUpdate')."<br>\n";
$sql="update llx_contrat set datec=tms where datec is null";
$sql="update ".MAIN_DB_PREFIX."contrat set datec=tms where datec is null";
dolibarr_install_syslog("upgrade2::migrate_contracts_date1");
$resql = $db->query($sql);
if (! $resql) dol_print_error($db);
@ -1243,7 +1243,7 @@ function migrate_contracts_date3($db, $langs, $conf)
print '<br>';
print '<b>'.$langs->trans('MigrationContractsIncoherentCreationDateUpdate')."</b><br>\n";
$sql="update llx_contrat set datec=date_contrat where datec is null or datec > date_contrat";
$sql="update ".MAIN_DB_PREFIX."contrat set datec=date_contrat where datec is null or datec > date_contrat";
dolibarr_install_syslog("upgrade2::migrate_contracts_date3");
$resql = $db->query($sql);
if (! $resql) dol_print_error($db);
@ -1270,7 +1270,7 @@ function migrate_contracts_open($db, $langs, $conf)
print '<br>';
print '<b>'.$langs->trans('MigrationReopeningContracts')."</b><br>\n";
$sql = "SELECT c.rowid as cref FROM llx_contrat as c, llx_contratdet as cd";
$sql = "SELECT c.rowid as cref FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."contratdet as cd";
$sql.= " WHERE cd.statut = 4 AND c.statut=2 AND c.rowid=cd.fk_contrat";
dolibarr_install_syslog("upgrade2::migrate_contracts_open");
$resql = $db->query($sql);
@ -2003,7 +2003,7 @@ function migrate_modeles($db, $langs, $conf)
if (count($modellist)==0)
{
// Aucun model par defaut.
$sql=" insert into llx_document_model(nom,type) values('crabe','invoice')";
$sql=" insert into ".MAIN_DB_PREFIX."document_model(nom,type) values('crabe','invoice')";
$resql = $db->query($sql);
if (! $resql) dol_print_error($db);
}
@ -2016,7 +2016,7 @@ function migrate_modeles($db, $langs, $conf)
if (count($modellist)==0)
{
// Aucun model par defaut.
$sql=" insert into llx_document_model(nom,type) values('einstein','order')";
$sql=" insert into ".MAIN_DB_PREFIX."document_model(nom,type) values('einstein','order')";
$resql = $db->query($sql);
if (! $resql) dol_print_error($db);
}
@ -2029,7 +2029,7 @@ function migrate_modeles($db, $langs, $conf)
if (count($modellist)==0)
{
// Aucun model par defaut.
$sql=" insert into llx_document_model(nom,type) values('rouget','shipping')";
$sql=" insert into ".MAIN_DB_PREFIX."document_model(nom,type) values('rouget','shipping')";
$resql = $db->query($sql);
if (! $resql) dol_print_error($db);
}

View File

@ -107,7 +107,7 @@ ExpenseReportsVentilation=Expense report binding
CreateMvts=Create new transaction
UpdateMvts=Modification of a transaction
ValidTransaction=Validate transaction
WriteBookKeeping=Journalize transactions in Ledger
WriteBookKeeping=Register transactions in Ledger
Bookkeeping=Ledger
AccountBalance=Account balance
ObjectsRef=Source object ref

View File

@ -47,7 +47,7 @@ $result = restrictedArea($user, 'loan', $id, '', '');
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
if ($page == -1) {
if (empty($page) || $page == -1) {
$page = 0;
}
$offset = $conf->liste_limit * $page;

View File

@ -401,13 +401,19 @@ if ((! defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && ! empty($conf->
if (GETPOSTISSET('disablemodules')) $_SESSION["disablemodules"]=GETPOST('disablemodules', 'alpha');
if (! empty($_SESSION["disablemodules"]))
{
$modulepartkeys = array('css', 'js', 'tabs', 'triggers', 'login', 'substitutions', 'menus', 'theme', 'sms', 'tpl', 'barcode', 'models', 'societe', 'hooks', 'dir', 'syslog', 'tpllinkable', 'contactelement', 'moduleforexternal');
$disabled_modules=explode(',', $_SESSION["disablemodules"]);
foreach($disabled_modules as $module)
{
if ($module)
{
if (empty($conf->$module)) $conf->$module=new stdClass();
if (empty($conf->$module)) $conf->$module=new stdClass(); // To avoid warnings
$conf->$module->enabled=false;
foreach($modulepartkeys as $modulepartkey)
{
unset($conf->modules_parts[$modulepartkey][$module]);
}
if ($module == 'fournisseur') // Special case
{
$conf->supplier_order->enabled=0;

View File

@ -46,6 +46,7 @@ class MyObject extends CommonObject
* @var string Name of subtable if this object has sub lines
*/
//public $table_element_line = 'mymodule_myobjectline';
//public $fk_element = 'fk_myobject';
/**
* @var int Does myobject support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
@ -267,12 +268,19 @@ class MyObject extends CommonObject
$this->db->begin();
// Load source object
$object->fetchCommon($fromid);
$result = $object->fetchCommon($fromid);
if ($result > 0 && ! empty($object->table_element_line)) $object->fetchLines();
// get lines so they will be clone
//foreach($this->lines as $line)
// $line->fetch_optionals();
// Reset some properties
unset($object->id);
unset($object->fk_user_creat);
unset($object->import_key);
// Clear fields
$object->ref = "copy_of_".$object->ref;
$object->title = $langs->trans("CopyOf")." ".$object->title;
@ -301,6 +309,25 @@ class MyObject extends CommonObject
$this->errors = $object->errors;
}
if (! $error)
{
// copy internal contacts
if ($this->copy_linked_contact($object, 'internal') < 0)
{
$error++;
}
}
if (! $error)
{
// copy external contacts if same company
if (property_exists($this, 'socid') && $this->socid == $object->socid)
{
if ($this->copy_linked_contact($object, 'external') < 0)
$error++;
}
}
unset($object->context['createfromclone']);
// End
@ -671,7 +698,7 @@ class MyObject extends CommonObject
$this->lines=array();
$objectline = new MyObjectLine($this->db);
$result = $objectline->fetchAll('', '', 0, 0, array('customsql'=>'fk_myobject = '.$this->id));
$result = $objectline->fetchAll('ASC', 'rank', 0, 0, array('customsql'=>'fk_myobject = '.$this->id));
if (is_numeric($result))
{
@ -756,4 +783,5 @@ class MyObject extends CommonObject
class MyObjectLine
{
// To complete with content of an object MyObjectLine
// We should have a field rowid, fk_myobject and rank
}

View File

@ -158,7 +158,7 @@ if ($object->id)
}
else
{
accessforbidden('', 0, 0);
accessforbidden('', 0, 1);
}
// End of page

View File

@ -1,88 +0,0 @@
<?php
/* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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/public/ifttt/index.php
* \ingroup ifttt
* \brief Page to IFTTT endpoint agenda
* http://127.0.0.1/dolibarr/public/ifttt/index.php?securekey=...
*/
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no menu to show
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
if (! defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged.
if (! defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
// This is a wrapper, so header is empty
/**
* Header function
*
* @return void
*/
function llxHeaderIFTTT()
{
print '<html><title>IFTTT API</title><body>';
}
/**
* Footer function
*
* @return void
*/
function llxFooterIFTTT()
{
print '</body></html>';
}
require '../../main.inc.php';
// Security check
if (empty($conf->ifttt->enabled)) accessforbidden('', 0, 0, 1);
// Check config
if (empty($conf->global->IFTTT_DOLIBARR_ENDPOINT_SECUREKEY))
{
$user->getrights();
llxHeaderIFTTT();
print '<div class="error">Module Agenda was not configured properly.</div>';
llxFooterIFTTT();
exit;
}
// Check exportkey
if (empty($_GET["securekey"]) || $conf->global->IFTTT_DOLIBARR_ENDPOINT_SECUREKEY != $_GET["securekey"])
{
$user->getrights();
llxHeaderIFTTT();
print '<div class="error">Bad value for securekey.</div>';
llxFooterIFTTT();
exit;
}
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
$hookmanager->initHooks(array('iftttapi'));
llxHeaderIFTTT();
print '<div class="error">TODO</div>';
llxFooterIFTTT();

View File

@ -62,7 +62,7 @@ $listofvoters=explode(',', $_SESSION["savevoter"]);
// Add comment
if (GETPOST('ajoutcomment', 'alpha'))
{
if (!$canbemodified) accessforbidden();
if (!$canbemodified) accessforbidden('', 0, 0, 1);
$error=0;
@ -97,7 +97,7 @@ if (GETPOST('ajoutcomment', 'alpha'))
// Add vote
if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // boutonp for chrome, boutonp_x for firefox
{
if (!$canbemodified) accessforbidden();
if (!$canbemodified) accessforbidden('', 0, 0, 1);
//Si le nom est bien entré
if (GETPOST('nom', 'nohtml'))
@ -220,7 +220,7 @@ if ($testmodifier)
}
}
if (!$canbemodified) accessforbidden();
if (!$canbemodified) accessforbidden('', 0, 0, 1);
$idtomodify=$_POST["idtomodify".$modifier];
$sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_user_studs";
@ -235,7 +235,7 @@ if ($testmodifier)
$idcomment=GETPOST('deletecomment', 'int');
if ($idcomment)
{
if (!$canbemodified) accessforbidden();
if (!$canbemodified) accessforbidden('', 0, 0, 1);
$resql = $object->deleteComment($idcomment);
}

View File

@ -237,8 +237,7 @@ if ($action == 'create' || $object->fetch($id) > 0)
if ($action == 'create' || $action == 'edit')
{
if ( ! $user->rights->resource->write )
accessforbidden('', 0);
if (! $user->rights->resource->write) accessforbidden('', 0, 1);
// Create/Edit object

View File

@ -547,13 +547,13 @@ class Dolresource extends CommonObject
if ($limit) $sql.= $this->db->plimit($limit, $offset);
dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG);
$this->lines=array();
$resql=$this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
if ($num)
{
$this->lines=array();
while ($obj = $this->db->fetch_object($resql))
{
$line = new Dolresource($this->db);
@ -853,6 +853,8 @@ class Dolresource extends CommonObject
$sql .= ' ORDER BY resource_type';
dol_syslog(get_class($this)."::getElementResources", LOG_DEBUG);
$resources = array();
$resql = $this->db->query($sql);
if ($resql)
{
@ -904,7 +906,7 @@ class Dolresource extends CommonObject
// phpcs:enable
global $langs;
if (count($this->cache_code_type_resource)) return 0; // Cache deja charge
if (is_array($this->cache_code_type_resource) && count($this->cache_code_type_resource)) return 0; // Cache deja charge
$sql = "SELECT rowid, code, label, active";
$sql.= " FROM ".MAIN_DB_PREFIX."c_type_resource";

View File

@ -93,8 +93,6 @@ class FormResource
$out = '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$out.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
}
//$out.= '<input type="hidden" name="action" value="search">';
//$out.= '<input type="hidden" name="id" value="'.$theme->id.'">';
if ($resourcestat)
{

View File

@ -94,8 +94,7 @@ if (empty($arch)) $arch = 0;
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$page = GETPOST("page");
$page = is_numeric($page) ? $page : 0;
$page = $page == -1 ? 0 : $page;
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;

View File

@ -41,7 +41,7 @@ if ($sortfield == "")
$sortfield="s.nom";
}
if ($page == -1 || $page == null) { $page = 0 ; }
if (empty($page) || $page == -1) { $page = 0 ; }
$offset = $conf->liste_limit * $page ;
$pageprev = $page - 1;

View File

@ -86,11 +86,11 @@ if (!$user->rights->ticket->read) {
// restrict access for externals users
if ($user->societe_id > 0 && ($object->fk_soc != $user->societe_id))
{
accessforbidden('', 0);
accessforbidden();
}
// or for unauthorized internals users
if (!$user->societe_id && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
accessforbidden('', 0);
accessforbidden();
}

View File

@ -647,7 +647,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
{
// or for unauthorized internals users
if (!$user->societe_id && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
accessforbidden('', 0);
accessforbidden('', 0, 1);
}
// Confirmation close

View File

@ -196,7 +196,7 @@ if ($object->id)
}
else
{
accessforbidden('', 0, 0);
accessforbidden('', 0, 1);
}
// End of page

View File

@ -174,7 +174,7 @@ if ($object->id)
}
else
{
accessforbidden('', 0, 0);
accessforbidden('', 0, 1);
}
// End of page

View File

@ -170,7 +170,7 @@ if (GETPOST('type', 'alpha')) $type=GETPOST('type', 'alpha');
else $type=dol_mimetype($original_file);
// Security: This wrapper is for images. We do not allow type/html
if (preg_match('/html/', $type)) accessforbidden('Error: Using the image wrapper to output a file with a mime type HTML is not possible.', 1, 1, 1);
if (preg_match('/html/', $type)) accessforbidden('Error: Using the image wrapper to output a file with a mime type HTML is not possible.', 0, 0, 1);
// Security: Delete string ../ into $original_file
$original_file = str_replace("../", "/", $original_file);
@ -179,7 +179,7 @@ $original_file = str_replace("../", "/", $original_file);
$refname=basename(dirname($original_file)."/");
// Security check
if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart', 1, 1, 1);
if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart', 0, 0, 1);
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname);
$accessallowed = $check_access['accessallowed'];

View File

@ -892,6 +892,7 @@ class Website extends CommonObject
// Warning: We must keep llx_ here. It is a generic SQL.
$line = 'INSERT INTO llx_website_page(rowid, fk_page, fk_website, pageurl, aliasalt, title, description, image, keywords, status, date_creation, tms, lang, import_key, grabbed_from, type_container, htmlheader, content)';
$line.= " VALUES(";
$line.= $objectpageold->newid."__+MAX_llx_website_page__, ";
$line.= ($objectpageold->newfk_page ? $this->db->escape($objectpageold->newfk_page)."__+MAX_llx_website_page__" : "null").", ";
@ -939,7 +940,8 @@ class Website extends CommonObject
//var_dump($this->fk_default_home.' - '.$objectpageold->id.' - '.$objectpageold->newid);exit;
if ($this->fk_default_home > 0 && ($objectpageold->id == $this->fk_default_home) && ($objectpageold->newid > 0)) // This is the record with home page
{
$line = "UPDATE llx_website SET fk_default_home = ".($objectpageold->newid > 0 ? $this->db->escape($objectpageold->newid)."__+MAX_llx_website_page__" : "null")." WHERE rowid = __WEBSITE_ID__;";
// Warning: We must keep llx_ here. It is a generic SQL.
$line = "UPDATE llx_website SET fk_default_home = ".($objectpageold->newid > 0 ? $this->db->escape($objectpageold->newid)."__+MAX_llx_website_page__" : "null")." WHERE rowid = __WEBSITE_ID__;";
$line.= "\n";
fputs($fp, $line);
}