mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 09:08:09 +01:00
Compare commits
4 Commits
7847408006
...
1c367a59d3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c367a59d3 | ||
|
|
9392e0a9b6 | ||
|
|
3f0ec8dc78 | ||
|
|
caf65afa7e |
@@ -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>';
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
@@ -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,25 @@ 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);
|
||||
}
|
||||
|
||||
if (dolibarr_set_const($db, 'MARGIN_TYPE', GETPOST('MARGIN_TYPE'), 'chaine', 0, '', $conf->entity) <= 0) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (dolibarr_set_const($db, 'AGENT_CONTACT_TYPE', GETPOST('AGENT_CONTACT_TYPE'), 'chaine', 0, '', $conf->entity) <= 0) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
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 +107,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 +160,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 +177,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 +194,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 +205,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 +221,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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user