Merge branch 'develop' into patch-259291
This commit is contained in:
commit
dc0656bf02
54 changed files with 513 additions and 311 deletions
22
.github/workflows/ci-on-release.yml
vendored
Normal file
22
.github/workflows/ci-on-release.yml
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
name: "CI-RELEASE"
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
trigger-docker:
|
||||
steps:
|
||||
- name: Generate a token
|
||||
id: generate-token
|
||||
uses: actions/create-github-app-token@v2
|
||||
with:
|
||||
app-id: ${{ vars.RELEASE_DOCKER_ID }}
|
||||
private-key: ${{ secrets.RELEASE_DOCKER_SECRET }}
|
||||
|
||||
- uses: peter-evans/repository-dispatch@v4
|
||||
with:
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
repository: Dolibarr/dolibarr-docker
|
||||
event-type: new-release
|
||||
client-payload: '{"version": "${{ github.event.release.tag_name }}"}'
|
||||
Binary file not shown.
|
|
@ -61,7 +61,7 @@ if (empty($argv[1])) {
|
|||
$outputpath = $argv[1];
|
||||
$outputdir = dirname($outputpath);
|
||||
$outputfile = basename($outputpath);
|
||||
$outputfilerss = preg_replace('/\.\w+$/i', '', $outputfile).'-security.rss';
|
||||
$outputfilerss = preg_replace('/\.\w+$/i', '', $outputfile).'-security.rss'; // Replace the .html by -security.rss
|
||||
|
||||
if (!is_dir($outputdir)) {
|
||||
print 'Error: dir '.$outputdir.' does not exists or is not writable'."\n";
|
||||
|
|
@ -271,7 +271,7 @@ $nbofmonth = 6;
|
|||
$delay = (3600 * 24 * 30 * $nbofmonth);
|
||||
$arrayofalerts = array();
|
||||
|
||||
$commandcheck = "git log --all --shortstat --no-renames --use-mailmap --pretty=".escapeshellarg('format:%cI;%H;%aN;%aE;%ce;%s')." --since=".escapeshellarg(dol_print_date(dol_now() - $delay, '%Y-%m-%d'))." | grep -i -E ".escapeshellarg("(#yogosha|CVE|Sec:|Sec |Sec$)");
|
||||
$commandcheck = "git log --all --shortstat --no-renames --use-mailmap --pretty=".escapeshellarg('format:%cI;%H;%aN;%aE;%ce;%s')." --since=".escapeshellarg(dol_print_date(dol_now() - $delay, '%Y-%m-%d'))." | grep -i -E ".escapeshellarg("(#yogosha|CVE|Sec:|Sec |^Sec$)");
|
||||
print 'Execute git log to get commits related to security: '.$commandcheck."\n";
|
||||
$output_arrglpu = array();
|
||||
$resexecglpu = 0;
|
||||
|
|
@ -280,7 +280,7 @@ foreach ($output_arrglpu as $valgitlog) { // The most recent lines are first.
|
|||
// Parse the line to split interesting data
|
||||
$tmpval = cleanVal2($valgitlog);
|
||||
|
||||
if (preg_match('/(#yogosha|CVE[\s\-]*\d|Sec:|Sec\s|Sec$)/i', $tmpval['title'])) { // Recommended git comment: "Sec: Fix #..."
|
||||
if (preg_match('/(#yogosha|CVE[\s\-]*\d|Sec:|Sec\s|^Sec$)/i', $tmpval['title'])) { // Recommended git comment: "Sec: Fix #..."
|
||||
$alreadyfound = '';
|
||||
$alreadyfoundcommitid = '';
|
||||
foreach ($arrayofalerts as $val) { // Loop on already found alerts
|
||||
|
|
@ -932,7 +932,7 @@ $html .= '</div>';
|
|||
$html .= '</div>';
|
||||
|
||||
$html .= '<br>';
|
||||
$html .= 'Note:Search is done in git repository on regex string "#yogosha|CVE[\s\-]*\d|Sec:|Sec\s" (not case sensitive)<br>';
|
||||
$html .= 'Note:Search is done in git repository on regex string "#yogosha|CVE[\s\-]*\d|Sec:|Sec |^Sec\s" (not case sensitive)<br>';
|
||||
$html .= 'You can use this URL for RSS notifications: <a href="/'.$outputfilerss.'">'.$outputfilerss.'</a><br><br>';
|
||||
|
||||
$html .= '</section>';
|
||||
|
|
|
|||
|
|
@ -1048,7 +1048,7 @@ class Setup extends DolibarrApi
|
|||
global $langs;
|
||||
$langs->loadLangs(array('holiday'));
|
||||
|
||||
if (!DolibarrApiAccess::$user->hasRight('holiday', 'lire')) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('holiday', 'read')) {
|
||||
throw new RestException(403);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -747,25 +747,9 @@ class Asset extends CommonObject
|
|||
return -1;
|
||||
}
|
||||
|
||||
// Old request with 'WITH'
|
||||
/*
|
||||
$sql = "WITH in_accounting_bookkeeping(fk_docdet) AS (";
|
||||
$sql .= " SELECT DISTINCT fk_docdet";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
|
||||
$sql .= " WHERE doc_type = 'asset'";
|
||||
$sql .= ")";
|
||||
$sql .= "SELECT ad.rowid, ad.depreciation_mode, ad.ref, ad.depreciation_date, ad.depreciation_ht, ad.cumulative_depreciation_ht";
|
||||
$sql .= ", " . $this->db->ifsql('iab.fk_docdet IS NOT NULL', 1, 0) . " AS bookkeeping";
|
||||
$sql = "SELECT ad.rowid, ad.depreciation_mode, ad.ref, ad.depreciation_date, ad.depreciation_ht, ad.cumulative_depreciation_ht,";
|
||||
$sql .= " " . $this->db->ifsql('EXISTS (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type = \'asset\' AND ab.fk_docdet = ad.rowid)', '1', '0') . " AS bookkeeping";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad";
|
||||
$sql .= " LEFT JOIN in_accounting_bookkeeping as iab ON iab.fk_docdet = ad.rowid";
|
||||
$sql .= " WHERE ad.fk_asset = " . (int) $this->id;
|
||||
$sql .= " ORDER BY ad.depreciation_date ASC";
|
||||
*/
|
||||
|
||||
$sql = "SELECT ad.rowid, ad.depreciation_mode, ad.ref, ad.depreciation_date, ad.depreciation_ht, ad.cumulative_depreciation_ht";
|
||||
$sql .= ", " . $this->db->ifsql('iab.fk_docdet IS NOT NULL', '1', '0') . " AS bookkeeping";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad";
|
||||
$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
|
||||
$sql .= " WHERE ad.fk_asset = " . (int) $this->id;
|
||||
$sql .= " ORDER BY ad.depreciation_date ASC";
|
||||
|
||||
|
|
|
|||
|
|
@ -120,10 +120,9 @@ print '<span class="opacitymedium">'.$langs->trans("BlockedLogDesc")."</span><br
|
|||
|
||||
if ($mysoc->country_code == 'FR') {
|
||||
$htmltext = $langs->trans("UnalterableLogTool1FR").'<br>';
|
||||
print info_admin($htmltext, 0, 0, 'warning');
|
||||
}
|
||||
|
||||
print info_admin($htmltext, 0, 0, 'warning');
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : get
|
|||
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
|
||||
$hmacexportkey = GETPOST('hmacexportkey', 'password');
|
||||
//$hmacexportkey = GETPOST('hmacexportkey', 'password');
|
||||
|
||||
$search_showonlyerrors = GETPOSTINT('search_showonlyerrors');
|
||||
if ($search_showonlyerrors < 0) {
|
||||
|
|
@ -179,10 +179,12 @@ if (GETPOST('action') == 'export' && $user->hasRight('blockedlog', 'read')) { /
|
|||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Year")), null, "errors");
|
||||
$error++;
|
||||
}
|
||||
/*
|
||||
if (empty($hmacexportkey)) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Password")), null, "errors");
|
||||
$error++;
|
||||
}
|
||||
*/
|
||||
|
||||
$dates = dol_get_first_day(GETPOSTINT('yeartoexport'), GETPOSTINT('monthtoexport') ? GETPOSTINT('monthtoexport') : 1);
|
||||
$datee = dol_get_last_day(GETPOSTINT('yeartoexport'), GETPOSTINT('monthtoexport') ? GETPOSTINT('monthtoexport') : 12);
|
||||
|
|
@ -256,14 +258,17 @@ if (GETPOST('action') == 'export' && $user->hasRight('blockedlog', 'read')) { /
|
|||
$sql .= " FROM ".MAIN_DB_PREFIX."blockedlog";
|
||||
$sql .= " WHERE entity = ".((int) $conf->entity);
|
||||
if (GETPOSTINT('monthtoexport') > 0 || GETPOSTINT('yeartoexport') > 0) {
|
||||
$dates = dol_get_first_day(GETPOSTINT('yeartoexport'), GETPOSTINT('monthtoexport') ? GETPOSTINT('monthtoexport') : 1);
|
||||
$datee = dol_get_last_day(GETPOSTINT('yeartoexport'), GETPOSTINT('monthtoexport') ? GETPOSTINT('monthtoexport') : 12);
|
||||
$dates = dol_get_first_day(GETPOSTINT('yeartoexport'), GETPOSTINT('monthtoexport') > 0 ? GETPOSTINT('monthtoexport') : 1);
|
||||
$datee = dol_get_last_day(GETPOSTINT('yeartoexport'), GETPOSTINT('monthtoexport') > 0 ? GETPOSTINT('monthtoexport') : 12);
|
||||
$sql .= " AND date_creation BETWEEN '".$db->idate($dates)."' AND '".$db->idate($datee)."'";
|
||||
}
|
||||
$sql .= " ORDER BY rowid ASC"; // Required so later we can use the parameter $previoushash of checkSignature()
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$registrationnumber = getHashUniqueIdOfRegistration();
|
||||
$secretkey = $registrationnumber;
|
||||
|
||||
$yearmonthtoexport = GETPOSTINT('yeartoexport').(GETPOSTINT('monthtoexport') > 0 ? sprintf("%02d", GETPOSTINT('monthtoexport')) : '');
|
||||
$yearmonthdateofexport = dol_print_date(dol_now(), 'dayhourlog', 'gmt');
|
||||
|
||||
|
|
@ -275,7 +280,7 @@ if (GETPOST('action') == 'export' && $user->hasRight('blockedlog', 'read')) { /
|
|||
$fh = fopen($tmpfile, 'w');
|
||||
|
||||
// Print line with title
|
||||
fwrite($fh, "BEGIN - date=".$yearmonthdateofexport
|
||||
fwrite($fh, "BEGIN - date=".$yearmonthdateofexport." - period=".$yearmonthtoexport
|
||||
.';'.$langs->transnoentities('Id')
|
||||
.';'.$langs->transnoentities('DateCreation')
|
||||
.';'.$langs->transnoentities('Action')
|
||||
|
|
@ -290,6 +295,7 @@ if (GETPOST('action') == 'export' && $user->hasRight('blockedlog', 'read')) { /
|
|||
.';'.$langs->transnoentities('Fingerprint')
|
||||
.';'.$langs->transnoentities('Status')
|
||||
.';'.$langs->transnoentities('FingerprintExport')
|
||||
//.';'.$langs->transnoentities('FingerprintExportHMAC')
|
||||
."\n");
|
||||
|
||||
$loweridinerror = 0;
|
||||
|
|
@ -355,6 +361,7 @@ if (GETPOST('action') == 'export' && $user->hasRight('blockedlog', 'read')) { /
|
|||
}
|
||||
|
||||
$signatureexport = 'TODO';
|
||||
$signatureexporthmac = 'TODO';
|
||||
|
||||
fwrite($fh,
|
||||
';'.$block_static->id
|
||||
|
|
@ -370,7 +377,8 @@ if (GETPOST('action') == 'export' && $user->hasRight('blockedlog', 'read')) { /
|
|||
.';"'.str_replace('"', '""', $block_static->object_version).'";"'
|
||||
.str_replace('"', '""', $block_static->signature).'";"'
|
||||
.str_replace('"', '""', $statusofrecord).'";"'
|
||||
.str_replace('"', '""', $signatureexport).'"'
|
||||
.str_replace('"', '""', $signatureexport).'";'
|
||||
//.str_replace('"', '""', $signatureexporthmac).'"'
|
||||
//.';'.$statusofrecordnote
|
||||
."\n");
|
||||
|
||||
|
|
@ -384,11 +392,11 @@ if (GETPOST('action') == 'export' && $user->hasRight('blockedlog', 'read')) { /
|
|||
|
||||
// Calculate the md5 of the file (the last line has a return line)
|
||||
$algo = 'sha256';
|
||||
$secretkey = 'TODOASKBEFOREEXPORT';
|
||||
$sha256 = hash_file($algo, $tmpfile);
|
||||
$hmacsha256 = hash_hmac_file($algo, $tmpfile, $secretkey);
|
||||
|
||||
// Now add a signature to check integrity at end of file
|
||||
file_put_contents($tmpfile, 'END - hmac_sha256='.$hmacsha256, FILE_APPEND);
|
||||
file_put_contents($tmpfile, 'END - sha256='.$sha256.' - hmac_sha256='.$hmacsha256, FILE_APPEND);
|
||||
|
||||
setEventMessages($langs->trans("FileGenerated"), null);
|
||||
} else {
|
||||
|
|
@ -540,7 +548,8 @@ print '<input type="text" name="yeartoexport" class="valignmiddle maxwidth75imp"
|
|||
|
||||
print ' ';
|
||||
|
||||
print '<input type="text" name="hmacexportkey" class="valignmiddle minwidth150imp maxwidth300imp" required value="'.GETPOST('hmacexportkey').'" placeholder="'.$langs->trans("Password").'">';
|
||||
// Disabled, we will use the getHashUniqueIdOfRegistration() as secret HMAC
|
||||
//print '<input type="text" name="hmacexportkey" class="valignmiddle minwidth150imp maxwidth300imp" required value="'.GETPOST('hmacexportkey').'" placeholder="'.$langs->trans("Password").'">';
|
||||
|
||||
print ' ';
|
||||
|
||||
|
|
|
|||
|
|
@ -426,7 +426,7 @@ $htmltext = '';
|
|||
$htmltext .= $langs->trans("UnalterableLogTool2", $langs->transnoentitiesnoconv("Archives"))."<br>";
|
||||
$htmltext .= $langs->trans("UnalterableLogTool3")."<br>";
|
||||
|
||||
print info_admin($htmltext);
|
||||
print info_admin($htmltext, 0, 0, 'warning');
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
|
|
|||
|
|
@ -129,6 +129,8 @@ function formatObject($objtoshow, $prefix)
|
|||
'pos_source' => "POSTerminal",
|
||||
'posmodule' => 'POSModule',
|
||||
'posnumber' => 'POSTerminal',
|
||||
'pos_print_counter' => "NumberOfPrints",
|
||||
'email_sent_counter' => "NumberOfEmailsSent",
|
||||
'managers' => 'Managers',
|
||||
'type_code' => 'PaymentMode',
|
||||
'datec' => 'DateCreation',
|
||||
|
|
@ -153,11 +155,13 @@ function formatObject($objtoshow, $prefix)
|
|||
'tva_tx' => 'VatRate',
|
||||
'localtax1_tx' => 'Localtax1Rate',
|
||||
'localtax2_tx' => 'Localtax2Rate',
|
||||
'vat_src_code' => 'VatCode',
|
||||
'multicurrency_code' => 'Currency',
|
||||
'qty' => 'Quantity',
|
||||
'nom' => 'Name',
|
||||
'name' => 'Name',
|
||||
'email' => 'Email',
|
||||
'state_code' => 'State',
|
||||
'revenuestamp' => 'RevenueStamp',
|
||||
'code_client' => 'CustomerCode',
|
||||
'capital' => 'Capital',
|
||||
|
|
@ -167,9 +171,10 @@ function formatObject($objtoshow, $prefix)
|
|||
'localtax2_value' => 'LocalTax2DefaultValue',
|
||||
'subprice' => 'UnitPrice',
|
||||
'product_type' => 'ProductType',
|
||||
'product_label' => 'ProductLabel',
|
||||
'type' => 'InvoiceType',
|
||||
'info_bits' => 'TVA NPR or NOT',
|
||||
'special_code' => 'Special line (WEEE line, option, id of module...)'
|
||||
'special_code' => 'Special line (WEEE line, option, id of module...)',
|
||||
);
|
||||
|
||||
if (is_object($newobjtoshow) || is_array($newobjtoshow)) {
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ class BlockedLog
|
|||
|
||||
$sep = 0;
|
||||
|
||||
// Customer Invoice/Facture / Payment
|
||||
// Customer Invoice/Facture / Payment (For most VAT antifraud laws)
|
||||
if (isModEnabled('invoice')) {
|
||||
$sep++;
|
||||
$this->trackedevents['separator_'.$sep] = array('id' => 'separator_'.$sep, 'label' => '----------', 'labelhtml' => '<span class="opacitymedium">----- '.$langs->trans("Invoices").' | '.$langs->trans("Payments").'</span>', 'disabled' => 1);
|
||||
|
|
@ -221,7 +221,7 @@ class BlockedLog
|
|||
*/
|
||||
|
||||
// Donation
|
||||
if (isModEnabled('don')) {
|
||||
if (isModEnabled('don') && getDolGlobalString('BLOCKEDLOG_ENABLE_DONATION')) { // For countries that need unalterable logs for donations
|
||||
if (!empty($this->trackedevents)) {
|
||||
$sep++;
|
||||
$this->trackedevents['separator_'.$sep] = array('id' => 'separator_'.$sep, 'label' => '----------', 'labelhtml' => '<span class="opacitymedium">----- '.$langs->trans("Donations").' | '.$langs->trans("Payments").'</span>', 'disabled' => 1);
|
||||
|
|
@ -244,7 +244,7 @@ class BlockedLog
|
|||
*/
|
||||
|
||||
// Members
|
||||
if (isModEnabled('member')) {
|
||||
if (isModEnabled('member') && getDolGlobalString('BLOCKEDLOG_ENABLE_MEMBER')) { // For countries that need unalterable logs for membership management
|
||||
if (!empty($this->trackedevents)) {
|
||||
$sep++;
|
||||
$this->trackedevents['separator_'.$sep] = array('id' => 'separator_'.$sep, 'label' => '----------', 'labelhtml' => '<span class="opacitymedium">----- '.$langs->trans("MenuMembers").'</span>', 'disabled' => 1);
|
||||
|
|
@ -256,6 +256,7 @@ class BlockedLog
|
|||
}
|
||||
|
||||
// Bank
|
||||
/*
|
||||
if (isModEnabled("bank")) {
|
||||
if (!empty($this->trackedevents)) {
|
||||
$sep++;
|
||||
|
|
@ -266,6 +267,7 @@ class BlockedLog
|
|||
$this->trackedevents['PAYMENT_VARIOUS_MODIFY'] = array('id' => 'PAYMENT_VARIOUS_MODIFY', 'label' => 'logPAYMENT_VARIOUS_MODIFY', 'labelhtml' => img_picto('', 'bank', 'class="pictofixedwidth").').$langs->trans('logPAYMENT_VARIOUS_MODIFY'));
|
||||
$this->trackedevents['PAYMENT_VARIOUS_DELETE'] = array('id' => 'PAYMENT_VARIOUS_DELETE', 'label' => 'logPAYMENT_VARIOUS_DELETE', 'labelhtml' => img_picto('', 'bank', 'class="pictofixedwidth").').$langs->trans('logPAYMENT_VARIOUS_DELETE'));
|
||||
}
|
||||
*/
|
||||
|
||||
// Cash register closing
|
||||
// $conf->global->BANK_ENABLE_POS_CASHCONTROL must be set to 1 by all external POS modules
|
||||
|
|
@ -279,8 +281,8 @@ class BlockedLog
|
|||
$this->trackedevents['CASHCONTROL_VALIDATE'] = array('id' => 'CASHCONTROL_VALIDATE', 'label' => 'logCASHCONTROL_VALIDATE', 'labelhtml' => img_picto('', 'pos', 'class="pictofixedwidth").').$langs->trans('logCASHCONTROL_VALIDATE'));
|
||||
}
|
||||
|
||||
// Add more action to track from a conf variable
|
||||
// For example: STOCK_MOVEMENT,...
|
||||
// Add more action to track from a conf variable. For the case we want to track other actions into the unalterable log.
|
||||
// For example: STOCK_MOVEMENT, ...
|
||||
if (getDolGlobalString('BLOCKEDLOG_ADD_ACTIONS_SUPPORTED')) {
|
||||
if (!empty($this->trackedevents)) {
|
||||
$sep++;
|
||||
|
|
@ -515,7 +517,8 @@ class BlockedLog
|
|||
'table_element', 'fields',
|
||||
'ref_previous', 'ref_next',
|
||||
'origin', 'origin_id',
|
||||
'oldcopy', 'picto', 'error', 'errors', 'model_pdf', 'modelpdf', 'last_main_doc', 'civility_id', 'contact', 'contact_id',
|
||||
'oldcopy', 'picto', 'error', 'errors',
|
||||
'model_pdf', 'modelpdf', 'last_main_doc', 'civility_id', 'contact', 'contact_id',
|
||||
'table_element_line', 'ismultientitymanaged', 'isextrafieldmanaged',
|
||||
'array_languages',
|
||||
'childtables',
|
||||
|
|
@ -554,17 +557,32 @@ class BlockedLog
|
|||
// List of fields qualified
|
||||
if (!in_array($key, array(
|
||||
'name', 'name_alias', 'ref_ext', 'address', 'zip', 'town', 'state_code', 'country_code', 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', 'phone', 'fax', 'email', 'barcode',
|
||||
'tva_intra', 'tva_assuj', 'localtax1_assuj', 'localtax1_value', 'localtax2_assuj', 'localtax2_value', 'managers', 'capital', 'typent_code', 'forme_juridique_code', 'code_client', 'code_fournisseur'
|
||||
'tva_intra', 'tva_assuj', 'localtax1_assuj', 'localtax2_assuj', 'managers', 'capital', 'typent_code', 'forme_juridique_code', 'code_client', 'code_fournisseur'
|
||||
))) {
|
||||
continue; // Discard if not into this dedicated list
|
||||
}
|
||||
if (!is_object($value) && !is_null($value) && $value !== '') {
|
||||
|
||||
$valuequalifiedforstorage = false;
|
||||
if (!is_object($value)) {
|
||||
if (empty($value) && in_array($key, array('country_code', 'idprof1', 'idprof2', 'tva_intra'))) {
|
||||
$valuequalifiedforstorage = true; // We accept '' value for some fields
|
||||
$value = (string) $value;
|
||||
}
|
||||
if (!is_null($value) && empty($value) && in_array($key, array('tva_assuj', 'localtax1_assuj', 'localtax2_assuj'))) {
|
||||
$valuequalifiedforstorage = true; // We accept zero value for amounts
|
||||
}
|
||||
if (!is_null($value) && (string) $value !== '') {
|
||||
$valuequalifiedforstorage = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($valuequalifiedforstorage) {
|
||||
$this->object_data->thirdparty->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add company info
|
||||
// Add my company info
|
||||
if (!empty($mysoc)) {
|
||||
$this->object_data->mycompany = new stdClass();
|
||||
|
||||
|
|
@ -572,14 +590,29 @@ class BlockedLog
|
|||
if (in_array($key, $arrayoffieldstoexclude)) {
|
||||
continue; // Discard some properties
|
||||
}
|
||||
// List of fields qualified
|
||||
// List of fields qualified to keep
|
||||
if (!in_array($key, array(
|
||||
'name', 'name_alias', 'ref_ext', 'address', 'zip', 'town', 'state_code', 'country_code', 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', 'phone', 'fax', 'email', 'barcode',
|
||||
'tva_assuj', 'tva_intra', 'localtax1_assuj', 'localtax1_value', 'localtax2_assuj', 'localtax2_value', 'managers', 'capital', 'typent_code', 'forme_juridique_code', 'code_client', 'code_fournisseur'
|
||||
))) {
|
||||
continue; // Discard if not into this dedicated list
|
||||
}
|
||||
if (!is_object($value) && !is_null($value) && $value !== '') {
|
||||
|
||||
$valuequalifiedforstorage = false;
|
||||
if (!is_object($value)) {
|
||||
if (empty($value) && in_array($key, array('country_code', 'idprof1', 'idprof2', 'tva_intra'))) {
|
||||
$valuequalifiedforstorage = true; // We accept '' value for some fields
|
||||
$value = (string) $value;
|
||||
}
|
||||
if (!is_null($value) && empty($value) && in_array($key, array('tva_assuj'))) {
|
||||
$valuequalifiedforstorage = true; // We accept zero value for amounts
|
||||
}
|
||||
if (!is_null($value) && (string) $value !== '') {
|
||||
$valuequalifiedforstorage = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($valuequalifiedforstorage) {
|
||||
$this->object_data->mycompany->$key = $value;
|
||||
}
|
||||
}
|
||||
|
|
@ -600,10 +633,14 @@ class BlockedLog
|
|||
}
|
||||
// List of fields qualified
|
||||
if (!in_array($key, array(
|
||||
'ref', 'ref_client', 'ref_supplier', 'date', 'datef', 'datev', 'type', 'total_ht', 'total_tva', 'total_ttc', 'localtax1', 'localtax2', 'revenuestamp', 'datepointoftax', 'note_public', 'lines',
|
||||
'module_source', 'pos_source'
|
||||
'ref', 'ref_client', 'ref_supplier', 'date', 'datef', 'datev', 'type',
|
||||
//'vat_src_code', 'tva_tx', 'localtax1_tx', 'localtax2_tx', There is no rate at full doc level
|
||||
'total_ht', 'total_tva', 'total_ttc', 'localtax1', 'localtax2',
|
||||
'revenuestamp', 'datepointoftax', 'note_public',
|
||||
'lines',
|
||||
'module_source', 'pos_source', 'pos_print_counter', 'email_sent_counter'
|
||||
))) {
|
||||
continue; // Discard if not into a dedicated list
|
||||
continue; // Discarded if not into the dedicated list
|
||||
}
|
||||
if ($key == 'lines') {
|
||||
$lineid = 0;
|
||||
|
|
@ -612,8 +649,7 @@ class BlockedLog
|
|||
foreach ($tmpline as $keyline => $valueline) {
|
||||
if (!in_array($keyline, array(
|
||||
'ref', 'product_type', 'product_label',
|
||||
'qty',
|
||||
'subprice',
|
||||
'qty', 'subprice',
|
||||
'vat_src_code', 'tva_tx', 'localtax1_tx', 'localtax2_tx',
|
||||
'total_ht', 'total_tva', 'total_ttc', 'total_localtax1', 'total_localtax2',
|
||||
'multicurrency_code', 'multicurrency_total_ht', 'multicurrency_total_tva', 'multicurrency_total_ttc',
|
||||
|
|
@ -626,13 +662,43 @@ class BlockedLog
|
|||
$this->object_data->invoiceline[$lineid] = new stdClass();
|
||||
}
|
||||
|
||||
if (!is_object($valueline) && !is_null($valueline) && $valueline !== '') {
|
||||
$valuequalifiedforstorage = false;
|
||||
if (!is_object($valueline)) {
|
||||
if (!is_null($valueline) && empty($valueline) && in_array($key, array('tva_tx', 'localtax1_tx', 'localtax2_tx', 'total_ht', 'total_tva', 'total_ttc', 'total_localtax1', 'total_localtax2'))) {
|
||||
$valuequalifiedforstorage = true; // We accept zero value for amounts
|
||||
}
|
||||
if (!is_null($valueline) && (string) $valueline !== '') {
|
||||
$valuequalifiedforstorage = true;
|
||||
}
|
||||
}
|
||||
if ($keyline == 'product_label' && empty($valueline)) {
|
||||
$valueline = dol_trunc(dolGetFirstLineOfText($tmpline->desc)); // Fallback on description if label is empty
|
||||
$valuequalifiedforstorage = true;
|
||||
}
|
||||
|
||||
if ($valuequalifiedforstorage) {
|
||||
$this->object_data->invoiceline[$lineid]->$keyline = $valueline;
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif (!is_object($value) && !is_null($value) && $value !== '') {
|
||||
$this->object_data->$key = $value;
|
||||
} else {
|
||||
$valuequalifiedforstorage = false;
|
||||
if (!is_object($value)) {
|
||||
if (empty($value) && in_array($key, array('pos_source', 'module_source'))) {
|
||||
$valuequalifiedforstorage = true; // We accept '' value for some fields
|
||||
$value = (string) $value;
|
||||
}
|
||||
if (!is_null($value) && empty($value) && in_array($key, array('total_ht', 'total_tva', 'total_ttc', 'localtax1', 'localtax2', 'pos_print_counter', 'email_sent_counter'))) {
|
||||
$valuequalifiedforstorage = true; // We accept zero value for amounts
|
||||
}
|
||||
if (!is_null($value) && (string) $value !== '') {
|
||||
$valuequalifiedforstorage = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($valuequalifiedforstorage) {
|
||||
$this->object_data->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -651,7 +717,22 @@ class BlockedLog
|
|||
))) {
|
||||
continue; // Discard if not into a dedicated list
|
||||
}
|
||||
if (!is_object($value) && !is_null($value) && $value !== '') {
|
||||
|
||||
$valuequalifiedforstorage = false;
|
||||
if (!is_object($value)) {
|
||||
if (empty($value) && in_array($key, array('pos_source', 'module_source'))) {
|
||||
$valuequalifiedforstorage = true; // We accept '' value for some fields
|
||||
$value = (string) $value;
|
||||
}
|
||||
if (!is_null($value) && empty($value) && in_array($key, array('total_ht', 'total_tva', 'total_ttc', 'localtax1', 'localtax2', 'pos_print_counter', 'email_sent_counter'))) {
|
||||
$valuequalifiedforstorage = true; // We accept zero value for amounts
|
||||
}
|
||||
if (!is_null($value) && (string) $value !== '') {
|
||||
$valuequalifiedforstorage = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($valuequalifiedforstorage) {
|
||||
$this->object_data->$key = $value;
|
||||
}
|
||||
}
|
||||
|
|
@ -679,7 +760,7 @@ class BlockedLog
|
|||
|
||||
$totalamount = 0;
|
||||
|
||||
// Loop on each invoice payment amount (payment_part)
|
||||
// Loop on each invoice payment amount (the payment_part)
|
||||
if (is_array($object->amounts) && !empty($object->amounts)) {
|
||||
$paymentpartnumber = 0;
|
||||
foreach ($object->amounts as $objid => $amount) {
|
||||
|
|
@ -738,7 +819,7 @@ class BlockedLog
|
|||
if (in_array($key, $arrayoffieldstoexclude)) {
|
||||
continue; // Discard some properties
|
||||
}
|
||||
// List of fields qualified
|
||||
// List of thirdparty fields qualified
|
||||
if (!in_array($key, array(
|
||||
'name', 'name_alias', 'ref_ext', 'address', 'zip', 'town', 'state_code', 'country_code', 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', 'phone', 'fax', 'email', 'barcode',
|
||||
'tva_intra', 'localtax1_assuj', 'localtax1_value', 'localtax2_assuj', 'localtax2_value', 'managers', 'capital', 'typent_code', 'forme_juridique_code', 'code_client', 'code_fournisseur'
|
||||
|
|
@ -754,6 +835,8 @@ class BlockedLog
|
|||
// Init object to avoid warnings
|
||||
if ($this->element == 'payment_donation') {
|
||||
$paymentpart->donation = new stdClass();
|
||||
} elseif ($this->element == 'payment_various') {
|
||||
$paymentpart->various = new stdClass();
|
||||
} else {
|
||||
$paymentpart->invoice = new stdClass();
|
||||
}
|
||||
|
|
@ -765,11 +848,27 @@ class BlockedLog
|
|||
}
|
||||
// List of fields qualified
|
||||
if (!in_array($key, array(
|
||||
'ref', 'ref_client', 'ref_supplier', 'date', 'datef', 'type', 'total_ht', 'total_tva', 'total_ttc', 'localtax1', 'localtax2', 'revenuestamp', 'datepointoftax', 'note_public'
|
||||
'ref', 'ref_client', 'ref_supplier', 'date', 'datef', 'type', 'total_ht', 'total_tva', 'total_ttc', 'localtax1', 'localtax2', 'revenuestamp', 'datepointoftax', 'note_public',
|
||||
'pos_source', 'module_source', 'pos_print_counter', 'email_sent_counter'
|
||||
))) {
|
||||
continue; // Discard if not into a dedicated list
|
||||
}
|
||||
if (!is_object($value) && !is_null($value) && $value !== '') {
|
||||
|
||||
$valuequalifiedforstorage = false;
|
||||
if (!is_object($value)) {
|
||||
if (empty($value) && in_array($key, array('pos_source', 'module_source'))) {
|
||||
$valuequalifiedforstorage = true; // We accept '' value for some fields
|
||||
$value = (string) $value;
|
||||
}
|
||||
if (!is_null($value) && empty($value) && in_array($key, array('total_ht', 'total_tva', 'total_ttc', 'localtax1', 'localtax2', 'pos_print_counter', 'email_sent_counter'))) {
|
||||
$valuequalifiedforstorage = true; // We accept zero value for amounts
|
||||
}
|
||||
if (!is_null($value) && (string) $value !== '') {
|
||||
$valuequalifiedforstorage = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($valuequalifiedforstorage) {
|
||||
if ($this->element == 'payment_donation') {
|
||||
$paymentpart->donation->$key = $value;
|
||||
} elseif ($this->element == 'payment_various') {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
* Copyright (C) 2023 William Mead <william.mead@manchenumerique.fr>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
|
||||
* Copyright (C) 2025 Benjamin Falière <benjamin@faliere.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -1956,6 +1957,12 @@ if (empty($reshook)) {
|
|||
|
||||
$type = $product->type;
|
||||
$price_base_type = $product->price_base_type;
|
||||
|
||||
// If base type TTc, we change pu value to define the TTC one
|
||||
if ($price_base_type == 'TTC') {
|
||||
$pu = $pu_ttc;
|
||||
}
|
||||
|
||||
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
|
||||
|
||||
$price_min = $product->price_min;
|
||||
|
|
@ -3521,14 +3528,15 @@ if ($action == 'create') {
|
|||
if (empty($reshook)) {
|
||||
if ($action != 'editline') {
|
||||
// Subtotal
|
||||
if ($object->status == Propal::STATUS_DRAFT && isModEnabled('subtotals') && getDolGlobalString('SUBTOTAL_TITLE_' . strtoupper($object->element))) {
|
||||
if ($object->status == Propal::STATUS_DRAFT && isModEnabled('subtotals')
|
||||
&& (getDolGlobalInt('SUBTOTAL_TITLE_'.strtoupper($object->element)) || getDolGlobalInt('SUBTOTAL_'.strtoupper($object->element)))) {
|
||||
$langs->load('subtotals');
|
||||
|
||||
$url_button = array();
|
||||
|
||||
$url_button[] = array(
|
||||
'lang' => 'subtotals',
|
||||
'enabled' => (isModEnabled('propal') && $object->status == Propal::STATUS_DRAFT),
|
||||
'enabled' => (isModEnabled('propal') && $object->status == Propal::STATUS_DRAFT && getDolGlobalInt('SUBTOTAL_TITLE_'.strtoupper($object->element))),
|
||||
'perm' => (bool) $usercancreate,
|
||||
'label' => $langs->trans('AddTitleLine'),
|
||||
'url' => '/comm/propal/card.php?id=' . $object->id . '&action=add_title_line&token=' . newToken()
|
||||
|
|
@ -3536,7 +3544,7 @@ if ($action == 'create') {
|
|||
|
||||
$url_button[] = array(
|
||||
'lang' => 'subtotals',
|
||||
'enabled' => (isModEnabled('propal') && $object->status == Propal::STATUS_DRAFT),
|
||||
'enabled' => (isModEnabled('propal') && $object->status == Propal::STATUS_DRAFT && getDolGlobalInt('SUBTOTAL_'.strtoupper($object->element))),
|
||||
'perm' => (bool) $usercancreate,
|
||||
'label' => $langs->trans('AddSubtotalLine'),
|
||||
'url' => '/comm/propal/card.php?id=' . $object->id . '&action=add_subtotal_line&token=' . newToken()
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
* Copyright (C) 2022 ATM Consulting <contact@atm-consulting.fr>
|
||||
* Copyright (C) 2022 OpenDSI <support@open-dsi.fr>
|
||||
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
* Copyright (C) 2023 William Mead <william.mead@manchenumerique.fr>
|
||||
* Copyright (C) 2023 William Mead <william@m34d.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -1879,6 +1879,8 @@ class Propal extends CommonObject
|
|||
$sql .= " deposit_percent = ".(!empty($this->deposit_percent) ? "'".$this->db->escape($this->deposit_percent)."'" : "null").",";
|
||||
$sql .= " fk_mode_reglement = ".(!empty($this->mode_reglement_id) ? (int) $this->mode_reglement_id : "null").",";
|
||||
$sql .= " fk_input_reason = ".(!empty($this->demand_reason_id) ? (int) $this->demand_reason_id : "null").",";
|
||||
$sql .= " fk_shipping_method = ".(isset($this->shipping_method_id) ? (int) $this->shipping_method_id : "null").",";
|
||||
$sql .= " fk_availability = ".(!empty($this->availability_id) ? (int) $this->availability_id : "null").",";
|
||||
$sql .= " note_private = ".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").",";
|
||||
$sql .= " note_public = ".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").",";
|
||||
$sql .= " model_pdf = ".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null").",";
|
||||
|
|
|
|||
|
|
@ -3450,14 +3450,15 @@ if ($action == 'create' && $usercancreate) {
|
|||
}
|
||||
|
||||
// Subtotal
|
||||
if ($object->status == Commande::STATUS_DRAFT && isModEnabled('subtotals') && getDolGlobalString('SUBTOTAL_TITLE_' . strtoupper($object->element))) {
|
||||
if ($object->status == Commande::STATUS_DRAFT && isModEnabled('subtotals')
|
||||
&& (getDolGlobalInt('SUBTOTAL_TITLE_'.strtoupper($object->element)) || getDolGlobalInt('SUBTOTAL_'.strtoupper($object->element)))) {
|
||||
$langs->load('subtotals');
|
||||
|
||||
$url_button = array();
|
||||
|
||||
$url_button[] = array(
|
||||
'lang' => 'subtotals',
|
||||
'enabled' => (isModEnabled('order') && $object->status == Commande::STATUS_DRAFT),
|
||||
'enabled' => (isModEnabled('order') && $object->status == Commande::STATUS_DRAFT && getDolGlobalInt('SUBTOTAL_TITLE_'.strtoupper($object->element))),
|
||||
'perm' => (bool) $usercancreate,
|
||||
'label' => $langs->trans('AddTitleLine'),
|
||||
'url' => '/commande/card.php?id=' . $object->id . '&action=add_title_line&token=' . newToken()
|
||||
|
|
@ -3465,7 +3466,7 @@ if ($action == 'create' && $usercancreate) {
|
|||
|
||||
$url_button[] = array(
|
||||
'lang' => 'subtotals',
|
||||
'enabled' => (isModEnabled('order') && $object->status == Commande::STATUS_DRAFT),
|
||||
'enabled' => (isModEnabled('order') && $object->status == Commande::STATUS_DRAFT && getDolGlobalInt('SUBTOTAL_'.strtoupper($object->element))),
|
||||
'perm' => (bool) $usercancreate,
|
||||
'label' => $langs->trans('AddSubtotalLine'),
|
||||
'url' => '/commande/card.php?id=' . $object->id . '&action=add_subtotal_line&token=' . newToken()
|
||||
|
|
|
|||
|
|
@ -2076,14 +2076,15 @@ if ($action == 'create') {
|
|||
);
|
||||
|
||||
// Subtotal
|
||||
if (empty($object->suspended) && isModEnabled('subtotals') && getDolGlobalString('SUBTOTAL_TITLE_'.strtoupper($object->element))) {
|
||||
if (empty($object->suspended) && isModEnabled('subtotals')
|
||||
&& (getDolGlobalInt('SUBTOTAL_TITLE_'.strtoupper($object->element)) || getDolGlobalInt('SUBTOTAL_'.strtoupper($object->element)))) {
|
||||
$langs->load("subtotals");
|
||||
|
||||
$url_button = array();
|
||||
|
||||
$url_button[] = array(
|
||||
'lang' => 'subtotals',
|
||||
'enabled' => (isModEnabled('invoice') && $object->status == Facture::STATUS_DRAFT),
|
||||
'enabled' => (isModEnabled('invoice') && $object->status == Facture::STATUS_DRAFT && getDolGlobalInt('SUBTOTAL_TITLE_'.strtoupper($object->element))),
|
||||
'perm' => (bool) $usercancreate,
|
||||
'label' => $langs->trans('AddTitleLine'),
|
||||
'url' => '/compta/facture/card-rec.php?id='.$object->id.'&action=add_title_line&token='.newToken()
|
||||
|
|
@ -2091,7 +2092,7 @@ if ($action == 'create') {
|
|||
|
||||
$url_button[] = array(
|
||||
'lang' => 'subtotals',
|
||||
'enabled' => (isModEnabled('invoice') && $object->status == Facture::STATUS_DRAFT),
|
||||
'enabled' => (isModEnabled('invoice') && $object->status == Facture::STATUS_DRAFT && getDolGlobalInt('SUBTOTAL_'.strtoupper($object->element))),
|
||||
'perm' => (bool) $usercancreate,
|
||||
'label' => $langs->trans('AddSubtotalLine'),
|
||||
'url' => '/compta/facture/card-rec.php?id='.$object->id.'&action=add_subtotal_line&token='.newToken()
|
||||
|
|
|
|||
|
|
@ -6560,14 +6560,15 @@ if ($action == 'create') {
|
|||
}
|
||||
|
||||
// Subtotal
|
||||
if ($object->status == Facture::STATUS_DRAFT && isModEnabled('subtotals') && getDolGlobalString('SUBTOTAL_TITLE_'.strtoupper($object->element))) {
|
||||
if ($object->status == Facture::STATUS_DRAFT && isModEnabled('subtotals')
|
||||
&& (getDolGlobalInt('SUBTOTAL_TITLE_'.strtoupper($object->element)) || getDolGlobalInt('SUBTOTAL_'.strtoupper($object->element)))) {
|
||||
$langs->load("subtotals");
|
||||
|
||||
$url_button = array();
|
||||
|
||||
$url_button[] = array(
|
||||
'lang' => 'subtotals',
|
||||
'enabled' => (isModEnabled('invoice') && $object->status == Facture::STATUS_DRAFT),
|
||||
'enabled' => (isModEnabled('invoice') && $object->status == Facture::STATUS_DRAFT && getDolGlobalInt('SUBTOTAL_TITLE_'.strtoupper($object->element))),
|
||||
'perm' => (bool) $usercancreate,
|
||||
'label' => $langs->trans('AddTitleLine'),
|
||||
'url' => '/compta/facture/card.php?facid='.$object->id.'&action=add_title_line&token='.newToken()
|
||||
|
|
@ -6575,7 +6576,7 @@ if ($action == 'create') {
|
|||
|
||||
$url_button[] = array(
|
||||
'lang' => 'subtotals',
|
||||
'enabled' => (isModEnabled('invoice') && $object->status == Facture::STATUS_DRAFT),
|
||||
'enabled' => (isModEnabled('invoice') && $object->status == Facture::STATUS_DRAFT && getDolGlobalInt('SUBTOTAL_'.strtoupper($object->element))),
|
||||
'perm' => (bool) $usercancreate,
|
||||
'label' => $langs->trans('AddSubtotalLine'),
|
||||
'url' => '/compta/facture/card.php?facid='.$object->id.'&action=add_subtotal_line&token='.newToken()
|
||||
|
|
|
|||
|
|
@ -801,7 +801,8 @@ if ($sql) {
|
|||
print '</div></div></div>';
|
||||
|
||||
$parameters = array('user' => $user);
|
||||
$reshook = $hookmanager->executeHooks('dashboardAccountancy', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$object = null;
|
||||
$reshook = $hookmanager->executeHooks('dashboardAccountancy', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ class Contracts extends DolibarrApi
|
|||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('contrat', $this->contract->id)) {
|
||||
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
throw new RestException(403, 'Access to this contract is not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$this->contract->fetchObjectLinked();
|
||||
|
|
@ -175,7 +175,6 @@ class Contracts extends DolibarrApi
|
|||
$sql .= $this->db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
dol_syslog("API Rest request");
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
|
|
@ -234,8 +233,19 @@ class Contracts extends DolibarrApi
|
|||
{
|
||||
global $conf;
|
||||
if (!DolibarrApiAccess::$user->hasRight('contrat', 'creer')) {
|
||||
throw new RestException(403, "Insufficient rights");
|
||||
throw new RestException(403, "Missing permission: Create/modify contracts/subscriptions");
|
||||
}
|
||||
|
||||
$socid = (int) $request_data['socid'];
|
||||
$thirdpartytmp = new Societe($this->db);
|
||||
$thirdparty_result = $thirdpartytmp->fetch($socid);
|
||||
if ($thirdparty_result < 1) {
|
||||
throw new RestException(404, 'Thirdparty with id='.$socid.' not found or not allowed');
|
||||
}
|
||||
if (!DolibarrApi::_checkAccessToResource('societe', $thirdpartytmp->id)) {
|
||||
throw new RestException(404, 'Thirdparty with id='.$thirdpartytmp->id.' not found or not allowed');
|
||||
}
|
||||
|
||||
// Check mandatory fields
|
||||
$result = $this->_validate($request_data);
|
||||
|
||||
|
|
@ -308,7 +318,7 @@ class Contracts extends DolibarrApi
|
|||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('contrat', $this->contract->id)) {
|
||||
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
throw new RestException(403, 'Access to this contract is not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$obj_ret = [];
|
||||
|
|
@ -340,7 +350,6 @@ class Contracts extends DolibarrApi
|
|||
$sql .= $this->db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
dol_syslog("API Rest request");
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
|
|
@ -400,7 +409,7 @@ class Contracts extends DolibarrApi
|
|||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('contrat', $this->contract->id)) {
|
||||
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
throw new RestException(403, 'Access to this contract is not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$request_data = (object) $request_data;
|
||||
|
|
@ -460,7 +469,7 @@ class Contracts extends DolibarrApi
|
|||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('contrat', $this->contract->id)) {
|
||||
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
throw new RestException(403, 'Access to this contract is not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$request_data = (object) $request_data;
|
||||
|
|
@ -611,7 +620,7 @@ class Contracts extends DolibarrApi
|
|||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('contrat', $this->contract->id)) {
|
||||
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
throw new RestException(403, 'Access to this contract is not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$updateRes = $this->contract->active_line(DolibarrApiAccess::$user, $lineid, (int) $datestart, $dateend, $comment);
|
||||
|
|
@ -652,7 +661,7 @@ class Contracts extends DolibarrApi
|
|||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('contrat', $this->contract->id)) {
|
||||
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
throw new RestException(403, 'Access to this contract is not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$updateRes = $this->contract->close_line(DolibarrApiAccess::$user, $lineid, (int) $datestart, $comment);
|
||||
|
|
@ -692,7 +701,7 @@ class Contracts extends DolibarrApi
|
|||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('contrat', $this->contract->id)) {
|
||||
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
throw new RestException(403, 'Access to this contract is not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
// TODO Check the lineid $lineid is a line of object
|
||||
|
|
@ -727,13 +736,24 @@ class Contracts extends DolibarrApi
|
|||
if ($id == 0) {
|
||||
throw new RestException(400, 'No contract with id=0 can exist');
|
||||
}
|
||||
|
||||
$result = $this->contract->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Contrat not found');
|
||||
}
|
||||
|
||||
$old_socid = $this->contract->socid;
|
||||
$oldthirdpartytmp = new Societe($this->db);
|
||||
$old_thirdparty_result = $oldthirdpartytmp->fetch($old_socid);
|
||||
if ($old_thirdparty_result < 1) {
|
||||
throw new RestException(404, 'Thirdparty with id='.$old_socid.' not found or not allowed');
|
||||
}
|
||||
if (!DolibarrApi::_checkAccessToResource('societe', $old_socid)) {
|
||||
throw new RestException(403, 'Access to old thirdparty='.$old_socid.' is not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('contrat', $this->contract->id)) {
|
||||
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
throw new RestException(403, 'Access to this contract is not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
foreach ($request_data as $field => $value) {
|
||||
if ($field == 'id') {
|
||||
|
|
@ -763,6 +783,18 @@ class Contracts extends DolibarrApi
|
|||
continue;
|
||||
}
|
||||
|
||||
if ($field == 'socid') {
|
||||
$new_socid = (int) $value;
|
||||
$loopthirdpartytmp = new Societe($this->db);
|
||||
$new_thirdparty_result = $loopthirdpartytmp->fetch($new_socid);
|
||||
if ($new_thirdparty_result < 1) {
|
||||
throw new RestException(404, 'Thirdparty with id='.$new_socid.' not found or not allowed');
|
||||
}
|
||||
if (!DolibarrApi::_checkAccessToResource('societe', $new_socid)) {
|
||||
throw new RestException(403, 'Access to new thirdparty='.$new_socid.' is not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
}
|
||||
|
||||
$this->contract->$field = $this->_checkValForAPI($field, $value, $this->contract);
|
||||
}
|
||||
|
||||
|
|
@ -790,7 +822,7 @@ class Contracts extends DolibarrApi
|
|||
public function delete($id)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->hasRight('contrat', 'supprimer')) {
|
||||
throw new RestException(403);
|
||||
throw new RestException(403, 'Missing permission: Delete contracts/subscriptions');
|
||||
}
|
||||
if ($id == 0) {
|
||||
throw new RestException(400, 'No contract with id=0 can exist');
|
||||
|
|
@ -801,7 +833,7 @@ class Contracts extends DolibarrApi
|
|||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('contrat', $this->contract->id)) {
|
||||
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
throw new RestException(403, 'Access to this contract is not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if (!$this->contract->delete(DolibarrApiAccess::$user)) {
|
||||
|
|
@ -854,7 +886,7 @@ class Contracts extends DolibarrApi
|
|||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('contrat', $this->contract->id)) {
|
||||
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
throw new RestException(403, 'Access to this contract is not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$result = $this->contract->validate(DolibarrApiAccess::$user, '', $notrigger);
|
||||
|
|
@ -911,7 +943,7 @@ class Contracts extends DolibarrApi
|
|||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('contrat', $this->contract->id)) {
|
||||
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
throw new RestException(403, 'Access to this contract is not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$result = $this->contract->closeAll(DolibarrApiAccess::$user, $notrigger);
|
||||
|
|
|
|||
|
|
@ -9874,7 +9874,7 @@ abstract class CommonObject
|
|||
}
|
||||
}
|
||||
|
||||
if (empty($buyPrice) && isset($conf->global->MARGIN_TYPE) && in_array($conf->global->MARGIN_TYPE, array('1', 'pmp', 'costprice'))) {
|
||||
if (empty($buyPrice) && in_array(getDolGlobalString('MARGIN_TYPE'), array('1', 'pmp', 'costprice'))) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
$productFournisseur = new ProductFournisseur($this->db);
|
||||
if (($result = $productFournisseur->find_min_price_product_fournisseur($fk_product)) > 0) {
|
||||
|
|
|
|||
|
|
@ -1261,7 +1261,7 @@ function GETPOSTDATE($prefix, $hourTime = '', $gm = 'auto', $saverestore = '')
|
|||
if ($hourTime === 'getpost' || $hourTime === 'getpostend') {
|
||||
$hour = (GETPOSTISSET($prefix . 'hour') && GETPOSTINT($prefix . 'hour') >= 0) ? GETPOSTINT($prefix . 'hour') : ($hourTime === 'getpostend' ? 23 : 0);
|
||||
$minute = (GETPOSTISSET($prefix . 'min') && GETPOSTINT($prefix . 'min') >= 0) ? GETPOSTINT($prefix . 'min') : ($hourTime === 'getpostend' ? 59 : 0);
|
||||
$second = (GETPOSTISSET($prefix . 'second') && GETPOSTINT($prefix . 'second') >= 0) ? GETPOSTINT($prefix . 'second') : ($hourTime === 'getpostend' ? 59 : 0);
|
||||
$second = (GETPOSTISSET($prefix . 'sec') && GETPOSTINT($prefix . 'sec') >= 0) ? GETPOSTINT($prefix . 'sec') : ($hourTime === 'getpostend' ? 59 : 0);
|
||||
} elseif (preg_match('/^(\d\d):(\d\d):(\d\d)$/', $hourTime, $m)) {
|
||||
$hour = intval($m[1]);
|
||||
$minute = intval($m[2]);
|
||||
|
|
@ -7579,7 +7579,7 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
|
|||
//print $amount."-";
|
||||
$data = explode('.', $amount);
|
||||
$decpart = isset($data[1]) ? $data[1] : '';
|
||||
$decpart = preg_replace('/0+$/i', '', $decpart); // Supprime les 0 de fin de partie decimale
|
||||
$decpart = preg_replace('/0+$/i', '', $decpart); // Remove 0 at end of decimal part
|
||||
//print "decpart=".$decpart."<br>";
|
||||
$end = '';
|
||||
|
||||
|
|
@ -7662,7 +7662,7 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
|
|||
*/
|
||||
function price2num($amount, $rounding = '', $option = 0)
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $langs;
|
||||
|
||||
// Clean parameters
|
||||
if (is_null($amount)) {
|
||||
|
|
@ -12698,7 +12698,6 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type,
|
|||
function printCommonFooter($zone = 'private')
|
||||
{
|
||||
global $conf, $hookmanager, $user, $langs;
|
||||
global $debugbar;
|
||||
global $action;
|
||||
global $micro_start_time;
|
||||
|
||||
|
|
@ -12712,8 +12711,9 @@ function printCommonFooter($zone = 'private')
|
|||
print "\n<!-- A div to store page_y POST parameter -->\n";
|
||||
print '<div id="page_y" style="display: none;">' . (GETPOST('page_y') ? GETPOST('page_y') : '') . '</div>' . "\n";
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printCommonFooter', $parameters); // Note that $action and $object may have been modified by some hooks
|
||||
$parameters = array('zone' => $zone);
|
||||
$tmpobject = null;
|
||||
$reshook = $hookmanager->executeHooks('printCommonFooter', $parameters, $tmpobject, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if (empty($reshook)) {
|
||||
if (getDolGlobalString('MAIN_HTML_FOOTER')) {
|
||||
print getDolGlobalString('MAIN_HTML_FOOTER') . "\n";
|
||||
|
|
@ -12907,7 +12907,7 @@ function printCommonFooter($zone = 'private')
|
|||
print "\n" . '</script>' . "\n";
|
||||
|
||||
// Google Analytics
|
||||
// TODO Add a hook here
|
||||
// TODO Remove this, can be replaced with the hook printCommonFooter
|
||||
if (isModEnabled('google') && getDolGlobalString('MAIN_GOOGLE_AN_ID')) {
|
||||
$tmptagarray = explode(',', getDolGlobalString('MAIN_GOOGLE_AN_ID'));
|
||||
foreach ($tmptagarray as $tmptag) {
|
||||
|
|
@ -12933,15 +12933,23 @@ function printCommonFooter($zone = 'private')
|
|||
print_r(xdebug_get_code_coverage());
|
||||
}
|
||||
|
||||
// Output string from hooks
|
||||
if (!empty($hookmanager->resPrint)) {
|
||||
print $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
// Add DebugBar data
|
||||
if ($user->hasRight('debugbar', 'read') && $debugbar instanceof DebugBar\DebugBar) {
|
||||
if (isset($debugbar['time'])) {
|
||||
// @phan-suppress-next-line PhanPluginUnknownObjectMethodCall
|
||||
$debugbar['time']->stopMeasure('pageaftermaster');
|
||||
if ($user->hasRight('debugbar', 'read')) {
|
||||
global $debugbar;
|
||||
if ($debugbar instanceof DebugBar\DebugBar) {
|
||||
if (isset($debugbar['time'])) {
|
||||
// @phan-suppress-next-line PhanPluginUnknownObjectMethodCall
|
||||
$debugbar['time']->stopMeasure('pageaftermaster');
|
||||
}
|
||||
print '<!-- Output debugbar data -->' . "\n";
|
||||
$renderer = $debugbar->getJavascriptRenderer();
|
||||
print $renderer->render();
|
||||
}
|
||||
print '<!-- Output debugbar data -->' . "\n";
|
||||
$renderer = $debugbar->getJavascriptRenderer();
|
||||
print $renderer->render();
|
||||
} elseif (count($conf->logbuffer)) { // If there is some logs in buffer to show
|
||||
print "\n";
|
||||
print "<!-- Start of log output\n";
|
||||
|
|
@ -16819,8 +16827,8 @@ function buildParamDate($prefix, $timestamp = null, $hourTime = '', $gm = 'auto'
|
|||
if ($hourTime === 'getpost' || ($timestamp !== null && dol_print_date($timestamp, '%H:%M:%S') !== '00:00:00')) {
|
||||
$TParam = array_merge($TParam, array(
|
||||
$prefix . 'hour' => intval(dol_print_date($timestamp, '%H')),
|
||||
$prefix . 'minute' => intval(dol_print_date($timestamp, '%M')),
|
||||
$prefix . 'second' => intval(dol_print_date($timestamp, '%S'))
|
||||
$prefix . 'min' => intval(dol_print_date($timestamp, '%M')),
|
||||
$prefix . 'sec' => intval(dol_print_date($timestamp, '%S'))
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1771,7 +1771,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
|||
|
||||
// Note
|
||||
print '<td class="center">';
|
||||
print '<textarea name="'.$lines[$i]->id.'note" rows="'.ROWS_2.'" id="'.$lines[$i]->id.'note"'.($disabledtask ? ' disabled="disabled"' : '').'>';
|
||||
print '<textarea class="padding3" name="'.$lines[$i]->id.'note" rows="'.ROWS_2.'" id="'.$lines[$i]->id.'note"'.($disabledtask ? ' disabled="disabled"' : '').'>';
|
||||
print '</textarea>';
|
||||
print '</td>';
|
||||
|
||||
|
|
|
|||
|
|
@ -1021,14 +1021,14 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
|
|||
$checkonentitydone = 0;
|
||||
|
||||
// Array to define rules of checks to do
|
||||
$check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'payment_sc', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website', 'recruitment', 'chargesociales', 'knowledgemanagement'); // Test on entity only (Objects with no link to company)
|
||||
$check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'payment_sc', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website', 'recruitment', 'chargesociales', 'knowledgemanagement', 'stock'); // Test on entity only (Objects with no link to company)
|
||||
$checksoc = array('societe'); // Test for object Societe
|
||||
$checkparentsoc = array('agenda', 'contact', 'contrat'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...).
|
||||
$checkproject = array('projet', 'project'); // Test for project object
|
||||
$checktask = array('projet_task', 'project_task'); // Test for task object
|
||||
$checkhierarchy = array('expensereport', 'holiday', 'hrm'); // check permission among the hierarchy of user
|
||||
$checkuser = array('bookmark'); // check permission among the fk_user (must be myself or null)
|
||||
$nocheck = array('barcode', 'stock', 'webhook'); // No test
|
||||
$nocheck = array('barcode', 'webhook'); // No test
|
||||
|
||||
//$checkdefault = 'all other not already defined'; // Test on entity + link to third party on field $dbt_keyfield. Not allowed if link is empty (Ex: invoice, orders...).
|
||||
|
||||
|
|
|
|||
|
|
@ -50,14 +50,14 @@ if ($type == 'title') {
|
|||
$formquestion = array(
|
||||
array('type' => 'text', 'name' => 'subtotallinedesc', 'label' => $langs->trans("SubtotalLineDesc"), 'moreattr' => 'placeholder="' . $langs->trans("Description") . '"'),
|
||||
array('type' => 'select', 'name' => 'subtotallinelevel', 'label' => $langs->trans("SubtotalLineLevel"), 'values' => $depth_array, 'default' => 1, 'select_show_empty' => 0),
|
||||
array('type' => 'checkbox', 'value' => false, 'name' => 'titleshowuponpdf', 'label' => $langs->trans("ShowUPOnPDF")),
|
||||
array('type' => 'checkbox', 'value' => false, 'name' => 'titleshowtotalexludingvatonpdf', 'label' => $langs->trans("ShowTotalExludingVATOnPDF")),
|
||||
array('type' => 'checkbox', 'value' => true, 'name' => 'titleshowuponpdf', 'label' => $langs->trans("ShowUPOnPDF")),
|
||||
array('type' => 'checkbox', 'value' => true, 'name' => 'titleshowtotalexludingvatonpdf', 'label' => $langs->trans("ShowTotalExludingVATOnPDF")),
|
||||
array('type' => 'checkbox', 'value' => false, 'name' => 'titleforcepagebreak', 'label' => $langs->trans("ForcePageBreak")),
|
||||
);
|
||||
} elseif ($type == 'subtotal') {
|
||||
$formquestion = array(
|
||||
array('type' => 'select', 'name' => 'subtotaltitleline', 'label' => $langs->trans("CorrespondingTitleLine"), 'values' => $titles, 'select_show_empty' => 0),
|
||||
array('type' => 'checkbox', 'value' => false, 'name' => 'subtotalshowtotalexludingvatonpdf', 'label' => $langs->trans("ShowTotalExludingVATOnPDF")),
|
||||
array('type' => 'checkbox', 'value' => true, 'name' => 'subtotalshowtotalexludingvatonpdf', 'label' => $langs->trans("ShowTotalExludingVATOnPDF")),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -329,7 +329,7 @@ if (empty($reshook)) {
|
|||
$object->date_shipping = $date_shipping; // Sending date
|
||||
$object->shipping_method_id = GETPOSTINT('shipping_method_id');
|
||||
$object->tracking_number = GETPOST('tracking_number', 'alpha');
|
||||
$object->note = GETPOST('note', 'restricthtml'); // deprecated
|
||||
$object->note = GETPOST('note_private', 'restricthtml'); // deprecated
|
||||
$object->note_private = GETPOST('note_private', 'restricthtml');
|
||||
$object->note_public = GETPOST('note_public', 'restricthtml');
|
||||
$object->fk_incoterms = GETPOSTINT('incoterm_id');
|
||||
|
|
@ -337,8 +337,6 @@ if (empty($reshook)) {
|
|||
|
||||
$product = new Product($db);
|
||||
|
||||
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
if ($ret < 0) {
|
||||
|
|
@ -371,7 +369,7 @@ if (empty($reshook)) {
|
|||
$object->date_shipping = $date_shipping; // Sending date
|
||||
$object->shipping_method_id = GETPOSTINT('shipping_method_id');
|
||||
$object->tracking_number = GETPOST('tracking_number', 'alpha');
|
||||
$object->note = GETPOST('note', 'restricthtml'); // deprecated
|
||||
$object->note = GETPOST('note_private', 'restricthtml'); // deprecated
|
||||
$object->note_private = GETPOST('note_private', 'restricthtml');
|
||||
$object->note_public = GETPOST('note_public', 'restricthtml');
|
||||
$object->fk_incoterms = GETPOSTINT('incoterm_id');
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
* Copyright (C) 2023-2024 William Mead <william.mead@manchenumerique.fr>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
|
||||
* Copyright (C) 2025 Pierre Ardoin <developpeur@lesmetiersdubatiment.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
|
||||
|
|
|
|||
|
|
@ -707,6 +707,7 @@ class FactureFournisseurRec extends CommonInvoice
|
|||
$this->socid = $obj->fk_soc;
|
||||
$this->date_creation = $obj->datec;
|
||||
$this->date_modification = $obj->tms;
|
||||
$this->status = $obj->suspended;
|
||||
$this->suspended = $obj->suspended;
|
||||
$this->libelle = $obj->label;
|
||||
$this->label = $obj->label;
|
||||
|
|
@ -1186,7 +1187,7 @@ class FactureFournisseurRec extends CommonInvoice
|
|||
return -1;
|
||||
}
|
||||
|
||||
if ($this->status == self::STATUS_SUSPENDED) {
|
||||
if ($this->suspended == self::STATUS_SUSPENDED) {
|
||||
// Clean parameters
|
||||
$fk_product = empty($fk_product) ? 0 : $fk_product;
|
||||
$label = empty($label) ? '' : $label;
|
||||
|
|
|
|||
|
|
@ -359,8 +359,8 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
|||
} else {
|
||||
$sql .= "null,";
|
||||
}
|
||||
$sql .= "'".$this->db->escape((string) $this->product_type)."',";
|
||||
$sql .= ((int) $this->special_code) . ",";
|
||||
$sql .= ((int) $this->product_type).",";
|
||||
$sql .= ((int) $this->special_code).",";
|
||||
$sql .= "'".$this->db->escape((string) $this->rang)."',";
|
||||
$sql .= "'".$this->db->escape((string) $this->qty)."', ";
|
||||
$sql .= " ".(empty($this->vat_src_code) ? "''" : "'".$this->db->escape((string) $this->vat_src_code)."'").",";
|
||||
|
|
|
|||
|
|
@ -3679,9 +3679,9 @@ if ($action == 'create') {
|
|||
$s = '<span class="hideonsmartphone opacitymedium">' . $langs->trans("ReCalculate") . ' </span>';
|
||||
$s .= '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=calculate&token='.newToken().'&calculationrule=totalofround">' . $langs->trans("Mode1") . '</a>';
|
||||
$s .= ' / ';
|
||||
$s .= '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=calculate&token='.newToken().'&calculationrule=roundoftotal">' . $langs->trans("Mode2") . '</a>';
|
||||
$s .= '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=calculate&token='.newToken().'&calculationrule=roundoftotal">' . ($conf->dol_optimize_smallscreen ? "2" : $langs->trans("Mode2")) . '</a>';
|
||||
print '<div class="inline-block">';
|
||||
print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc", $calculationrulenum) . '<br>' . $langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('', 'help'), '', 3, '', 0, 'recalculate');
|
||||
print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc", $calculationrulenum) . '<br>' . $langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('', 'help', 'class="paddingleft paddingright"'), '', 3, '', 0, 'recalculate');
|
||||
print ' ';
|
||||
print '</div>';
|
||||
}
|
||||
|
|
@ -3817,7 +3817,7 @@ if ($action == 'create') {
|
|||
$bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
|
||||
}
|
||||
|
||||
print '<td class="right">';
|
||||
print '<td class="right nowraponall">';
|
||||
if ($objp->baid > 0) {
|
||||
print $bankaccountstatic->getNomUrl(1, 'transactions');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ class Evaluation extends CommonObject
|
|||
}
|
||||
|
||||
if (!$user->hasRight('hrm', 'evaluation', 'readall')) {
|
||||
$this->fields['fk_user']['type'] .= ':t.rowid:IN:'.$this->db->sanitize(implode(",", $user->getAllChildIds(1)));
|
||||
$this->fields['fk_user']['type'] .= ' AND (t.rowid:IN:'.$this->db->sanitize(implode(",", $user->getAllChildIds(1))) .')';
|
||||
}
|
||||
|
||||
$this->date_eval = dol_now();
|
||||
|
|
|
|||
|
|
@ -105,8 +105,9 @@ $permissiontoread = $user->hasRight('hrm', 'evaluation', 'read'); // Used by the
|
|||
// Security check (enable the most restrictive one)
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, 'fk_soc', 'rowid', $isdraft);
|
||||
$isdraft = $object->status == Evaluation::STATUS_DRAFT ? 1 : 0;
|
||||
restrictedArea($user, $object->element, $object, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
|
||||
if (!isModEnabled('hrm')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,10 +71,8 @@ $permission = $user->hasRight('hrm', 'evaluation', 'write');
|
|||
// Security check (enable the most restrictive one)
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
//if (empty($conf->hrm->enabled)) accessforbidden();
|
||||
//if (!$permissiontoread) accessforbidden();
|
||||
$isdraft = $object->status == Evaluation::STATUS_DRAFT ? 1 : 0;
|
||||
restrictedArea($user, $object->element, $object, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -95,16 +95,12 @@ $permissiontoadd = $user->hasRight('hrm', 'evaluation', 'write'); // Used by th
|
|||
$permissiontoread = $user->hasRight('hrm', 'evaluation', 'read');
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
if (empty($conf->hrm->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$permissiontoread) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$isdraft = $object->status == Evaluation::STATUS_DRAFT ? 1 : 0;
|
||||
restrictedArea($user, $object->element, $object, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
|
||||
if (!isModEnabled('hrm')) accessforbidden();
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -75,10 +75,10 @@ $permissiontoread = $user->hasRight('hrm', 'evaluation', 'read'); // Used by th
|
|||
// Security check (enable the most restrictive one)
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
//if (empty($conf->hrm->enabled)) accessforbidden();
|
||||
//if (!$permissiontoread) accessforbidden();
|
||||
$isdraft = (($object->status == Evaluation::STATUS_DRAFT) ? 1 : 0);
|
||||
restrictedArea($user, $object->element, $object, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
if (empty($conf->hrm->enabled)) accessforbidden();
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1898,7 +1898,7 @@ if ($step == 5 && $datatoimport) {
|
|||
//dol_syslog("line ".$sourcelinenb.' - '.$nboflines.' - '.$excludefirstline.' - '.$endatlinenb);
|
||||
$arrayrecord = $obj->import_read_record();
|
||||
if ($arrayrecord === false) {
|
||||
$arrayofwarnings[$sourcelinenb][0] = array('lib' => 'File has '.$nboflines.' lines. However we reach the end of file or an empty line at record '.$sourcelinenb.'. This may occurs when some records are split onto several lines and not correctly delimited by the "Char delimiter", or if there is line with no data on all fields.', 'type' => 'EOF_RECORD_ON_SEVERAL_LINES');
|
||||
$arrayofwarnings[$sourcelinenb][0] = array('lib' => $langs->trans('ErrorFileLinesReachEOF', $nboflines, $sourcelinenb), 'type' => 'EOF_RECORD_ON_SEVERAL_LINES');
|
||||
$endoffile++;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -2321,7 +2321,7 @@ if ($step == 6 && $datatoimport) {
|
|||
$sourcelinenb++;
|
||||
$arrayrecord = $obj->import_read_record();
|
||||
if ($arrayrecord === false) {
|
||||
$arrayofwarnings[$sourcelinenb][0] = array('lib' => 'File has '.$nboflines.' lines. However we reach the end of file or an empty line at record '.$sourcelinenb.'. This may occurs when some records are split onto several lines and not correctly delimited by the "Char delimiter", or if there is line with no data on all fields.', 'type' => 'EOF_RECORD_ON_SEVERAL_LINES');
|
||||
$arrayofwarnings[$sourcelinenb][0] = array('lib' => $langs->trans('ErrorFileLinesReachEOF', $nboflines, $sourcelinenb), 'type' => 'EOF_RECORD_ON_SEVERAL_LINES');
|
||||
$endoffile++;
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Fingerprints=Archived events and fingerprints
|
|||
FingerprintsDesc=This is the tool to browse or extract the unalterable logs. Unalterable logs are generated and store into a dedicated table of the systel, in real time when a business event appears.
|
||||
ArchivesDesc=You can use this tool to export Unalterable Logs into archive files. They are kept into the system but you should download and copy them into external supports.
|
||||
UnalterableLogTool1=The law of some countries (like in France when doing B2C), ask that you do it on a regular basis.
|
||||
UnalterableLogTool1FR=In France, you MUST generate archives, at least, once every year, we recommand to do it once per month. Also, you MUST keep these archives for at least 7 years. According to the law, It is the user's responsibility to store their archives on media that guarantee their preservation, including in the event of hardware failure, so we recommand to store them on at least 2 different physical supports.
|
||||
UnalterableLogTool1FR=In France, you MUST generate archives of the unalterable logs, at least, once every year. We recommand to do it once per month. Also, you MUST keep these archives for at least 7 years. According to the law, It is the user's responsibility to store their archives on media that guarantee their preservation, including in the event of hardware failure, so we recommand to store them on at least 2 different physical supports.
|
||||
UnalterableLogTool2=This unalterable Logs contains the history of unalterable data. It is the responsibility of the application user to ensure system backups, in order to comply with legal obligations. If you decide to secure your unalterable logs by exporting and storing archives files instead of a full database backup (tab <b>%s</b>), it is recommended to store the exported archive files in different places (Secured cloud, External USB drive, ...).
|
||||
UnalterableLogTool3=Note that, there is no feature to purge this log and every change tried to be done directly into this log (by a hacker for example) will be reported with a non-valid fingerprint.
|
||||
FingerprintsDesc2=If you really need to purge this table because you used your application for a demo/test purpose and want to clean your data to start your production, you can ask your reseller or integrator to reset your database (all your data will be removed).
|
||||
|
|
@ -24,6 +24,7 @@ BlockedlogInfoDialog=Log Details
|
|||
ListOfTrackedEvents=List of tracked events
|
||||
Fingerprint=Fingerprint
|
||||
FingerprintExport=Fingerprint export
|
||||
FingerprintExportHMAC=Fingerprint export HMAC
|
||||
DownloadLogCSV=Export unalterable logs (CSV)
|
||||
DataOfArchivedEvent=Complete data of archived event
|
||||
DataOfArchivedEventHelp=This field contains the complementary data that was archived on real time. Even if some parent business event could have been canceled or modified, the data stored here is the original data, and it can't be modified.
|
||||
|
|
@ -51,6 +52,9 @@ TotalForAction=Total for event %s
|
|||
SecretKey=Secret key
|
||||
ErrorPeriodMustBePastToAllowExport=Export into archives is allowed only if period is completely past
|
||||
RegistrationNumber=Registration number
|
||||
NumberOfPrints=Number of prints
|
||||
NumberOfEmailsSent=Number of emails sent
|
||||
VatCode=Vat code
|
||||
|
||||
## logTypes
|
||||
logBILL_DELETE=Customer invoice logically deleted
|
||||
|
|
|
|||
|
|
@ -152,3 +152,4 @@ MandatoryTargetFieldsNotMapped=Some mandatory target fields are not mapped
|
|||
AllTargetMandatoryFieldsAreMapped=All target fields that need a mandatory value are mapped
|
||||
ResultOfSimulationNoError=Result of simulation: No error
|
||||
NumberOfLinesLimited=Number of lines limited
|
||||
ErrorFileLinesReachEOF=File has %s lines. However we reach the end of file or an empty line at record %s. This may occurs when some records are split onto several lines and not correctly delimited by the "Char delimiter", or if there is line with no data on all fields.
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ ActivityOnProjectThisYear=Activity on project this year
|
|||
ChildOfProjectTask=Child of project/task
|
||||
ChildOfTask=Child of task
|
||||
TaskHasChild=Task has child
|
||||
ParentTask=Parent task
|
||||
NotOwnerOfProject=Not owner of this private project
|
||||
AffectedTo=Allocated to
|
||||
CantRemoveProject=This project can't be removed as it is referenced by some other objects (invoice, orders or other). See tab '%s'.
|
||||
|
|
|
|||
|
|
@ -23,13 +23,7 @@
|
|||
* \brief Page to setup margin module
|
||||
*/
|
||||
|
||||
include '../../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/margin/lib/margins.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php";
|
||||
|
||||
require_once '../../main.inc.php';
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
|
|
@ -37,6 +31,10 @@ require_once DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php";
|
|||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT.'/margin/lib/margins.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php";
|
||||
|
||||
$langs->loadLangs(array("admin", "bills", "margins", "stocks"));
|
||||
|
||||
|
|
@ -72,29 +70,28 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'remises') {
|
||||
if (dolibarr_set_const($db, 'MARGIN_METHODE_FOR_DISCOUNT', GETPOST('MARGIN_METHODE_FOR_DISCOUNT'), 'chaine', 0, '', $conf->entity) > 0) {
|
||||
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
||||
} else {
|
||||
if ($action == 'update') {
|
||||
$error = 0;
|
||||
if (dolibarr_set_const($db, 'MARGIN_METHODE_FOR_DISCOUNT', GETPOST('MARGIN_METHODE_FOR_DISCOUNT'), 'chaine', 0, '', $conf->entity) <= 0) {
|
||||
dol_print_error($db);
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (dolibarr_set_const($db, 'MARGIN_TYPE', GETPOST('MARGIN_TYPE'), 'chaine', 0, '', $conf->entity) <= 0) {
|
||||
dol_print_error($db);
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (dolibarr_set_const($db, 'AGENT_CONTACT_TYPE', GETPOST('AGENT_CONTACT_TYPE'), 'chaine', 0, '', $conf->entity) <= 0) {
|
||||
dol_print_error($db);
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'typemarges') {
|
||||
if (dolibarr_set_const($db, 'MARGIN_TYPE', GETPOST('MARGIN_TYPE'), 'chaine', 0, '', $conf->entity) > 0) {
|
||||
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'contact') {
|
||||
if (dolibarr_set_const($db, 'AGENT_CONTACT_TYPE', GETPOST('AGENT_CONTACT_TYPE'), 'chaine', 0, '', $conf->entity) > 0) {
|
||||
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
|
|
@ -113,53 +110,49 @@ $head = marges_admin_prepare_head();
|
|||
|
||||
print dol_get_fiche_head($head, 'parameters', $langs->trans("Margins"), -1, 'margin');
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width=300>'.$langs->trans("MemberMainOptions").'</td>';
|
||||
print '<td colspan="2">'.$langs->trans("Value").'</td>'."\n";
|
||||
print '<td class="left">'.$langs->trans("Description").'</td>'."\n";
|
||||
print '<td colspan="3">'.$langs->trans("MemberMainOptions").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// GLOBAL DISCOUNT MANAGEMENT
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"typemarges\">";
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("MARGIN_TYPE").'</td>';
|
||||
print '<td>';
|
||||
print ' <input type="radio" name="MARGIN_TYPE" value="1" ';
|
||||
print '<td class="minwidth150">';
|
||||
print ' <input type="radio" name="MARGIN_TYPE" id="MARGIN_TYPE1" value="1" ';
|
||||
if (getDolGlobalString('MARGIN_TYPE') == '1') {
|
||||
print 'checked ';
|
||||
}
|
||||
print '/> ';
|
||||
print $langs->trans('MargeType1');
|
||||
print '<label for="MARGIN_TYPE1">'.$langs->trans('MargeType1').'</label>';
|
||||
print '<br>';
|
||||
print ' <input type="radio" name="MARGIN_TYPE" value="pmp" ';
|
||||
print ' <input type="radio" name="MARGIN_TYPE" id="MARGIN_TYPE2" value="pmp" ';
|
||||
if (getDolGlobalString('MARGIN_TYPE') == 'pmp') {
|
||||
print 'checked ';
|
||||
}
|
||||
print '/> ';
|
||||
print $langs->trans('MargeType2');
|
||||
print '<label for="MARGIN_TYPE2">'.$langs->trans('MargeType2').'</label>';
|
||||
print '<br>';
|
||||
print ' <input type="radio" name="MARGIN_TYPE" value="costprice" ';
|
||||
print ' <input type="radio" name="MARGIN_TYPE" id="MARGIN_TYPE3" value="costprice" ';
|
||||
if (getDolGlobalString('MARGIN_TYPE') == 'costprice') {
|
||||
print 'checked ';
|
||||
}
|
||||
print '/> ';
|
||||
print $langs->trans('MargeType3');
|
||||
print '<label for="MARGIN_TYPE3">'.$langs->trans('MargeType3').'</label>';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'" class="button">';
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans('MarginTypeDesc');
|
||||
print '<td class="minwidth200"><span class="small">'.$langs->trans('MarginTypeDesc').'</span>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
|
||||
// DISPLAY MARGIN RATES
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("DisplayMarginRates").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print '<td>';
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print ajax_constantonoff('DISPLAY_MARGIN_RATES');
|
||||
} else {
|
||||
|
|
@ -170,13 +163,13 @@ if (!empty($conf->use_javascript_ajax)) {
|
|||
}
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans('MarginRate').' = '.$langs->trans('Margin').' / '.$langs->trans('BuyingPrice').'</td>';
|
||||
print '<td><span class="small">'.$langs->trans('MarginRate').' = '.$langs->trans('Margin').' / '.$langs->trans('BuyingPrice').'</span></td>';
|
||||
print '</tr>';
|
||||
|
||||
// DISPLAY MARK RATES
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("DisplayMarkRates").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print '<td>';
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print ajax_constantonoff('DISPLAY_MARK_RATES');
|
||||
} else {
|
||||
|
|
@ -187,13 +180,13 @@ if (!empty($conf->use_javascript_ajax)) {
|
|||
}
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans('MarkRate').' = '.$langs->trans('Margin').' / '.$langs->trans('SellingPrice').'</td>';
|
||||
print '<td><span class="small">'.$langs->trans('MarkRate').' = '.$langs->trans('Margin').' / '.$langs->trans('SellingPrice').'</span></td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("ForceBuyingPriceIfNull").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print '<td>';
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print ajax_constantonoff('ForceBuyingPriceIfNull');
|
||||
} else {
|
||||
|
|
@ -204,7 +197,7 @@ if (!empty($conf->use_javascript_ajax)) {
|
|||
}
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans('ForceBuyingPriceIfNullDetails').'</td>';
|
||||
print '<td><span class="small">'.$langs->trans('ForceBuyingPriceIfNullDetails').'</span></td>';
|
||||
print '</tr>';
|
||||
|
||||
// GLOBAL DISCOUNT MANAGEMENT
|
||||
|
|
@ -215,25 +208,15 @@ $methods = array(
|
|||
);
|
||||
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="remises">';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("MARGIN_METHODE_FOR_DISCOUNT").'</td>';
|
||||
print '<td class="left">';
|
||||
print Form::selectarray('MARGIN_METHODE_FOR_DISCOUNT', $methods, getDolGlobalString('MARGIN_METHODE_FOR_DISCOUNT'));
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans('MARGIN_METHODE_FOR_DISCOUNT_DETAILS').'</td>';
|
||||
print '<td><span class="small">'.$langs->trans('MARGIN_METHODE_FOR_DISCOUNT_DETAILS').'</span></td>';
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
|
||||
// INTERNAL CONTACT TYPE USED AS COMMERCIAL AGENT
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="contact">';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("AgentContactType").'</td>';
|
||||
print '<td class="left">';
|
||||
|
|
@ -241,14 +224,15 @@ $formcompany = new FormCompany($db);
|
|||
$facture = new Facture($db);
|
||||
print $formcompany->selectTypeContact($facture, getDolGlobalString('AGENT_CONTACT_TYPE'), "AGENT_CONTACT_TYPE", "internal", "code", 1, "maxwidth250");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans('AgentContactTypeDetails').'</td>';
|
||||
print '<td><span class="small">'.$langs->trans('AgentContactTypeDetails').'</span></td>';
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<center><input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'" class="button"></center>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
|
|
|||
|
|
@ -55,9 +55,9 @@ $include_sub_warehouse = !empty(GETPOST('include_sub_warehouse')) ? GETPOST('inc
|
|||
$hookmanager->initHooks(array('inventorycard', 'globalcard')); // Note that conf->hooks_modules contains array
|
||||
|
||||
if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
|
||||
$result = restrictedArea($user, 'stock', $id);
|
||||
$result = restrictedArea($user, 'stock', $id, 'inventory&stock');
|
||||
} else {
|
||||
$result = restrictedArea($user, 'stock', $id, '', 'inventory_advance');
|
||||
$result = restrictedArea($user, 'stock', $id, 'inventory&stock', 'inventory_advance');
|
||||
}
|
||||
|
||||
// Initialize a technical objects
|
||||
|
|
|
|||
|
|
@ -72,9 +72,9 @@ $totalExpectedValuation = 0;
|
|||
$totalRealValuation = 0;
|
||||
$hookmanager->initHooks(array('inventorycard')); // Note that conf->hooks_modules contains array
|
||||
if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
|
||||
$result = restrictedArea($user, 'stock', $id);
|
||||
$result = restrictedArea($user, 'stock', $id, 'inventory&stock');
|
||||
} else {
|
||||
$result = restrictedArea($user, 'stock', $id, '', 'inventory_advance');
|
||||
$result = restrictedArea($user, 'stock', $id, 'inventory&stock', 'inventory_advance');
|
||||
}
|
||||
|
||||
// Initialize a technical objects
|
||||
|
|
|
|||
|
|
@ -85,8 +85,7 @@ if (!$sortorder) {
|
|||
$hookmanager->initHooks(array('warehousecard', 'stocklist', 'globalcard'));
|
||||
|
||||
// Security check
|
||||
//$result=restrictedArea($user,'stock', $id, 'entrepot&stock');
|
||||
$result = restrictedArea($user, 'stock');
|
||||
$result=restrictedArea($user, 'stock', $id, 'entrepot&stock');
|
||||
|
||||
$object = new Entrepot($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
|
|
|||
|
|
@ -27,15 +27,6 @@
|
|||
*/
|
||||
|
||||
require "../../main.inc.php";
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
|
||||
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
|
|
@ -44,6 +35,14 @@ require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
|
|||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('projects', 'users', 'companies'));
|
||||
|
|
@ -161,6 +160,7 @@ $search_array_options_task = $extrafields->getOptionalsFromPost($object->table_e
|
|||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$error = 0;
|
||||
$parameters = array('id' => $id, 'taskid' => $taskid, 'projectid' => $projectid);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
|
@ -460,24 +460,24 @@ $head = project_timesheet_prepare_head($mode, $usertoprocess);
|
|||
print dol_get_fiche_head($head, 'inputperday', $langs->trans('TimeSpent'), -1, $picto);
|
||||
|
||||
// Show description of content
|
||||
print '<div class="hideonsmartphone opacitymedium">';
|
||||
$s = '';
|
||||
if ($mine || ($usertoprocess->id == $user->id)) {
|
||||
print $langs->trans("MyTasksDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
|
||||
$s .= $langs->trans("MyTasksDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
|
||||
} else {
|
||||
if (empty($usertoprocess->id) || $usertoprocess->id < 0) {
|
||||
if ($user->hasRight('projet', 'all', 'lire') && !$socid) {
|
||||
print $langs->trans("ProjectsDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
|
||||
$s .= $langs->trans("ProjectsDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
|
||||
} else {
|
||||
print $langs->trans("ProjectsPublicTaskDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
|
||||
$s .= $langs->trans("ProjectsPublicTaskDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($mine || ($usertoprocess->id == $user->id)) {
|
||||
print $langs->trans("OnlyYourTaskAreVisible").'<br>';
|
||||
$s .= $langs->trans("OnlyYourTaskAreVisible").'<br>';
|
||||
} else {
|
||||
print $langs->trans("AllTaskVisibleButEditIfYouAreAssigned").'<br>';
|
||||
$s .= $langs->trans("AllTaskVisibleButEditIfYouAreAssigned").'<br>';
|
||||
}
|
||||
print '</div>';
|
||||
print info_admin($s, 0, 0, 'info', 'nomargintop');
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
|
@ -700,7 +700,6 @@ if ($conf->use_javascript_ajax && count($tasksarray) >= getDolGlobalInt('NBLINES
|
|||
print '<td class="liste_total"></td>';
|
||||
}
|
||||
print '<td class="liste_total leftborder">';
|
||||
//print ' - '.$langs->trans("ExpectedWorkedHours").': <strong>'.price($usertoprocess->weeklyhours, 1, $langs, 0, 0).'</strong>';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_total center'.($cssonholiday ? ' '.$cssonholiday : '').($cssweekend ? ' '.$cssweekend : '').'"><div class="totalDay0"> </div></td>';
|
||||
|
|
@ -764,14 +763,11 @@ if (count($tasksarray) > 0) {
|
|||
print '<td class="leftborder"></td>';
|
||||
print '<td class="right">';
|
||||
$timeonothertasks = ($totalforeachday[$daytoparse] - $totalforvisibletasks[$daytoparse]);
|
||||
//if ($timeonothertasks)
|
||||
//{
|
||||
print '<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center width50" disabled="" id="timespent[-1][0]" name="task[-1][0]" value="';
|
||||
if ($timeonothertasks) {
|
||||
print convertSecondToTime($timeonothertasks, 'allhourmin');
|
||||
}
|
||||
print '"></span>';
|
||||
//}
|
||||
print '</td>';
|
||||
print ' <td class="liste_total borderleft"></td>';
|
||||
print ' <td class="liste_total"></td>';
|
||||
|
|
@ -793,9 +789,9 @@ if (count($tasksarray) > 0) {
|
|||
|
||||
print '<td class="liste_total center'.($cssonholiday ? ' '.$cssonholiday : '').($cssweekend ? ' '.$cssweekend : '').'"><div class="totalDay0"> </div></td>';
|
||||
|
||||
print '<td class="liste_total"></td>
|
||||
<td class="liste_total"></td>
|
||||
</tr>';
|
||||
print '<td class="liste_total"></td>';
|
||||
print '<td class="liste_total"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
} else {
|
||||
print '<tr><td colspan="14"><span class="opacitymedium">'.$langs->trans("NoAssignedTasks").'</span></td></tr>';
|
||||
|
|
|
|||
|
|
@ -473,24 +473,24 @@ $head = project_timesheet_prepare_head($mode, $usertoprocess);
|
|||
print dol_get_fiche_head($head, 'inputpermonth', $langs->trans('TimeSpent'), -1, $picto);
|
||||
|
||||
// Show description of content
|
||||
print '<div class="hideonsmartphone opacitymedium">';
|
||||
$s = '';
|
||||
if ($mine || ($usertoprocess->id == $user->id)) {
|
||||
print $langs->trans("MyTasksDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
|
||||
$s .= $langs->trans("MyTasksDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
|
||||
} else {
|
||||
if (empty($usertoprocess->id) || $usertoprocess->id < 0) {
|
||||
if ($user->hasRight('projet', 'all', 'lire') && !$socid) {
|
||||
print $langs->trans("ProjectsDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
|
||||
$s .= $langs->trans("ProjectsDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
|
||||
} else {
|
||||
print $langs->trans("ProjectsPublicTaskDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
|
||||
$s .= $langs->trans("ProjectsPublicTaskDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($mine || ($usertoprocess->id == $user->id)) {
|
||||
print $langs->trans("OnlyYourTaskAreVisible").'<br>';
|
||||
$s .= $langs->trans("OnlyYourTaskAreVisible").'<br>';
|
||||
} else {
|
||||
print $langs->trans("AllTaskVisibleButEditIfYouAreAssigned").'<br>';
|
||||
$s .= $langs->trans("AllTaskVisibleButEditIfYouAreAssigned").'<br>';
|
||||
}
|
||||
print '</div>';
|
||||
print info_admin($s, 0, 0, 'info', 'nomargintop');
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
|
|
|||
|
|
@ -472,24 +472,24 @@ $head = project_timesheet_prepare_head($mode, $usertoprocess);
|
|||
print dol_get_fiche_head($head, 'inputperweek', $langs->trans('TimeSpent'), -1, $picto);
|
||||
|
||||
// Show description of content
|
||||
print '<div class="hideonsmartphone opacitymedium">';
|
||||
$s = '';
|
||||
if ($mine || ($usertoprocess->id == $user->id)) {
|
||||
print $langs->trans("MyTasksDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
|
||||
$s .= $langs->trans("MyTasksDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
|
||||
} else {
|
||||
if (empty($usertoprocess->id) || $usertoprocess->id < 0) {
|
||||
if ($user->hasRight('projet', 'all', 'lire') && !$socid) {
|
||||
print $langs->trans("ProjectsDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
|
||||
$s .= $langs->trans("ProjectsDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
|
||||
} else {
|
||||
print $langs->trans("ProjectsPublicTaskDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
|
||||
$s .= $langs->trans("ProjectsPublicTaskDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($mine || ($usertoprocess->id == $user->id)) {
|
||||
print $langs->trans("OnlyYourTaskAreVisible").'<br>';
|
||||
$s .= $langs->trans("OnlyYourTaskAreVisible").'<br>';
|
||||
} else {
|
||||
print $langs->trans("AllTaskVisibleButEditIfYouAreAssigned").'<br>';
|
||||
$s .= $langs->trans("AllTaskVisibleButEditIfYouAreAssigned").'<br>';
|
||||
}
|
||||
print '</div>';
|
||||
print info_admin($s, 0, 0, 'info', 'nomargintop');
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
|
|
|||
|
|
@ -573,7 +573,7 @@ class Tasks extends DolibarrApi
|
|||
*
|
||||
* @url GET {id}/getTimeSpent/{timespent_id}
|
||||
*
|
||||
* @return TimeSpent
|
||||
* @return Object data without useless information
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
|
|
@ -1115,7 +1115,4 @@ class Tasks extends DolibarrApi
|
|||
|
||||
return $this->_cleanObjectDatas($this->task);
|
||||
}
|
||||
|
||||
// \todo
|
||||
// getSummaryOfTimeSpent
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ if (g.getDivId() != null)
|
|||
'task_name' => $projecttmp->ref.' '.$projecttmp->title,
|
||||
'task_resources' => '',
|
||||
'task_start_date' => $projecttmp->date_start,
|
||||
'task_end_date' => $projecttmp->date_end,
|
||||
'task_end_date' => (!empty($projecttmp->date_end) ? $projecttmp->date_end : 0),
|
||||
'task_is_group' => 1, 'task_position' => 0, 'task_css' => 'ggroupblack', 'task_milestone' => 0, 'task_parent' => 0, 'task_parent_alternate_id' => 0,
|
||||
'note' => '',
|
||||
'task_planned_workload' => 0
|
||||
|
|
|
|||
|
|
@ -27,12 +27,6 @@
|
|||
*/
|
||||
|
||||
require "../../main.inc.php";
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
|
|
@ -40,14 +34,20 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
|||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('projects', 'companies'));
|
||||
|
||||
$id = GETPOSTINT('id');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
|
||||
$id = GETPOSTINT('id'); // Id of task
|
||||
$ref = GETPOST('ref', 'alpha'); // Ref of task
|
||||
$withproject = GETPOSTINT('withproject');
|
||||
$project_ref = GETPOST('project_ref', 'alpha');
|
||||
|
||||
|
|
@ -56,6 +56,7 @@ $projectstatic = new Project($db);
|
|||
|
||||
$hookmanager->initHooks(array('projecttaskcontact', 'globalcard'));
|
||||
|
||||
// Load task
|
||||
if ($id > 0 || $ref) {
|
||||
$object->fetch($id, $ref);
|
||||
}
|
||||
|
|
@ -184,11 +185,11 @@ llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-project project-task
|
|||
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
if ($object->fetch($id, $ref) > 0) {
|
||||
$id = $object->id; // So when doing a search from ref, id is also set correctly.
|
||||
|
||||
if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_TASK') && empty($object->comments)) {
|
||||
$object->fetchComments();
|
||||
}
|
||||
$id = $object->id; // So when doing a search from ref, id is also set correctly.
|
||||
|
||||
if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) {
|
||||
$projectstatic->fetchComments();
|
||||
}
|
||||
|
|
@ -227,7 +228,7 @@ if ($id > 0 || !empty($ref)) {
|
|||
$projectstatic->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0');
|
||||
}
|
||||
|
||||
dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
|
|
@ -270,7 +271,7 @@ if ($id > 0 || !empty($ref)) {
|
|||
// Budget
|
||||
print '<tr><td>'.$langs->trans("Budget").'</td><td>';
|
||||
if (isset($projectstatic->budget_amount) && strcmp($projectstatic->budget_amount, '')) {
|
||||
print price($projectstatic->budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
|
||||
print '<span class="amount">'.price($projectstatic->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).'</span>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
|
|
|||
|
|
@ -29,13 +29,6 @@
|
|||
|
||||
// Load Dolibarr environment
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
|
|
@ -43,6 +36,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
|||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('projects', 'other'));
|
||||
|
|
@ -90,6 +89,7 @@ restrictedArea($user, 'projet', $object->fk_project, 'projet&project');
|
|||
|
||||
$permissiontoadd = $user->hasRight('projet', 'creer'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -23,11 +23,8 @@
|
|||
* \brief Page to show information on a task
|
||||
*/
|
||||
|
||||
require "../../main.inc.php";
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../../main.inc.php';
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
|
|
@ -35,9 +32,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
|
|||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->load('projects');
|
||||
$langs->loadLangs(array('projects'));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
|
|
@ -88,7 +88,8 @@ if (!empty($project_ref) && !empty($withproject)) {
|
|||
$id = $tasksarray[0]->id;
|
||||
$object->fetch($id);
|
||||
} else {
|
||||
header("Location: ".DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.(empty($mode) ? '' : '&mode='.$mode));
|
||||
header("Location: ".DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'&withproject=1');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -134,6 +135,8 @@ $help_url = '';
|
|||
llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-project project-tasks page-task_note');
|
||||
|
||||
if ($object->id > 0) {
|
||||
$projectstatic->fetch_thirdparty();
|
||||
|
||||
$userWrite = $projectstatic->restrictedProjectArea($user, 'write');
|
||||
|
||||
if (!empty($withproject)) {
|
||||
|
|
@ -142,7 +145,8 @@ if ($object->id > 0) {
|
|||
$head = project_prepare_head($projectstatic);
|
||||
print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'));
|
||||
|
||||
$param = (isset($mode) && $mode == 'mine' ? '&mode=mine' : '');
|
||||
$param = '';
|
||||
|
||||
// Project card
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
|
@ -245,7 +249,7 @@ if ($object->id > 0) {
|
|||
print '<div class="fichehalfright">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
// Categories
|
||||
if (isModEnabled('category')) {
|
||||
|
|
@ -285,9 +289,9 @@ if ($object->id > 0) {
|
|||
|
||||
if (!GETPOST('withproject') || empty($projectstatic->id)) {
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);
|
||||
$object->next_prev_filter = " fk_projet:IN:".$db->sanitize($projectsListId);
|
||||
$object->next_prev_filter = "fk_projet:IN:".$db->sanitize($projectsListId);
|
||||
} else {
|
||||
$object->next_prev_filter = " fk_projet:=:".((int) $projectstatic->id);
|
||||
$object->next_prev_filter = "fk_projet:=:".((int) $projectstatic->id);
|
||||
}
|
||||
|
||||
$morehtmlref = '';
|
||||
|
|
@ -301,7 +305,9 @@ if ($object->id > 0) {
|
|||
|
||||
// Third party
|
||||
$morehtmlref .= $langs->trans("ThirdParty").': ';
|
||||
$morehtmlref .= $projectstatic->thirdparty->getNomUrl(1);
|
||||
if (is_object($projectstatic->thirdparty) && $projectstatic->thirdparty->id > 0) {
|
||||
$morehtmlref .= $projectstatic->thirdparty->getNomUrl(1);
|
||||
}
|
||||
$morehtmlref .= '</div>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ restrictedArea($user, 'projet', $object->fk_project, 'projet&project');
|
|||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$error = 0;
|
||||
|
||||
if ($action == 'update' && !GETPOST("cancel") && $user->hasRight('projet', 'creer')) {
|
||||
|
|
@ -320,7 +321,6 @@ if ($id > 0 || !empty($ref)) {
|
|||
$object->fetchComments();
|
||||
}
|
||||
|
||||
|
||||
if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) {
|
||||
$projectstatic->fetchComments();
|
||||
}
|
||||
|
|
@ -474,9 +474,6 @@ if ($id > 0 || !empty($ref)) {
|
|||
print '<br>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// To verify role of users
|
||||
//$userAccess = $projectstatic->restrictedProjectArea($user); // We allow task affected to user even if a not allowed project
|
||||
|
|
@ -494,6 +491,16 @@ if ($id > 0 || !empty($ref)) {
|
|||
|
||||
print dol_get_fiche_head($head, 'task_task', $langs->trans("Task"), 0, 'projecttask', 0, '', '');
|
||||
|
||||
$param = (GETPOST('withproject') ? '&withproject=1' : '');
|
||||
$linkback = GETPOST('withproject') ? '<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'">'.$langs->trans("BackToList").'</a>' : '';
|
||||
|
||||
if (!GETPOST('withproject') || empty($projectstatic->id)) {
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);
|
||||
$object->next_prev_filter = "fk_projet:IN:".$db->sanitize($projectsListId);
|
||||
} else {
|
||||
$object->next_prev_filter = "fk_projet:=:".((int) $projectstatic->id);
|
||||
}
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
// Ref
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ if (isModEnabled('eventorganization')) {
|
|||
|
||||
$langs->loadLangs($langsLoad);
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
|
|
@ -72,9 +72,9 @@ $optioncss = GETPOST('optioncss', 'alpha');
|
|||
$mode = GETPOST('mode', 'alpha');
|
||||
|
||||
$id = GETPOSTINT('id'); // Id of task
|
||||
$ref = GETPOST('ref', 'alpha'); // Ref of task
|
||||
$projectid = GETPOSTINT('projectid'); // Id of project
|
||||
$lineid = GETPOSTINT('lineid'); // Id of time spent line
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$withproject = GETPOSTINT('withproject');
|
||||
$project_ref = GETPOST('project_ref', 'alpha');
|
||||
$tab = GETPOST('tab', 'aZ09');
|
||||
|
|
@ -140,6 +140,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
|||
// Load task
|
||||
if ($id > 0 || $ref) {
|
||||
$object->fetch($id, $ref);
|
||||
$id = $object->id; // So when doing a search from ref, id is also set correctly.
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1162,7 +1163,8 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||
$head = task_prepare_head($object);
|
||||
print dol_get_fiche_head($head, 'task_time', $langs->trans("Task"), -1, 'projecttask', 0, '', 'reposition');
|
||||
|
||||
$linkback = $withproject ? '<a href="' . DOL_URL_ROOT . '/projet/tasks.php?id=' . $projectstatic->id . '">' . $langs->trans("BackToList") . '</a>' : '';
|
||||
$param = (GETPOST('withproject') ? '&withproject=1' : '');
|
||||
$linkback = GETPOST('withproject') ? '<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'">'.$langs->trans("BackToList").'</a>' : '';
|
||||
|
||||
if ($action == 'deleteline') {
|
||||
$urlafterconfirm = $_SERVER["PHP_SELF"] . "?" . ($object->id > 0 ? "id=" . $object->id : 'projectid=' . $projectstatic->id) . '&lineid=' . GETPOSTINT("lineid") . $param;
|
||||
|
|
@ -1202,7 +1204,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
// Task parent
|
||||
print '<tr><td>' . $langs->trans("ChildOfTask") . '</td><td>';
|
||||
print '<tr><td>' . $langs->trans("ParentTask") . '</td><td>';
|
||||
if ($object->fk_task_parent > 0) {
|
||||
$tasktmp = new Task($db);
|
||||
$tasktmp->fetch($object->fk_task_parent);
|
||||
|
|
@ -1323,6 +1325,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.((int) $limit);
|
||||
}
|
||||
if ($id > 0) {
|
||||
$param .= '&id='.((int) $id);
|
||||
}
|
||||
if ($search_month > 0) {
|
||||
$param .= '&search_month=' . urlencode((string) ($search_month));
|
||||
}
|
||||
|
|
@ -1336,16 +1341,16 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||
$param .= '&search_task_ref=' . urlencode($search_task_ref);
|
||||
}
|
||||
if ($search_company != '') {
|
||||
$param .= '&$search_company=' . urlencode($search_company);
|
||||
$param .= '&search_company=' . urlencode($search_company);
|
||||
}
|
||||
if ($search_company_alias != '') {
|
||||
$param .= '&$search_company_alias=' . urlencode($search_company_alias);
|
||||
$param .= '&search_company_alias=' . urlencode($search_company_alias);
|
||||
}
|
||||
if ($search_project_ref != '') {
|
||||
$param .= '&$search_project_ref=' . urlencode($search_project_ref);
|
||||
$param .= '&search_project_ref=' . urlencode($search_project_ref);
|
||||
}
|
||||
if ($search_project_label != '') {
|
||||
$param .= '&$search_project_label=' . urlencode($search_project_label);
|
||||
$param .= '&search_project_label=' . urlencode($search_project_label);
|
||||
}
|
||||
if ($search_task_label != '') {
|
||||
$param .= '&search_task_label=' . urlencode($search_task_label);
|
||||
|
|
@ -1354,7 +1359,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||
$param .= '&search_note=' . urlencode($search_note);
|
||||
}
|
||||
if ($search_duration != '') {
|
||||
$param .= '&search_field2=' . urlencode((string) ($search_duration));
|
||||
$param .= '&search_field2=' . urlencode((string) ($search_duration));
|
||||
}
|
||||
if ($optioncss != '') {
|
||||
$param .= '&optioncss=' . urlencode($optioncss);
|
||||
|
|
@ -1389,7 +1394,6 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||
if ($search_timespent_endmin) {
|
||||
$param .= '&search_timespent_duration_endmin=' . urlencode((string) ($search_timespent_endmin));
|
||||
}
|
||||
|
||||
/*
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
|
@ -2043,7 +2047,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['t.element_date']['checked'])) {
|
||||
|
|
@ -2113,7 +2117,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'width="80"', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ use Luracast\Restler\RestException;
|
|||
|
||||
//require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -365,6 +366,17 @@ class Contacts extends DolibarrApi
|
|||
}
|
||||
continue;
|
||||
}
|
||||
if ($field == 'socid') {
|
||||
$new_socid = (int) $value;
|
||||
$loopthirdpartytmp = new Societe($this->db);
|
||||
$new_thirdparty_result = $loopthirdpartytmp->fetch($new_socid);
|
||||
if ($new_thirdparty_result < 1) {
|
||||
throw new RestException(404, 'Thirdparty with id='.$new_socid.' not found or not allowed');
|
||||
}
|
||||
if (!DolibarrApi::_checkAccessToResource('societe', $new_socid)) {
|
||||
throw new RestException(403, 'Access to socid/thirdparty='.$new_socid.' is not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
}
|
||||
|
||||
$this->contact->$field = $this->_checkValForAPI($field, $value, $this->contact);
|
||||
}
|
||||
|
|
@ -422,6 +434,17 @@ class Contacts extends DolibarrApi
|
|||
}
|
||||
continue;
|
||||
}
|
||||
if ($field == 'socid') {
|
||||
$new_socid = (int) $value;
|
||||
$loopthirdpartytmp = new Societe($this->db);
|
||||
$new_thirdparty_result = $loopthirdpartytmp->fetch($new_socid);
|
||||
if ($new_thirdparty_result < 1) {
|
||||
throw new RestException(404, 'Thirdparty with id='.$new_socid.' not found or not allowed');
|
||||
}
|
||||
if (!DolibarrApi::_checkAccessToResource('societe', $new_socid)) {
|
||||
throw new RestException(403, 'Access to socid/thirdparty='.$new_socid.' is not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
}
|
||||
|
||||
$this->contact->$field = $this->_checkValForAPI($field, $value, $this->contact);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1190,6 +1190,12 @@ td.wordbreak img, td.wordbreakimp img {
|
|||
.nopaddingbottomimp {
|
||||
padding-bottom: 0 !important;
|
||||
}
|
||||
.padding2 {
|
||||
padding: 2px;
|
||||
}
|
||||
.padding3 {
|
||||
padding: 3px;
|
||||
}
|
||||
.paddingleft {
|
||||
padding-<?php print $left; ?>: 4px;
|
||||
}
|
||||
|
|
@ -1278,7 +1284,7 @@ td.wordbreak img, td.wordbreakimp img {
|
|||
.borderimp {
|
||||
border: 1px solid #888 !important;
|
||||
}
|
||||
.text-warning{
|
||||
.text-warning {
|
||||
color : <?php print $textWarning; ?>
|
||||
}
|
||||
/* CSS used for long description and extrafield text */
|
||||
|
|
@ -7967,8 +7973,8 @@ div.kanban.column div.ui-sortable-helper {
|
|||
/* ============================================================================== */
|
||||
|
||||
.searchpage .tagtr .tagtd {
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
.searchpage .tagtr .tagtd .button {
|
||||
background: unset;
|
||||
|
|
|
|||
|
|
@ -1352,6 +1352,12 @@ td.wordbreak img, td.wordbreakimp img {
|
|||
.nopaddingbottomimp {
|
||||
padding-bottom: 0 !important;
|
||||
}
|
||||
.padding2 {
|
||||
padding: 2px;
|
||||
}
|
||||
.padding3 {
|
||||
padding: 3px;
|
||||
}
|
||||
.paddingleft {
|
||||
padding-<?php print $left; ?>: 4px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -309,8 +309,8 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type, $stopcode = 1)
|
|||
}
|
||||
}
|
||||
|
||||
// Prevent the use of method TRACE
|
||||
if ($_SERVER["REQUEST_METHOD"] == "TRACE") {
|
||||
// Prevent the use of method TRACE in case of the web server authorizes it (some do it by default). TRACE method can be used by attacker to steal cookies or other sensitive information.
|
||||
if (!empty($_SERVER["REQUEST_METHOD"]) && $_SERVER["REQUEST_METHOD"] == "TRACE") {
|
||||
print 'Access refused with request method TRACE';
|
||||
http_response_code(405);
|
||||
exit();
|
||||
|
|
|
|||
Loading…
Reference in a new issue