Merge branch 'develop' into 14b5

This commit is contained in:
Laurent Destailleur 2021-05-11 18:15:31 +02:00 committed by GitHub
commit 2dce969612
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 265 additions and 218 deletions

View File

@ -7,13 +7,14 @@ English Dolibarr ChangeLog
For users:
----------
NEW: Feature to make inventories
NEW: Module Recruitement to follow application to job positions is now stable.
NEW: Feature to make Stock Inventories
NEW: Several security issues after a second private bug hunting campaign.
NEW: Add a security center page with all information and advices related to the security of your instance
NEW: Add a performance center page with all information and advices related to the performance of your instance
NEW: A lot of fix into english text after a small proofreading campaign (still not perfect, but really better)
NEW: All main menu entries are using the picto of the module
NEW: Accountancy - Add closure menu
NEW: Add an example of scheduled job to send email reminder for unpayed invoices
NEW: Accountancy - Add FEC import
NEW: Accountancy - Add a confirmation form with options on export
NEW: Accountancy - Add select date from/to in already bind customer and supplier list

View File

@ -344,8 +344,8 @@ class Commande extends CommonOrder
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>270),
'module_source' =>array('type'=>'varchar(32)', 'label'=>'POSModule', 'enabled'=>1, 'visible'=>-1, 'position'=>275),
'pos_source' =>array('type'=>'varchar(32)', 'label'=>'POSTerminal', 'enabled'=>1, 'visible'=>-1, 'position'=>280),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>400),
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900),
);
// END MODULEBUILDER PROPERTIES

View File

@ -163,21 +163,21 @@ $checkedtypetiers = 0;
$arrayfields = array(
'c.ref'=>array('label'=>"Ref", 'checked'=>1, 'position'=>5),
'c.ref_client'=>array('label'=>"RefCustomerOrder", 'checked'=>-1, 'position'=>10),
'p.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(empty($conf->projet->enabled) ? 0 : 1), 'position'=>20),
'p.ref'=>array('label'=>"ProjectRef", 'checked'=>-1, 'enabled'=>(empty($conf->projet->enabled) ? 0 : 1), 'position'=>20),
'p.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(empty($conf->projet->enabled) ? 0 : 1), 'position'=>25),
's.nom'=>array('label'=>"ThirdParty", 'checked'=>1, 'position'=>30),
's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>1, 'position'=>31),
's.town'=>array('label'=>"Town", 'checked'=>1, 'position'=>35),
's.zip'=>array('label'=>"Zip", 'checked'=>1, 'position'=>40),
's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>-1, 'position'=>31),
's.town'=>array('label'=>"Town", 'checked'=>-1, 'position'=>35),
's.zip'=>array('label'=>"Zip", 'checked'=>-1, 'position'=>40),
'state.nom'=>array('label'=>"StateShort", 'checked'=>0, 'position'=>45),
'country.code_iso'=>array('label'=>"Country", 'checked'=>0, 'position'=>50),
'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers, 'position'=>55),
'c.date_commande'=>array('label'=>"OrderDateShort", 'checked'=>1, 'position'=>60),
'c.date_delivery'=>array('label'=>"DateDeliveryPlanned", 'checked'=>1, 'enabled'=>empty($conf->global->ORDER_DISABLE_DELIVERY_DATE), 'position'=>65),
'c.fk_shipping_method'=>array('label'=>"SendingMethod", 'checked'=>0, 'position'=>66 , 'enabled'=>!empty($conf->expedition->enabled)),
'c.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>0, 'position'=>67),
'c.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>0, 'position'=>68),
'c.fk_input_reason'=>array('label'=>"Channel", 'checked'=>0, 'position'=>69),
'c.fk_shipping_method'=>array('label'=>"SendingMethod", 'checked'=>-1, 'position'=>66 , 'enabled'=>!empty($conf->expedition->enabled)),
'c.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>-1, 'position'=>67),
'c.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>-1, 'position'=>68),
'c.fk_input_reason'=>array('label'=>"Channel", 'checked'=>-1, 'position'=>69),
'c.total_ht'=>array('label'=>"AmountHT", 'checked'=>1, 'position'=>75),
'c.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0, 'position'=>80),
'c.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0, 'position'=>85),
@ -186,15 +186,15 @@ $arrayfields = array(
'c.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>100),
'c.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>105),
'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>110),
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10, 'position'=>115),
'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500, 'position'=>120),
'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500, 'position'=>125),
'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500, 'position'=>130),
'c.note_public'=>array('label'=>'NotePublic', 'checked'=>0, 'position'=>510, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PUBLIC_NOTES)), 'position'=>135),
'c.note_private'=>array('label'=>'NotePrivate', 'checked'=>0, 'position'=>511, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PRIVATE_NOTES)), 'position'=>140),
'c.facture'=>array('label'=>"Billed", 'checked'=>1, 'position'=>990, 'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)), 'position'=>145),
'shippable'=>array('label'=>"Shippable", 'checked'=>1, 'position'=>995, 'enabled'=>(!empty($conf->expedition->enabled)), 'position'=>150),
'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000, 'position'=>155)
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115),
'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>120),
'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>125),
'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>130),
'c.note_public'=>array('label'=>'NotePublic', 'checked'=>0, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PUBLIC_NOTES)), 'position'=>135),
'c.note_private'=>array('label'=>'NotePrivate', 'checked'=>0, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PRIVATE_NOTES)), 'position'=>140),
'shippable'=>array('label'=>"Shippable", 'checked'=>1,'enabled'=>(!empty($conf->expedition->enabled)), 'position'=>990),
'c.facture'=>array('label'=>"Billed", 'checked'=>1, 'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)), 'position'=>995),
'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000)
);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
@ -1115,7 +1115,7 @@ if ($resql) {
// Channel
if (!empty($arrayfields['c.fk_input_reason']['checked'])) {
print '<td class="liste_titre">';
$form->selectInputReason($search_fk_input_reason, 'search_fk_input_reason', '', 1);
$form->selectInputReason($search_fk_input_reason, 'search_fk_input_reason', '', 1, '', 1);
print '</td>';
}
if (!empty($arrayfields['c.total_ht']['checked'])) {
@ -1838,6 +1838,9 @@ if ($resql) {
}
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Billed

View File

@ -4956,7 +4956,11 @@ class Facture extends CommonInvoice
$resql = $this->db->query($sql);
$stmpidate = dol_print_date($tmpidate, 'day', 'gmt');
$this->output .= $langs->trans("SearchUnpaidInvoicesWithDueDate", $stmpidate).'<br>';
$this->output .= $langs->transnoentitiesnoconv("SearchUnpaidInvoicesWithDueDate", $stmpidate);
if (!empty($paymentmode) && $paymentmode != 'all') {
$this->output .= ' ('.$langs->transnoentitiesnoconv("PaymentMode").' '.$paymentmode.')';
}
$this->output .= '<br>';
if ($resql) {
while ($obj = $this->db->fetch_object($resql)) {

View File

@ -31,6 +31,7 @@ if ($action == 'update' && is_array($arrayofparameters)) {
$db->begin();
foreach ($arrayofparameters as $key => $val) {
var_dump($key);
// Modify constant only if key was posted (avoid resetting key to the null value)
if (GETPOSTISSET($key)) {
if (preg_match('/category:/', $val['type'])) {

View File

@ -2,7 +2,7 @@
/* Module descriptor for ticket system
* Copyright (C) 2013-2016 Jean-François FERRY <hello@librethic.io>
* 2016 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -113,9 +113,6 @@ class box_last_modified_ticket extends ModeleBoxes
while ($i < $num) {
$objp = $this->db->fetch_object($resql);
$datec = $this->db->jdate($objp->datec);
$dateterm = $this->db->jdate($objp->fin_validite);
$dateclose = $this->db->jdate($objp->date_cloture);
$late = '';
$ticket = new Ticket($this->db);
$ticket->id = $objp->id;
@ -162,7 +159,6 @@ class box_last_modified_ticket extends ModeleBoxes
);
$r++;
// Date creation
$this->info_box_contents[$i][$r] = array(
'td' => 'class="right"',

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2012-2018 Charlene BENKE <charlie@patas-monkey.com>
* Copyright (C) 2015-2020 Frederic France <frederic.france@netlogic.fr>
* Copyright (C) 2015-2021 Frederic France <frederic.france@netlogic.fr>
*
* 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
@ -150,7 +150,7 @@ class box_task extends ModeleBoxes
}
$sql = "SELECT pt.rowid, pt.ref, pt.fk_projet, pt.fk_task_parent, pt.datec, pt.dateo, pt.datee, pt.datev, pt.label, pt.description, pt.duration_effective, pt.planned_workload, pt.progress";
$sql .= ", p.rowid project_id, p.ref project_ref, p.title project_title";
$sql .= ", p.rowid project_id, p.ref project_ref, p.title project_title, p.fk_statut";
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task as pt";
$sql .= " JOIN ".MAIN_DB_PREFIX."projet as p ON (pt.fk_projet = p.rowid)";

View File

@ -3512,7 +3512,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'partnership', 'payment', 'pencil-ruler', 'preview', 'project', 'projectpub', 'projecttask', 'refresh', 'salary', 'shipment', 'supplier_invoice', 'technic', 'ticket',
'error', 'warning',
'reception', 'recruitmentcandidature', 'recruitmentjobposition', 'resource',
'shapes', 'supplier_proposal', 'supplier_order', 'supplier_invoice',
'shapes', 'supplier', 'supplier_proposal', 'supplier_order', 'supplier_invoice',
'timespent', 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda',
'uncheck', 'user-cog', 'website', 'workstation',
'conferenceorbooth', 'eventorganization'
@ -3556,7 +3556,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'reception'=>'dolly', 'recruitmentjobposition'=>'id-card-alt', 'recruitmentcandidature'=>'id-badge',
'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature',
'refresh'=>'redo', 'resource'=>'laptop-house',
'salary'=>'wallet', 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'stripe'=>'stripe-s', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt',
'salary'=>'wallet', 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'stripe'=>'stripe-s',
'supplier'=>'building', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt',
'timespent'=>'clock', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach',
'title_agenda'=>'calendar-alt',
'uncheck'=>'times', 'uparrow'=>'share', 'vcard'=>'address-card',
@ -3634,7 +3635,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'reception'=>'flip', 'recruitmentjobposition'=>'infobox-adherent', 'recruitmentcandidature'=>'infobox-adherent',
'resource'=>'infobox-action',
'salary'=>'infobox-bank_account', 'shipment'=>'infobox-commande', 'supplier_invoice'=>'infobox-order_supplier', 'supplier_invoicea'=>'infobox-order_supplier', 'supplier_invoiced'=>'infobox-order_supplier',
'supplier_order'=>'infobox-order_supplier', 'supplier_proposal'=>'infobox-supplier_proposal',
'supplier'=>'infobox-order_supplier', 'supplier_order'=>'infobox-order_supplier', 'supplier_proposal'=>'infobox-supplier_proposal',
'ticket'=>'infobox-contrat', 'title_accountancy'=>'infobox-bank_account', 'title_hrm'=>'infobox-holiday', 'expensereport'=>'infobox-expensereport', 'trip'=>'infobox-expensereport', 'title_agenda'=>'infobox-action',
//'title_setup'=>'infobox-action', 'tools'=>'infobox-action',
'list-alt'=>'imgforviewmode', 'calendar'=>'imgforviewmode', 'calendarweek'=>'imgforviewmode', 'calendarmonth'=>'imgforviewmode', 'calendarday'=>'imgforviewmode', 'calendarperuser'=>'imgforviewmode'

View File

@ -1211,6 +1211,9 @@ class pdf_cornas extends ModelePDFSuppliersOrders
{
global $langs, $conf, $mysoc;
$ltrdirection = 'L';
if ($outputlangs->trans("DIRECTION") == 'rtl') $ltrdirection = 'R';
// Load translation files required by the page
$outputlangs->loadLangs(array("main", "orders", "companies", "bills", "sendings"));
@ -1248,7 +1251,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
}
} else {
$text = $this->emetteur->name;
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
}
$pdf->SetFont('', 'B', $default_font_size + 3);
@ -1369,7 +1372,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx, $posy - 5);
$pdf->MultiCell(80, 5, $outputlangs->transnoentities("BillFrom"), 0, 'L');
$pdf->MultiCell(80, 5, $outputlangs->transnoentities("BillFrom"), 0, $ltrdirection);
$pdf->SetXY($posx, $posy);
$pdf->SetFillColor(230, 230, 230);
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
@ -1378,13 +1381,13 @@ class pdf_cornas extends ModelePDFSuppliersOrders
// Show sender name
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
$posy = $pdf->getY();
// Show sender information
$pdf->SetXY($posx + 2, $posy);
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
$pdf->MultiCell(80, 4, $carac_emetteur, 0, $ltrdirection);
@ -1422,20 +1425,20 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx + 2, $posy - 5);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo"), 0, 'L');
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo"), 0, $ltrdirection);
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
// Show recipient name
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, $ltrdirection);
$posy = $pdf->getY();
// Show recipient information
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->SetXY($posx + 2, $posy);
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection);
}
return $top_shift;

View File

@ -1119,6 +1119,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
{
global $langs, $conf, $mysoc;
$ltrdirection = 'L';
if ($outputlangs->trans("DIRECTION") == 'rtl') $ltrdirection = 'R';
// Load translation files required by the page
$outputlangs->loadLangs(array("main", "orders", "companies", "bills", "sendings"));
@ -1156,7 +1159,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
}
} else {
$text = $this->emetteur->name;
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
}
$pdf->SetFont('', 'B', $default_font_size + 3);
@ -1277,7 +1280,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx, $posy - 5);
$pdf->MultiCell(80, 5, $outputlangs->transnoentities("BillFrom"), 0, 'L');
$pdf->MultiCell(80, 5, $outputlangs->transnoentities("BillFrom"), 0, $ltrdirection);
$pdf->SetXY($posx, $posy);
$pdf->SetFillColor(230, 230, 230);
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
@ -1286,13 +1289,13 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
// Show sender name
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
$posy = $pdf->getY();
// Show sender information
$pdf->SetXY($posx + 2, $posy);
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
$pdf->MultiCell(80, 4, $carac_emetteur, 0, $ltrdirection);
// If CUSTOMER contact defined on order, we use it. Note: Even if this is a supplier object, the code for external contat that follow order is 'CUSTOMER'
@ -1329,20 +1332,20 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx + 2, $posy - 5);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo"), 0, 'L');
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo"), 0, $ltrdirection);
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
// Show recipient name
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, $ltrdirection);
$posy = $pdf->getY();
// Show recipient information
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->SetXY($posx + 2, $posy);
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection);
}
return $top_shift;

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2014 Maxime Kohlhaas <support@atm-consulting.fr>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -59,7 +60,7 @@ if ($reshook < 0) {
//var_dump($extrafields->attributes[$object->table_element]);
if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]['label'])) {
if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label'])) {
$lastseparatorkeyfound = '';
$extrafields_collapse_num = '';
$extrafields_collapse_num_old = '';

View File

@ -352,7 +352,7 @@ if (($action == "create") || ($action == "edit")) {
print '<tr class="blockmethod"><td>';
print $langs->trans('CronModule')."</td><td>";
print "<input type=\"text\" size=\"20\" name=\"module_name\" value=\"".$object->module_name."\" /> ";
print "<input type=\"text\" class=\"width200\" name=\"module_name\" value=\"".$object->module_name."\" /> ";
print "</td>";
print "<td>";
print $form->textwithpicto('', $langs->trans("CronModuleHelp"), 1, 'help');
@ -370,7 +370,7 @@ if (($action == "create") || ($action == "edit")) {
print '<tr class="blockmethod"><td>';
print $langs->trans('CronObject')."</td><td>";
print "<input type=\"text\" size=\"20\" name=\"objectname\" value=\"".$object->objectname."\" /> ";
print "<input type=\"text\" class=\"width200\" name=\"objectname\" value=\"".$object->objectname."\" /> ";
print "</td>";
print "<td>";
print $form->textwithpicto('', $langs->trans("CronObjectHelp"), 1, 'help');

View File

@ -27,15 +27,7 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
require_once '../lib/datapolicy.lib.php';
// Translations
$langs->load('admin');
$langs->load('companies');
$langs->load('members');
$langs->load('datapolicy@datapolicy');
// Access control
if (!$user->admin) {
accessforbidden();
}
$langs->loadLangs(array('admin', 'companies', 'members', 'datapolicy@datapolicy'));
// Parameters
$action = GETPOST('action', 'aZ09');
@ -43,35 +35,27 @@ $backtopage = GETPOST('backtopage', 'alpha');
$arrayofparameters = array();
$arrayofparameters['ThirdParty'] = array(
'DATAPOLICY_TIERS_CLIENT'=>array('css'=>'minwidth200'),
'DATAPOLICY_TIERS_PROSPECT'=>array('css'=>'minwidth200'),
'DATAPOLICY_TIERS_PROSPECT_CLIENT'=>array('css'=>'minwidth200'),
'DATAPOLICY_TIERS_NIPROSPECT_NICLIENT'=>array('css'=>'minwidth200'),
'DATAPOLICY_TIERS_FOURNISSEUR'=>array('css'=>'minwidth200'),
'DATAPOLICY_TIERS_CLIENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'company', 'class="pictofixedwidth"')),
'DATAPOLICY_TIERS_PROSPECT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'company', 'class="pictofixedwidth"')),
'DATAPOLICY_TIERS_PROSPECT_CLIENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'company', 'class="pictofixedwidth"')),
'DATAPOLICY_TIERS_NIPROSPECT_NICLIENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'company', 'class="pictofixedwidth"')),
'DATAPOLICY_TIERS_FOURNISSEUR'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'supplier', 'class="pictofixedwidth"')),
);
if (!empty($conf->global->DATAPOLICY_USE_SPECIFIC_DELAY_FOR_CONTACT)) {
$arrayofparameters['Contact'] = array(
'DATAPOLICY_CONTACT_CLIENT'=>array('css'=>'minwidth200'),
'DATAPOLICY_CONTACT_PROSPECT'=>array('css'=>'minwidth200'),
'DATAPOLICY_CONTACT_PROSPECT_CLIENT'=>array('css'=>'minwidth200'),
'DATAPOLICY_CONTACT_NIPROSPECT_NICLIENT'=>array('css'=>'minwidth200'),
'DATAPOLICY_CONTACT_FOURNISSEUR'=>array('css'=>'minwidth200'),
'DATAPOLICY_CONTACT_CLIENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'contact', 'class="pictofixedwidth"')),
'DATAPOLICY_CONTACT_PROSPECT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'contact', 'class="pictofixedwidth"')),
'DATAPOLICY_CONTACT_PROSPECT_CLIENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'contact', 'class="pictofixedwidth"')),
'DATAPOLICY_CONTACT_NIPROSPECT_NICLIENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'contact', 'class="pictofixedwidth"')),
'DATAPOLICY_CONTACT_FOURNISSEUR'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'contact', 'class="pictofixedwidth"')),
);
}
if (!empty($conf->adherent->enabled)) {
$arrayofparameters['Member'] = array(
'DATAPOLICY_ADHERENT'=>array('css'=>'minwidth200'),
'DATAPOLICY_ADHERENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'member', 'class="pictofixedwidth"')),
);
}
/*
* Actions
*/
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
$valTab = array(
'' => $langs->trans('Never'),
'6' => $langs->trans('NB_MONTHS', 6),
@ -85,6 +69,40 @@ $valTab = array(
'240' => $langs->trans('NB_YEARS', 20),
);
// Access control
if (!$user->admin) {
accessforbidden();
}
/*
* Actions
*/
foreach ($arrayofparameters as $title => $tab) {
foreach ($tab as $key => $val) {
// Modify constant only if key was posted (avoid resetting key to the null value)
if (GETPOSTISSET($key)) {
if (preg_match('/category:/', $val['type'])) {
if (GETPOST($key, 'int') == '-1') {
$val_const = '';
} else {
$val_const = GETPOST($key, 'int');
}
} else {
$val_const = GETPOST($key, 'alpha');
}
$result = dolibarr_set_const($db, $key, $val_const, 'chaine', 0, '', $conf->entity);
if ($result < 0) {
$error++;
break;
}
}
}
}
/*
* View
@ -96,11 +114,11 @@ llxHeader('', $langs->trans($page_name));
// Subheader
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans($page_name), $linkback, 'object_generic');
print load_fiche_titre($langs->trans($page_name), $linkback, 'generic');
// Configuration header
$head = datapolicyAdminPrepareHead();
print dol_get_fiche_head($head, 'settings', '', -1, "datapolicy@datapolicy");
print dol_get_fiche_head($head, 'settings', '', -1, '');
// Setup page goes here
echo '<span class="opacitymedium">'.$langs->trans("datapolicySetupPage").'</span><br><br>';
@ -118,6 +136,7 @@ if ($action == 'edit') {
print '<tr class="trforbreak"><td class="titlefield trforbreak" colspan="2">'.$langs->trans($title).'</td></tr>';
foreach ($tab as $key => $val) {
print '<tr class="oddeven"><td>';
print $val['picto'];
print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
print '</td><td>';
print '<select name="'.$key.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'">';
@ -147,6 +166,7 @@ if ($action == 'edit') {
print '<tr class="trforbreak"><td class="titlefield trforbreak" colspan="2">'.$langs->trans($title).'</td></tr>';
foreach ($tab as $key => $val) {
print '<tr class="oddeven"><td>';
print $val['picto'];
print $form->textwithpicto($langs->trans($key), $langs->trans('DATAPOLICY_Tooltip_SETUP'));
print '</td><td>'.($conf->global->$key == '' ? $langs->trans('None') : $valTab[$conf->global->$key]).'</td></tr>';
}

View File

@ -54,27 +54,26 @@ class DataPolicyCron
$errormsg = '';
$nbupdated = $nbdeleted = 0;
// FIXME Removed hardcoded values of id
// FIXME Exclude data from the selection if there is at least 1 invoice.
$arrayofparameters = array(
'DATAPOLICIES_TIERS_CLIENT' => array(
'sql' => "
SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s
WHERE (s.fk_forme_juridique IN (11, 12, 13, 15, 17, 18, 19, 35, 60, 312, 316, 401, 600, 700, 1005) OR s.fk_typent = 8)
AND s.entity = %d
WHERE s.entity = %d
AND s.client = 1
AND s.fournisseur = 0
AND s.tms < DATE_SUB(NOW(), INTERVAL %d MONTH)
AND s.rowid NOT IN (
SELECT DISTINCT a.fk_soc
FROM ".MAIN_DB_PREFIX."actioncomm as a
WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
AND a.fk_soc IS NOT NULL
AND NOT EXISTS (
SELECT id FROM ".MAIN_DB_PREFIX."actioncomm as a WHERE a.fk_soc = s.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
)
AND NOT EXISTS (
SELECT rowid FROM ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.rowid
)
",
"class" => "Societe",
"file" => DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php',
'fields_anonym' => array(
'name' => $langs->trans('ANONYME'),
'name' => 'MAKEANONYMOUS',
'name_bis' => '',
'name_alias' => '',
'address' => '',
@ -87,29 +86,28 @@ class DataPolicyCron
'state' => '',
'country' => '',
'state_id' => '',
'skype' => '',
'socialnetworks' => '',
'country_id' => '',
)
),
'DATAPOLICIES_TIERS_PROSPECT' => array(
'sql' => "
SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s
WHERE (s.fk_forme_juridique IN (11, 12, 13, 15, 17, 18, 19, 35, 60, 312, 316, 401, 600, 700, 1005) OR s.fk_typent = 8)
AND s.entity = %d
WHERE s.entity = %d
AND s.client = 2
AND s.fournisseur = 0
AND s.tms < DATE_SUB(NOW(), INTERVAL %d MONTH)
AND s.rowid NOT IN (
SELECT DISTINCT a.fk_soc
FROM ".MAIN_DB_PREFIX."actioncomm as a
WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
AND a.fk_soc IS NOT NULL
AND NOT EXISTS (
SELECT id FROM ".MAIN_DB_PREFIX."actioncomm as a WHERE a.fk_soc = s.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
)
AND NOT EXISTS (
SELECT rowid FROM ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.rowid
)
",
"class" => "Societe",
"file" => DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php',
'fields_anonym' => array(
'name' => $langs->trans('ANONYME'),
'name' => 'MAKEANONYMOUS',
'name_bis' => '',
'name_alias' => '',
'address' => '',
@ -122,29 +120,28 @@ class DataPolicyCron
'state' => '',
'country' => '',
'state_id' => '',
'skype' => '',
'socialnetworks' => '',
'country_id' => '',
)
),
'DATAPOLICIES_TIERS_PROSPECT_CLIENT' => array(
'sql' => "
SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s
WHERE (s.fk_forme_juridique IN (11, 12, 13, 15, 17, 18, 19, 35, 60, 312, 316, 401, 600, 700, 1005) OR s.fk_typent = 8)
AND s.entity = %d
WHERE s.entity = %d
AND s.client = 3
AND s.fournisseur = 0
AND s.tms < DATE_SUB(NOW(), INTERVAL %d MONTH)
AND s.rowid NOT IN (
SELECT DISTINCT a.fk_soc
FROM ".MAIN_DB_PREFIX."actioncomm as a
WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
AND a.fk_soc IS NOT NULL
AND NOT EXISTS (
SELECT id FROM ".MAIN_DB_PREFIX."actioncomm as a WHERE a.fk_soc = s.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
)
AND NOT EXISTS (
SELECT rowid FROM ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.rowid
)
",
"class" => "Societe",
"file" => DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php',
'fields_anonym' => array(
'name' => $langs->trans('ANONYME'),
'name' => 'MAKEANONYMOUS',
'name_bis' => '',
'name_alias' => '',
'address' => '',
@ -157,29 +154,28 @@ class DataPolicyCron
'state' => '',
'country' => '',
'state_id' => '',
'skype' => '',
'socialnetworks' => '',
'country_id' => '',
)
),
'DATAPOLICIES_TIERS_NIPROSPECT_NICLIENT' => array(
'sql' => "
SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s
WHERE (s.fk_forme_juridique IN (11, 12, 13, 15, 17, 18, 19, 35, 60, 312, 316, 401, 600, 700, 1005) OR s.fk_typent = 8)
AND s.entity = %d
WHERE s.entity = %d
AND s.client = 0
AND s.fournisseur = 0
AND s.tms < DATE_SUB(NOW(), INTERVAL %d MONTH)
AND s.rowid NOT IN (
SELECT DISTINCT a.fk_soc
FROM ".MAIN_DB_PREFIX."actioncomm as a
WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
AND a.fk_soc IS NOT NULL
AND NOT EXISTS (
SELECT id FROM ".MAIN_DB_PREFIX."actioncomm as a WHERE a.fk_soc = s.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
)
AND NOT EXISTS (
SELECT rowid FROM ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.rowid
)
",
"class" => "Societe",
"file" => DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php',
'fields_anonym' => array(
'name' => $langs->trans('ANONYME'),
'name' => 'MAKEANONYMOUS',
'name_bis' => '',
'name_alias' => '',
'address' => '',
@ -192,28 +188,27 @@ class DataPolicyCron
'state' => '',
'country' => '',
'state_id' => '',
'skype' => '',
'socialnetworks' => '',
'country_id' => '',
)
),
'DATAPOLICIES_TIERS_FOURNISSEUR' => array(
'sql' => "
SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s
WHERE (s.fk_forme_juridique IN (11, 12, 13, 15, 17, 18, 19, 35, 60, 312, 316, 401, 600, 700, 1005) OR s.fk_typent = 8)
AND s.entity = %d
WHERE s.entity = %d
AND s.fournisseur = 1
AND s.tms < DATE_SUB(NOW(), INTERVAL %d MONTH)
AND s.rowid NOT IN (
SELECT DISTINCT a.fk_soc
FROM ".MAIN_DB_PREFIX."actioncomm as a
WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
AND a.fk_contact IS NOT NULL
AND NOT EXISTS (
SELECT id FROM ".MAIN_DB_PREFIX."actioncomm as a WHERE a.fk_soc = s.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
)
AND NOT EXISTS (
SELECT rowid FROM ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.rowid
)
",
"class" => "Societe",
"file" => DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php',
'fields_anonym' => array(
'name' => $langs->trans('ANONYME'),
'name' => 'MAKEANONYMOUS',
'name_bis' => '',
'name_alias' => '',
'address' => '',
@ -226,7 +221,7 @@ class DataPolicyCron
'state' => '',
'country' => '',
'state_id' => '',
'skype' => '',
'socialnetworks' => '',
'country_id' => '',
)
),
@ -238,17 +233,17 @@ class DataPolicyCron
AND c.tms < DATE_SUB(NOW(), INTERVAL %d MONTH)
AND s.client = 1
AND s.fournisseur = 0
AND c.rowid NOT IN (
SELECT DISTINCT a.fk_contact
FROM ".MAIN_DB_PREFIX."actioncomm as a
WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
AND a.fk_contact IS NOT NULL
AND NOT EXISTS (
SELECT id FROM ".MAIN_DB_PREFIX."actioncomm as a WHERE a.fk_contact = c.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
)
AND NOT EXISTS (
SELECT rowid FROM ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.rowid
)
",
"class" => "Contact",
"file" => DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php',
'fields_anonym' => array(
'lastname' => $langs->trans('ANONYME'),
'lastname' => 'MAKEANONYMOUS',
'firstname' => '',
'civility_id' => '',
'poste' => '',
@ -264,8 +259,7 @@ class DataPolicyCron
'state' => '',
'country' => '',
'state_id' => '',
'skype' => '',
'jabberid' => '',
'socialnetworks' => '',
'country_id' => '',
)
),
@ -277,17 +271,17 @@ class DataPolicyCron
AND c.tms < DATE_SUB(NOW(), INTERVAL %d MONTH)
AND s.client = 2
AND s.fournisseur = 0
AND c.rowid NOT IN (
SELECT DISTINCT a.fk_contact
FROM ".MAIN_DB_PREFIX."actioncomm as a
WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
AND a.fk_contact IS NOT NULL
AND NOT EXISTS (
SELECT id FROM ".MAIN_DB_PREFIX."actioncomm as a WHERE a.fk_contact = c.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
)
AND NOT EXISTS (
SELECT rowid FROM ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.rowid
)
",
"class" => "Contact",
"file" => DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php',
'fields_anonym' => array(
'lastname' => $langs->trans('ANONYME'),
'lastname' => 'MAKEANONYMOUS',
'firstname' => '',
'civility_id' => '',
'poste' => '',
@ -303,8 +297,7 @@ class DataPolicyCron
'state' => '',
'country' => '',
'state_id' => '',
'skype' => '',
'jabberid' => '',
'socialnetworks' => '',
'country_id' => '',
)
),
@ -316,17 +309,17 @@ class DataPolicyCron
AND c.tms < DATE_SUB(NOW(), INTERVAL %d MONTH)
AND s.client = 3
AND s.fournisseur = 0
AND c.rowid NOT IN (
SELECT DISTINCT a.fk_contact
FROM ".MAIN_DB_PREFIX."actioncomm as a
WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
AND a.fk_contact IS NOT NULL
AND NOT EXISTS (
SELECT id FROM ".MAIN_DB_PREFIX."actioncomm as a WHERE a.fk_contact = c.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
)
AND NOT EXISTS (
SELECT rowid FROM ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.rowid
)
",
"class" => "Contact",
"file" => DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php',
'fields_anonym' => array(
'lastname' => $langs->trans('ANONYME'),
'lastname' => 'MAKEANONYMOUS',
'firstname' => '',
'civility_id' => '',
'poste' => '',
@ -342,8 +335,7 @@ class DataPolicyCron
'state' => '',
'country' => '',
'state_id' => '',
'skype' => '',
'jabberid' => '',
'socialnetworks' => '',
'country_id' => '',
)
),
@ -355,17 +347,17 @@ class DataPolicyCron
AND c.tms < DATE_SUB(NOW(), INTERVAL %d MONTH)
AND s.client = 0
AND s.fournisseur = 0
AND c.rowid NOT IN (
SELECT DISTINCT a.fk_contact
FROM ".MAIN_DB_PREFIX."actioncomm as a
WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
AND a.fk_contact IS NOT NULL
AND NOT EXISTS (
SELECT id FROM ".MAIN_DB_PREFIX."actioncomm as a WHERE a.fk_contact = c.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
)
AND NOT EXISTS (
SELECT rowid FROM ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.rowid
)
",
"class" => "Contact",
"file" => DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php',
'fields_anonym' => array(
'lastname' => $langs->trans('ANONYME'),
'lastname' => 'MAKEANONYMOUS',
'firstname' => '',
'civility_id' => '',
'poste' => '',
@ -381,8 +373,7 @@ class DataPolicyCron
'state' => '',
'country' => '',
'state_id' => '',
'skype' => '',
'jabberid' => '',
'socialnetworks' => '',
'country_id' => '',
)
),
@ -393,17 +384,17 @@ class DataPolicyCron
WHERE c.entity = %d
AND c.tms < DATE_SUB(NOW(), INTERVAL %d MONTH)
AND s.fournisseur = 1
AND c.rowid NOT IN (
SELECT DISTINCT a.fk_contact
FROM ".MAIN_DB_PREFIX."actioncomm as a
WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
AND a.fk_contact IS NOT NULL
AND NOT EXISTS (
SELECT id FROM ".MAIN_DB_PREFIX."actioncomm as a WHERE a.fk_contact = c.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
)
AND NOT EXISTS (
SELECT rowid FROM ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.rowid
)
",
"class" => "Contact",
"file" => DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php',
'fields_anonym' => array(
'lastname' => $langs->trans('ANONYME'),
'lastname' => 'MAKEANONYMOUS',
'firstname' => '',
'civility_id' => '',
'poste' => '',
@ -419,8 +410,7 @@ class DataPolicyCron
'state' => '',
'country' => '',
'state_id' => '',
'skype' => '',
'jabberid' => '',
'socialnetworks' => '',
'country_id' => '',
)
),
@ -429,19 +419,15 @@ class DataPolicyCron
SELECT a.rowid FROM ".MAIN_DB_PREFIX."adherent as a
WHERE a.entity = %d
AND a.tms < DATE_SUB(NOW(), INTERVAL %d MONTH)
AND a.rowid NOT IN (
SELECT DISTINCT a.fk_element
FROM ".MAIN_DB_PREFIX."actioncomm as a
WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH)
AND a.elementtype LIKE 'member'
AND a.fk_element IS NOT NULL
AND NOT EXISTS (
SELECT id FROM ".MAIN_DB_PREFIX."actioncomm as a WHERE a.fk_element = a.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) AND a.elementtype LIKE 'member'
)
",
"class" => "Adherent",
"file" => DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php',
'fields_anonym' => array(
'lastname' => $langs->trans('ANONYME'),
'firstname' => $langs->trans('ANONYME'),
'lastname' => 'MAKEANONYMOUS',
'firstname' => 'MAKEANONYMOUS',
'civility_id' => '',
'societe' => '',
'address' => '',
@ -456,7 +442,7 @@ class DataPolicyCron
'state' => '',
'country' => '',
'state_id' => '',
'skype' => '',
'socialnetworks' => '',
'country_id' => '',
)
),
@ -483,27 +469,27 @@ class DataPolicyCron
$object->fetch($obj->rowid);
$object->id = $obj->rowid;
if ($object->isObjectUsed($obj->rowid) > 0) { // If object to clean is used
foreach ($params['fields_anonym'] as $fields => $val) {
$object->$fields = $val;
}
$result = $object->update($obj->rowid, $user);
if ($result > 0) {
if ($params['class'] == 'Societe') {
// We delete contacts of thirdparty
$sql = "DELETE FROM ".MAIN_DB_PREFIX."socpeople WHERE fk_soc = ".$obj->rowid;
$result = $this->db->query($sql);
if ($result < 0) {
$errormsg = $this->db->lasterror();
$error++;
$action = 'anonymize'; // TODO Offer also action "delete" in setup of module
if ($action == 'anonymize') {
if ($object->isObjectUsed($obj->rowid) == 0) { // If object to clean is used
foreach ($params['fields_anonym'] as $fields => $val) {
if ($val == 'MAKEANONYMOUS') {
$object->$fields = $fields.'-anonymous-'.$obj->rowid;
} else {
$object->$fields = $val;
}
}
} else {
$errormsg = $object->error;
$error++;
$result = $object->update($obj->rowid, $user);
if ($result > 0) {
$errormsg = $object->error;
$error++;
}
$nbupdated++;
}
$nbupdated++;
} else { // If object to clean is not used
}
if ($action == 'delete') { // If object to clean is not used
if ($object->element == 'adherent') {
$result = $object->delete($obj->rowid, $user);
} else {

View File

@ -481,6 +481,13 @@ if ($object->id > 0) {
}
}
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreBoxStatsSupplier', $parameters, $object, $action);
if (empty($reshook)) {
$boxstat .= $hookmanager->resPrint;
}
$boxstat .= '</td></tr>';
$boxstat .= '</table>';
$boxstat .= '</div>';

View File

@ -1464,8 +1464,9 @@ if (!empty($conf->projet->enabled)) {
$formproject = new FormProjets($db);
}
$title = $langs->trans('SupplierOrder')." - ".$langs->trans('Card');
$help_url = 'EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores';
llxHeader('', $langs->trans("Order"), $help_url);
llxHeader('', $title, $help_url);
$now = dol_now();

View File

@ -98,8 +98,9 @@ if ($action == 'addcontact' && ($user->rights->fournisseur->commande->creer || $
/*
* View
*/
$title = $langs->trans('SupplierOrder')." - ".$langs->trans('ContactsAddresses');
$help_url = 'EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores';
llxHeader('', $langs->trans("Order"), $help_url);
llxHeader('', $title, $help_url);
$form = new Form($db);
$formcompany = new FormCompany($db);

View File

@ -94,9 +94,11 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
$form = new Form($db);
$title = $langs->trans('SupplierOrder')." - ".$langs->trans('Documents');
$help_url = 'EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores';
llxHeader('', $title, $help_url);
if ($object->id > 0) {
$help_url = 'EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores';
llxHeader('', $langs->trans("Order"), $help_url);
$object->fetch_thirdparty();

View File

@ -112,7 +112,7 @@ if ($id > 0 || !empty($ref)) {
$object->info($object->id);
}
$title = $langs->trans("SupplierOrder").' - '.$object->ref.' '.$object->name;
$title = $langs->trans("SupplierOrder").' - '.$langs->trans('Info').' - '.$object->ref.' '.$object->name;
if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
$title = $object->ref.' '.$object->name.' - '.$langs->trans("Info");
}

View File

@ -61,8 +61,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
/*
* View
*/
$title = $langs->trans('SupplierOrder')." - ".$langs->trans('Notes');
$help_url = 'EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores';
llxHeader('', $langs->trans("Order"), $help_url);
llxHeader('', $title, $help_url);
$form = new Form($db);

View File

@ -1768,7 +1768,7 @@ AGENDA_DEFAULT_VIEW=Which view do you want to open by default when selecting men
AGENDA_REMINDER_BROWSER=Enable event reminder <b>on user's browser</b> (When remind date is reached, a popup is shown by the browser. Each user can disable such notifications from its browser notification setup).
AGENDA_REMINDER_BROWSER_SOUND=Enable sound notification
AGENDA_REMINDER_EMAIL=Enable event reminder <b>by emails</b> (remind option/delay can be defined on each event).
AGENDA_REMINDER_EMAIL_NOTE=Note: The frequency of the task %s must be enough to be sure that the remind are sent at the correct moment.
AGENDA_REMINDER_EMAIL_NOTE=Note: The frequency of the scheduled job %s must be enough to be sure that the remind are sent at the correct moment.
AGENDA_SHOW_LINKED_OBJECT=Show linked object into agenda view
##### Clicktodial #####
ClickToDialSetup=Click To Dial module setup

View File

@ -1960,7 +1960,7 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
*/
function top_menu_user($hideloginname = 0, $urllogout = '')
{
global $langs, $conf, $db, $hookmanager, $user;
global $langs, $conf, $db, $hookmanager, $user, $mysoc;
global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager;
@ -1985,13 +1985,27 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
$dropdownBody .= '<span id="topmenulogincompanyinfo-btn"><i class="fa fa-caret-right"></i> '.$langs->trans("ShowCompanyInfos").'</span>';
$dropdownBody .= '<div id="topmenulogincompanyinfo" >';
if (!empty($conf->global->MAIN_INFO_SIREN)) $dropdownBody .= '<br><b>'.$langs->transcountry("ProfId1Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_SIREN).'</span>';
if (!empty($conf->global->MAIN_INFO_SIRET)) $dropdownBody .= '<br><b>'.$langs->transcountry("ProfId2Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_SIRET).'</span>';
if (!empty($conf->global->MAIN_INFO_APE)) $dropdownBody .= '<br><b>'.$langs->transcountry("ProfId3Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_APE).'</span>';
if (!empty($conf->global->MAIN_INFO_RCS)) $dropdownBody .= '<br><b>'.$langs->transcountry("ProfId4Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_RCS).'</span>';
if (!empty($conf->global->MAIN_INFO_PROFID5)) $dropdownBody .= '<br><b>'.$langs->transcountry("ProfId5Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_PROFID5).'</span>';
if (!empty($conf->global->MAIN_INFO_PROFID6)) $dropdownBody .= '<br><b>'.$langs->transcountry("ProfId6Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_PROFID6).'</span>';
if (!empty($conf->global->MAIN_INFO_TVAINTRA)) $dropdownBody .= '<br><b>'.$langs->trans("VATIntraShort").'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_TVAINTRA).'</span>';
if (!empty($conf->global->MAIN_INFO_SIREN)) {
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId1Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_SIREN).'</span>';
}
if (!empty($conf->global->MAIN_INFO_SIRET)) {
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId2Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_SIRET).'</span>';
}
if (!empty($conf->global->MAIN_INFO_APE)) {
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId3Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_APE).'</span>';
}
if (!empty($conf->global->MAIN_INFO_RCS)) {
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId4Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_RCS).'</span>';
}
if (!empty($conf->global->MAIN_INFO_PROFID5)) {
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId5Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_PROFID5).'</span>';
}
if (!empty($conf->global->MAIN_INFO_PROFID6)) {
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId6Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_PROFID6).'</span>';
}
if (!empty($conf->global->MAIN_INFO_TVAINTRA)) {
$dropdownBody .= '<br><b>'.$langs->trans("VATIntraShort").'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_TVAINTRA).'</span>';
}
$dropdownBody .= '</div>';

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2013-2016 Jean-François FERRY <hello@librethic.io>
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -211,14 +212,14 @@ if (empty($reshook)) {
}
// Auto assign user
if ($conf->global->TICKET_AUTO_ASSIGN_USER_CREATE) {
if (!empty($conf->global->TICKET_AUTO_ASSIGN_USER_CREATE)) {
$result = $object->assignUser($user, $user->id, 1);
$object->add_contact($user->id, "SUPPORTTEC", 'internal');
}
// Auto assign contrat
$contractid = 0;
if ($conf->global->TICKET_AUTO_ASSIGN_CONTRACT_CREATE) {
if (!empty($conf->global->TICKET_AUTO_ASSIGN_CONTRACT_CREATE)) {
$contrat = new Contrat($db);
$contrat->socid = $object->fk_soc;
$list = $contrat->getListOfContracts();
@ -233,7 +234,7 @@ if (empty($reshook)) {
}
// Auto create fiche intervention
if ($conf->global->TICKET_AUTO_CREATE_FICHINTER_CREATE) {
if (!empty($conf->global->TICKET_AUTO_CREATE_FICHINTER_CREATE)) {
$fichinter = new Fichinter($db);
$fichinter->socid = $object->fk_soc;
$fichinter->fk_project = $projectid;
@ -751,7 +752,7 @@ if ($action == 'create' || $action == 'presend') {
|| $action == 'editsubject' || $action == 'edit_extras' || $action == 'update_extras' || $action == 'edit_extrafields' || $action == 'set_extrafields' || $action == 'classify' || $action == 'sel_contract' || $action == 'edit_message_init' || $action == 'set_status' || $action == 'dellink') {
if ($res > 0) {
// or for unauthorized internals users
if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
accessforbidden('', 0, 1);
}
@ -853,7 +854,7 @@ if ($action == 'create' || $action == 'presend') {
print dol_get_fiche_end();
}
if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) {
if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) {
$object->next_prev_filter = "te.fk_user_assign = '".$user->id."'";
} elseif ($user->socid > 0) {
$object->next_prev_filter = "te.fk_soc = '".$user->socid."'";
@ -1030,7 +1031,7 @@ if ($action == 'create' || $action == 'presend') {
print '</tr>';
// Timing (Duration sum of linked fichinter)
if ($conf->fichinter->enabled) {
if ($conf->ficheinter->enabled) {
$object->fetchObjectLinked();
$num = count($object->linkedObjects);
$timing = 0;

View File

@ -37,6 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
$langs->loadLangs(array("companies", "other", "ticket", "mails"));
$id = GETPOST('id', 'int');
$socid = GETPOST('socid', 'int');
$ref = GETPOST('ref', 'alpha');
$track_id = GETPOST('track_id', 'alpha');
$action = GETPOST('action', 'alpha');
@ -104,7 +105,7 @@ if ($object->id) {
print dol_get_fiche_end();
}
if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) {
if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) {
$object->next_prev_filter = "te.fk_user_assign = '".$user->id."'";
} elseif ($user->socid > 0) {
$object->next_prev_filter = "te.fk_soc = '".$user->socid."'";

View File

@ -118,7 +118,7 @@ foreach ($object->fields as $key => $val) {
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array();
foreach ($object->fields as $key => $val) {
if ($val['searchall']) {
if (!empty($val['searchall'])) {
$fieldstosearchall['t.'.$key] = $val['label'];
}
}
@ -340,7 +340,7 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/, $/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (t.fk_soc = s.rowid)";

View File

@ -91,7 +91,7 @@ if ($user->socid > 0 && ($object->fk_soc != $user->socid)) {
accessforbidden();
}
// or for unauthorized internals users
if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
accessforbidden();
}
@ -146,7 +146,7 @@ if ($socid > 0) {
print dol_get_fiche_end();
}
if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) {
if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) {
$object->next_prev_filter = "te.fk_user_assign = '".$user->id."'";
} elseif ($user->socid > 0) {
$object->next_prev_filter = "te.fk_soc = '".$user->socid."'";