Merge branch 'develop' into Debug_15
This commit is contained in:
commit
990882e264
@ -133,7 +133,7 @@ NEW: printFieldListFrom hook call on several lists
|
||||
NEW: Use lang selector when using a field key 'lang' in modulebuilder
|
||||
NEW: we need to be able to put more filters on deleteByParentField() function
|
||||
NEW: make it easier to set the `keyword`, `keywords` and `description` attributes of an ecm file object
|
||||
|
||||
NEW: Experimental feature to manage user sessions in database
|
||||
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
@ -146,6 +146,7 @@ Following changes may create regressions for some external modules, but were nec
|
||||
method executeCLI() available into core/class/utils.class.php
|
||||
* Class file expeditionbatch.class.php renamed to expeditionlinebatch.class.php
|
||||
* ExpeditionLineBatch::fetchAll is not static anymore and first parameter $db is removed
|
||||
* ExtraFields->showOutputField parameter 4 'extrafieldsobjectkey' is now required
|
||||
|
||||
|
||||
|
||||
|
||||
@ -73,10 +73,10 @@ if (function_exists('socket_create')) {
|
||||
print 'xdebug.profiler_append = '.ini_get('xdebug.profiler_append')."<br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
echo "To run a debug session, add parameter<br>";
|
||||
echo "* XDEBUG_SESSION_START=aname on your URL. To stop, remove cookie XDEBUG_SESSION_START.<br>\n";
|
||||
echo "To run a profiler session (when xdebug.profiler_enable_trigger=1), add parameter<br>\n";
|
||||
echo "* XDEBUG_PROFILE=aname on each URL.<br>";
|
||||
print "To run a debug session, add parameter<br>";
|
||||
print "* XDEBUG_SESSION_START=aname on your URL. To stop, remove cookie XDEBUG_SESSION_START.<br>\n";
|
||||
print "To run a profiler session (when xdebug.profiler_enable_trigger=1), add parameter<br>\n";
|
||||
print "* XDEBUG_PROFILE=aname on each URL.<br>";
|
||||
print "<br>";
|
||||
|
||||
print "<strong>Test debugger server (Eclipse for example):</strong><br>\n";
|
||||
@ -89,12 +89,12 @@ if (function_exists('socket_create')) {
|
||||
//$client = socket_accept($sock);
|
||||
$client = socket_connect($socket, $address, $port);
|
||||
if ($client) {
|
||||
echo "Connection established: ".$client." - address=".$address." port=".$port."<br>\n";
|
||||
echo "There is a Remote debug server at this address.<br>\n";
|
||||
echo "<br>\n";
|
||||
echo "To be sure this debugger accepts input from your PHP server and xdebug, be sure to have\n";
|
||||
echo "your php.ini file with this :<br>\n";
|
||||
echo '<textarea cols="80" rows="16">'."xdebug.remote_enable=on
|
||||
print "Connection established: ".$client." - address=".$address." port=".$port."<br>\n";
|
||||
print "There is a Remote debug server at this address.<br>\n";
|
||||
print "<br>\n";
|
||||
print "To be sure this debugger accepts input from your PHP server and xdebug, be sure to have\n";
|
||||
print "your php.ini file with this :<br>\n";
|
||||
print '<textarea cols="80" rows="16">'."xdebug.remote_enable=on
|
||||
xdebug.remote_handle=dbgp
|
||||
xdebug.remote_host=localhost
|
||||
xdebug.remote_port=9000
|
||||
@ -110,14 +110,14 @@ xdebug.trace_output_dir=/tmp/trace
|
||||
xdebug.auto_trace=0
|
||||
</textarea>\n";
|
||||
print "<br><br>\n";
|
||||
echo 'Then check in your debug server (Eclipse), you have setup:<br>
|
||||
print 'Then check in your debug server (Eclipse), you have setup:<br>
|
||||
XDebug with same port than in php.ini<br>
|
||||
Allow Remote debug=yes or prompt<br>'."\n";
|
||||
print "<br>\n";
|
||||
} else {
|
||||
print socket_strerror(socket_last_error());
|
||||
echo "Failed to connect to address=".$address." port=".$port."<br>\n";
|
||||
echo "There is no Remote debug server at this address.\n";
|
||||
print " - Failed to connect to address=".$address." port=".$port."<br>\n";
|
||||
print "There is no Remote debug server at this address.\n";
|
||||
}
|
||||
socket_close($socket);
|
||||
} else {
|
||||
|
||||
@ -297,7 +297,7 @@ if (!in_array($nowyear, $arrayyears)) {
|
||||
$arrayyears[$nowyear] = $nowyear;
|
||||
}
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0, 0, 0, '', 0, 0, 0, '', 'width75');
|
||||
print '</td></tr>';
|
||||
print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button small" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
|
||||
@ -347,7 +347,7 @@ if (!in_array($nowyear, $arrayyears)) {
|
||||
$arrayyears[$nowyear] = $nowyear;
|
||||
}
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0, 0, 0, '', 0, 0, 0, '', 'width75');
|
||||
print '</td></tr>';
|
||||
print '<tr><td align="center" colspan="2"><input type="submit" class="button small" name="submit" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
|
||||
@ -260,7 +260,7 @@ if (!in_array($year, $arrayyears)) {
|
||||
$arrayyears[$year] = $year;
|
||||
}
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0, 0, 0, '', 0, 0, 0, '', 'width75');
|
||||
print '</td></tr>';
|
||||
print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button small" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
|
||||
@ -92,6 +92,8 @@ $search_montant_ttc = GETPOST('search_montant_ttc', 'alpha');
|
||||
$origin = GETPOST('origin', 'alpha');
|
||||
$originid = (GETPOST('originid', 'int') ? GETPOST('originid', 'int') : GETPOST('origin_id', 'int')); // For backward compatibility
|
||||
$fac_rec = GETPOST('fac_rec', 'int');
|
||||
$facid = GETPOST('facid', 'int');
|
||||
$ref_client = GETPOST('ref_client', 'int');
|
||||
|
||||
// PDF
|
||||
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
||||
@ -2771,7 +2773,7 @@ if (empty($reshook)) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->facture->multidir_output[$object->entity];
|
||||
$upload_dir = $conf->facture->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity];
|
||||
$permissiontoadd = $usercancreate;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
@ -3555,7 +3557,7 @@ if ($action == 'create') {
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
if ($conf->global->INVOICE_USE_RETAINED_WARRANTY) {
|
||||
if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
|
||||
$rwStyle = 'display:none;';
|
||||
if (in_array(GETPOST('type', 'int'), $retainedWarrantyInvoiceAvailableType)) {
|
||||
$rwStyle = '';
|
||||
@ -3631,7 +3633,7 @@ if ($action == 'create') {
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled)) {
|
||||
print '<tr>';
|
||||
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $objectsrc->label_incoterms, 1).'</label></td>';
|
||||
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), !empty($objectsrc->label_incoterms) ? $objectsrc->label_incoterms : '', 1).'</label></td>';
|
||||
print '<td colspan="2" class="maxwidthonsmartphone">';
|
||||
$incoterm_id = GETPOST('incoterm_id');
|
||||
$incoterm_location = GETPOST('location_incoterms');
|
||||
@ -3644,7 +3646,7 @@ if ($action == 'create') {
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="2"', 'cols' => '2', 'socid'=>$socid);
|
||||
$parameters = array('objectsrc' => !empty($objectsrc) ? $objectsrc : 0, 'colspan' => ' colspan="2"', 'cols' => '2', 'socid'=>$socid);
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
|
||||
@ -692,6 +692,10 @@ if ($resql) {
|
||||
if ($num > 0) {
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
$totalarray['val']['f.total_ht'] = 0;
|
||||
$totalarray['val']['f.total_tva'] = 0;
|
||||
$totalarray['val']['f.total_ttc'] = 0;
|
||||
while ($i < min($num, $limit)) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
if (empty($objp)) {
|
||||
@ -701,7 +705,7 @@ if ($resql) {
|
||||
$companystatic->id = $objp->socid;
|
||||
$companystatic->name = $objp->name;
|
||||
|
||||
$invoicerectmp->id = $objp->id ? $objp->id : $objp->facid;
|
||||
$invoicerectmp->id = !empty($objp->id) ? $objp->id : $objp->facid;
|
||||
$invoicerectmp->frequency = $objp->frequency;
|
||||
$invoicerectmp->suspended = $objp->suspended;
|
||||
$invoicerectmp->unit_frequency = $objp->unit_frequency;
|
||||
|
||||
@ -805,7 +805,7 @@ if (!$sall) {
|
||||
}
|
||||
}
|
||||
// Add GroupBy from hooks
|
||||
$parameters = array('all' => $all, 'fieldstosearchall' => $fieldstosearchall);
|
||||
$parameters = array('all' => !empty($all) ? $all : 0, 'fieldstosearchall' => $fieldstosearchall);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
} else {
|
||||
@ -1650,7 +1650,7 @@ if ($resql) {
|
||||
|
||||
$facturestatic->note_public = $obj->note_public;
|
||||
$facturestatic->note_private = $obj->note_private;
|
||||
if ($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_RETAINED_WARRANTY) {
|
||||
if (!empty($conf->global->INVOICE_USE_SITUATION) && !empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
|
||||
$facturestatic->retained_warranty = $obj->retained_warranty;
|
||||
$facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;
|
||||
$facturestatic->situation_final = $obj->retained_warranty_date_limit;
|
||||
@ -1846,8 +1846,8 @@ if ($resql) {
|
||||
}
|
||||
// Alias
|
||||
if (!empty($arrayfields['s.name_alias']['checked'])) {
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->name_alias).'">';
|
||||
print dol_escape_htmltag($obj->name_alias);
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag((!empty($obj->name_alias)) ? $obj->name_alias : '').'">';
|
||||
print dol_escape_htmltag((!empty($obj->name_alias) ? $obj->name_alias : ''));
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
||||
@ -102,7 +102,7 @@ if ($mode == 'customer') {
|
||||
$stats->where .= ' AND f.fk_statut IN ('.$db->sanitize($object_status).')';
|
||||
}
|
||||
if (is_array($custcats) && !empty($custcats)) {
|
||||
$stats->from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_societe as cat ON (f.fk_soc = cat.fk_soc)';
|
||||
$stats->from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_societe as cat OmdN (f.fk_soc = cat.fk_soc)';
|
||||
$stats->where .= ' AND cat.fk_categorie IN ('.$db->sanitize(implode(',', $custcats)).')';
|
||||
}
|
||||
}
|
||||
@ -341,7 +341,7 @@ if (!in_array($nowyear, $arrayyears)) {
|
||||
$arrayyears[$nowyear] = $nowyear;
|
||||
}
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0, 0, 0, '', 0, 0, 0, '', 'width75');
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="center" colspan="2"><input type="submit" name="submit" class="button small" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
@ -380,11 +380,11 @@ foreach ($data as $val) {
|
||||
print '<tr class="oddeven" height="24">';
|
||||
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&mode='.$mode.($socid > 0 ? '&socid='.$socid : '').($userid > 0 ? '&userid='.$userid : '').'">'.$year.'</a></td>';
|
||||
print '<td class="right">'.$val['nb'].'</td>';
|
||||
print '<td class="right opacitylow" style="'.(($val['nb_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.($val['nb_diff'] < 0 ? '' : '+').round($val['nb_diff']).'%</td>';
|
||||
print '<td class="right opacitylow" style="'.((empty($val['nb_diff']) || $val['nb_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.(!empty($val['nb_diff']) && $val['nb_diff'] < 0 ? '' : '+').round(!empty($val['nb_diff']) ? $val['nb_diff'] : 0).'%</td>';
|
||||
print '<td class="right"><span class="amount">'.price(price2num($val['total'], 'MT'), 1).'</span></td>';
|
||||
print '<td class="right opacitylow" style="'.(($val['total_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.($val['total_diff'] < 0 ? '' : '+').round($val['total_diff']).'%</td>';
|
||||
print '<td class="right opacitylow" style="'.((empty($val['total_diff']) || $val['total_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.( !empty($val['total_diff']) && $val['total_diff'] < 0 ? '' : '+').round(!empty($val['total_diff']) ? $val['total_diff'] : 0).'%</td>';
|
||||
print '<td class="right"><span class="amount">'.price(price2num($val['avg'], 'MT'), 1).'</span></td>';
|
||||
print '<td class="right opacitylow" style="'.(($val['avg_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.($val['avg_diff'] < 0 ? '' : '+').round($val['avg_diff']).'%</td>';
|
||||
print '<td class="right opacitylow" style="'.((empty($val['avg_diff']) || $val['avg_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.(!empty($val['avg_diff']) && $val['avg_diff'] < 0 ? '' : '+').round(!empty($val['avg_diff']) ? $val['avg_diff'] : 0).'%</td>';
|
||||
print '</tr>';
|
||||
$oldyear = $year;
|
||||
}
|
||||
|
||||
@ -26,11 +26,11 @@
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
@ -46,8 +46,14 @@ if (!empty($conf->accounting->enabled)) {
|
||||
$langs->loadLangs(array('compta', 'bills', 'banks', 'hrm'));
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectcard'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
|
||||
|
||||
$fk_project = (GETPOST('fk_project') ? GETPOST('fk_project', 'int') : 0);
|
||||
|
||||
$dateech = dol_mktime(GETPOST('echhour'), GETPOST('echmin'), GETPOST('echsec'), GETPOST('echmonth'), GETPOST('echday'), GETPOST('echyear'));
|
||||
@ -56,11 +62,28 @@ $label = GETPOST('label', 'alpha');
|
||||
$actioncode = GETPOST('actioncode');
|
||||
$fk_user = GETPOST('userid', 'int');
|
||||
|
||||
// Initialize technical objects
|
||||
$object = new ChargeSociales($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$diroutputmassaction = $conf->tax->dir_output.'/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('taxsocialcontributioncard', 'globalcard'));
|
||||
|
||||
if (empty($action) && empty($id) && empty($ref)) {
|
||||
$action = 'view';
|
||||
}
|
||||
|
||||
// Load object
|
||||
if ($id > 0) {
|
||||
$object->fetch($id);
|
||||
}
|
||||
|
||||
$permissiontoread = $user->rights->tax->charges->lire;
|
||||
$permissiontoadd = $user->rights->tax->charges->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$permissiontodelete = $user->rights->tax->charges->supprimer || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
$permissionnote = $user->rights->tax->charges->creer; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->rights->tax->charges->creer; // Used by the include of actions_dellink.inc.php
|
||||
$upload_dir = $conf->tax->multidir_output[isset($object->entity) ? $object->entity : 1];
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid', 'int');
|
||||
if ($user->socid) {
|
||||
@ -74,6 +97,12 @@ $result = restrictedArea($user, 'tax', $object->id, 'chargesociales', 'charges')
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
// Classify paid
|
||||
if ($action == 'confirm_paid' && $user->rights->tax->charges->creer && $confirm == 'yes') {
|
||||
$object->fetch($id);
|
||||
@ -122,7 +151,7 @@ if ($action == 'setmode' && $user->rights->tax->charges->creer) {
|
||||
}
|
||||
}
|
||||
|
||||
// bank account
|
||||
// Bank account
|
||||
if ($action == 'setbankaccount' && $user->rights->tax->charges->creer) {
|
||||
$object->fetch($id);
|
||||
$result = $object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
@ -151,7 +180,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') {
|
||||
|
||||
// Add social contribution
|
||||
if ($action == 'add' && $user->rights->tax->charges->creer) {
|
||||
$amount = price2num(GETPOST('amount'), 'MT');
|
||||
$amount = price2num(GETPOST('amount', 'alpha'), 'MT');
|
||||
|
||||
if (!$dateech) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors');
|
||||
@ -189,7 +218,7 @@ if ($action == 'add' && $user->rights->tax->charges->creer) {
|
||||
|
||||
|
||||
if ($action == 'update' && !GETPOST("cancel") && $user->rights->tax->charges->creer) {
|
||||
$amount = price2num(GETPOST('amount'), 'MT');
|
||||
$amount = price2num(GETPOST('amount', 'alpha'), 'MT');
|
||||
|
||||
if (!$dateech) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors');
|
||||
@ -297,6 +326,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
$formsocialcontrib = new FormSocialContrib($db);
|
||||
$bankaccountstatic = new Account($db);
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
@ -308,7 +338,7 @@ $help_url = 'EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividen
|
||||
llxHeader("", $title, $help_url);
|
||||
|
||||
|
||||
// Mode creation
|
||||
// Form to create a social contribution
|
||||
if ($action == 'create') {
|
||||
print load_fiche_titre($langs->trans("NewSocialContribution"));
|
||||
|
||||
@ -411,11 +441,7 @@ if ($action == 'create') {
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
/* *************************************************************************** */
|
||||
/* */
|
||||
/* Card Mode */
|
||||
/* */
|
||||
/* *************************************************************************** */
|
||||
// View mode
|
||||
if ($id > 0) {
|
||||
$object = new ChargeSociales($db);
|
||||
$result = $object->fetch($id);
|
||||
@ -594,7 +620,7 @@ if ($id > 0) {
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Bank Account
|
||||
// Bank account
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
@ -614,6 +640,11 @@ if ($id > 0) {
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
@ -627,7 +658,7 @@ if ($id > 0) {
|
||||
/*
|
||||
* Payments
|
||||
*/
|
||||
$sql = "SELECT p.rowid, p.num_paiement as num_payment, datep as dp, p.amount,";
|
||||
$sql = "SELECT p.rowid, p.num_paiement as num_payment, p.datep as dp, p.amount,";
|
||||
$sql .= " c.code as type_code,c.libelle as paiement_type,";
|
||||
$sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.currency_code as bacurrency_code, ba.fk_accountancy_journal';
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
|
||||
@ -637,7 +668,7 @@ if ($id > 0) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||
$sql .= " WHERE p.fk_charge = ".((int) $id);
|
||||
$sql .= " AND p.fk_charge = cs.rowid";
|
||||
$sql .= " AND cs.entity IN (".getEntity('tax').")";
|
||||
$sql .= " AND cs.entity IN (".getEntity('sc').")";
|
||||
$sql .= " ORDER BY dp DESC";
|
||||
|
||||
//print $sql;
|
||||
@ -735,22 +766,15 @@ if ($id > 0) {
|
||||
print dol_get_fiche_end();
|
||||
|
||||
if ($action == 'edit') {
|
||||
print '<div align="center">';
|
||||
print '<input type="submit" class="button button-save" name="save" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
}
|
||||
print $form->buttonsSaveCancel();
|
||||
|
||||
if ($action == 'edit') {
|
||||
print "</form>\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions buttons
|
||||
*/
|
||||
// Buttons for actions
|
||||
|
||||
if ($action != 'edit') {
|
||||
print '<div class="tabsAction">'."\n";
|
||||
|
||||
@ -788,6 +812,64 @@ if ($id > 0) {
|
||||
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
|
||||
// Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
if ($action != 'presend') {
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
$includedocgeneration = 1;
|
||||
|
||||
// Documents
|
||||
if ($includedocgeneration) {
|
||||
$objref = dol_sanitizeFileName($object->ref);
|
||||
$relativepath = $objref.'/'.$objref.'.pdf';
|
||||
$filedir = $conf->tax->dir_output.'/'.$objref;
|
||||
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||
//$genallowed = $user->rights->tax->charges->lire; // If you can read, you can build the PDF to read content
|
||||
$genallowed = 0;
|
||||
$delallowed = $user->rights->tax->charges->creer; // If you can create/edit, you can remove a file on card
|
||||
print $formfile->showdocuments('tax', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
|
||||
}
|
||||
|
||||
// Show links to link elements
|
||||
//$linktoelem = $form->showLinkToObjectBlock($object, null, array('myobject'));
|
||||
//$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||
|
||||
|
||||
print '</div><div class="fichehalfright">';
|
||||
|
||||
/*
|
||||
$MAXEVENT = 10;
|
||||
|
||||
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id);
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, $object->element.'@'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter);
|
||||
*/
|
||||
|
||||
print '</div></div>';
|
||||
}
|
||||
|
||||
//Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
// Presend form
|
||||
$modelmail = 'sc';
|
||||
$defaulttopic = 'InformationMessage';
|
||||
$diroutput = $conf->tax->dir_output;
|
||||
$trackid = 'sc'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
} else {
|
||||
/* Social contribution not found */
|
||||
dol_print_error('', $object->error);
|
||||
|
||||
@ -306,7 +306,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') {
|
||||
}
|
||||
|
||||
if ($action == 'update' && !GETPOST("cancel") && $user->rights->tax->charges->creer) {
|
||||
$amount = price2num(GETPOST('amount'));
|
||||
$amount = price2num(GETPOST('amount', 'alpha'), 'MT');
|
||||
|
||||
if (empty($amount)) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
|
||||
@ -317,7 +317,7 @@ if ($action == 'update' && !GETPOST("cancel") && $user->rights->tax->charges->cr
|
||||
} else {
|
||||
$result = $object->fetch($id);
|
||||
|
||||
$object->amount = price2num($amount);
|
||||
$object->amount = $amount;
|
||||
|
||||
$result = $object->update($user);
|
||||
if ($result <= 0) {
|
||||
@ -339,8 +339,8 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char
|
||||
$object->fetch($id);
|
||||
|
||||
if ($object->id > 0) {
|
||||
$object->paye = 0;
|
||||
$object->id = $object->ref = null;
|
||||
$object->paye = 0;
|
||||
|
||||
if (GETPOST('clone_label', 'alphanohtml')) {
|
||||
$object->label = GETPOST('clone_label', 'alphanohtml');
|
||||
@ -535,7 +535,7 @@ if ($action == 'create') {
|
||||
}
|
||||
|
||||
// View mode
|
||||
if ($id) {
|
||||
if ($id > 0) {
|
||||
$head = vat_prepare_head($object);
|
||||
|
||||
$totalpaye = $object->getSommePaiement();
|
||||
@ -705,7 +705,8 @@ if ($id) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/payment_vat/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"), "payment").' '.$objp->rowid.'</a></td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/payment_vat/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"), "payment").' '.$objp->rowid.'</a>';
|
||||
print '</td>';
|
||||
print '<td>'.dol_print_date($db->jdate($objp->dp), 'day')."</td>\n";
|
||||
$labeltype = $langs->trans("PaymentType".$objp->type_code) != ("PaymentType".$objp->type_code) ? $langs->trans("PaymentType".$objp->type_code) : $objp->paiement_type;
|
||||
print "<td>".$labeltype.' '.$objp->num_payment."</td>\n";
|
||||
@ -768,7 +769,7 @@ if ($id) {
|
||||
if ($action == 'edit') {
|
||||
print $form->buttonsSaveCancel();
|
||||
|
||||
print "</form>";
|
||||
print "</form>\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -282,18 +282,21 @@ $dolibarr_nocsrfcheck='0';
|
||||
// If set to 1, you will be able to define some command line in the internale Job scheduler module.
|
||||
// Default value: '0'
|
||||
// Examples: '1'
|
||||
//
|
||||
$dolibarr_cron_allow_cli='0';
|
||||
|
||||
// dolibarr_mailing_limit_sendbyweb
|
||||
// Can set a limit for mailing send by web. This overwrite database value. Can be used to restrict on OS level.
|
||||
// Can set a limit for mailing send by web. This overwrite database value. Can be used to restrict on system level.
|
||||
// Default value: '25'
|
||||
// Examples: '-1' (sending by web is forbidden)
|
||||
//
|
||||
// $dolibarr_mailing_limit_sendbyweb='25';
|
||||
|
||||
// dolibarr_mailing_limit_sendbycli
|
||||
// Can set a limit for mailing send by cli. This overwrite database value. Can be used to restrict on OS level.
|
||||
// Can set a limit for mailing send by cli. This overwrite database value. Can be used to restrict on system level.
|
||||
// Default value: '0' (no hard limit, use soft database value if exists)
|
||||
// Examples: '-1' (sending by cli is forbidden)
|
||||
//
|
||||
// $dolibarr_mailing_limit_sendbycli='0';
|
||||
|
||||
// MAIN_ANTIVIRUS_COMMAND (as a constant)
|
||||
@ -308,6 +311,17 @@ $dolibarr_cron_allow_cli='0';
|
||||
// Example: '--fdpass';
|
||||
// define('MAIN_ANTIVIRUS_PARAM', '--fdpass');
|
||||
|
||||
// php_session_save_handler
|
||||
// Try to use the Dolibarr internal session handler that uses a database instead of the PHP handler (experimental).
|
||||
// If you enable this feature to 'db', you may also want to enable the following constants:
|
||||
// $dolibarr_session_db_type, $dolibarr_session_db_host, $dolibarr_session_db_user, $dolibarr_session_db_pass
|
||||
// $dolibarr_session_db_pass, $dolibarr_session_db_name, $dolibarr_session_db_type = $dolibarr_main_db_port
|
||||
// Default value: ''
|
||||
// Example: 'db';
|
||||
//
|
||||
// $php_session_save_handler='';
|
||||
|
||||
|
||||
|
||||
//##################
|
||||
// Other
|
||||
|
||||
@ -204,6 +204,8 @@ if ($type == 'directory') {
|
||||
'contract',
|
||||
'product',
|
||||
'tax',
|
||||
'tax-vat',
|
||||
'salaries',
|
||||
'project',
|
||||
'project_task',
|
||||
'fichinter',
|
||||
@ -225,6 +227,7 @@ if ($type == 'directory') {
|
||||
// TODO change for multicompany sharing
|
||||
if ($module == 'company') {
|
||||
$upload_dir = $conf->societe->dir_output;
|
||||
$excludefiles[] = '^contact$'; // The subdir 'contact' contains files of contacts.
|
||||
} elseif ($module == 'invoice') {
|
||||
$upload_dir = $conf->facture->dir_output;
|
||||
} elseif ($module == 'invoice_supplier') {
|
||||
@ -243,6 +246,11 @@ if ($type == 'directory') {
|
||||
$upload_dir = $conf->product->dir_output;
|
||||
} elseif ($module == 'tax') {
|
||||
$upload_dir = $conf->tax->dir_output;
|
||||
$excludefiles[] = '^vat$'; // The subdir 'vat' contains files of vats.
|
||||
} elseif ($module == 'tax-vat') {
|
||||
$upload_dir = $conf->tax->dir_output.'/vat';
|
||||
} elseif ($module == 'salaries') {
|
||||
$upload_dir = $conf->salaries->dir_output;
|
||||
} elseif ($module == 'project') {
|
||||
$upload_dir = $conf->projet->dir_output;
|
||||
} elseif ($module == 'project_task') {
|
||||
@ -280,10 +288,6 @@ if ($type == 'directory') {
|
||||
|
||||
$textifempty = ($section ? $langs->trans("NoFileFound") : ($showonrightsize == 'featurenotyetavailable' ? $langs->trans("FeatureNotYetAvailable") : $langs->trans("NoFileFound")));
|
||||
|
||||
if ($module == 'company') {
|
||||
$excludefiles[] = '^contact$'; // The subdir 'contact' contains files of contacts with no id of thirdparty.
|
||||
}
|
||||
|
||||
$filter = preg_quote($search_doc_ref, '/');
|
||||
$filearray = dol_dir_list($upload_dir, "files", 1, $filter, $excludefiles, $sortfield, $sorting, 1);
|
||||
|
||||
|
||||
@ -125,7 +125,7 @@ $userstatic = new User($db);
|
||||
$form = new Form($db);
|
||||
$ecmdirstatic = new EcmDirectory($db);
|
||||
|
||||
// Load full tree of ECM module from database. We will use it to define nbofsubdir and nboffilesinsubdir
|
||||
// Load full manual tree of ECM module from database. We will use it to define nbofsubdir and nboffilesinsubdir
|
||||
if (empty($sqltree)) {
|
||||
$sqltree = $ecmdirstatic->get_full_arbo(0);
|
||||
}
|
||||
@ -169,7 +169,7 @@ if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_
|
||||
if (empty($conf->use_javascript_ajax) || !empty($conf->global->MAIN_ECM_DISABLE_JS)) {
|
||||
print '<ul class="ecmjqft">';
|
||||
|
||||
// Load full tree from database. We will use it to define nbofsubdir and nboffilesinsubdir
|
||||
// Load full manual tree from database. We will use it to define nbofsubdir and nboffilesinsubdir
|
||||
if (empty($sqltree)) {
|
||||
$sqltree = $ecmdirstatic->get_full_arbo(0); // Slow
|
||||
}
|
||||
|
||||
@ -1488,7 +1488,7 @@ class ExtraFields
|
||||
* @param string $key Key of attribute
|
||||
* @param string $value Value to show
|
||||
* @param string $moreparam To add more parameters on html input tag (only checkbox use html input for output rendering)
|
||||
* @param string $extrafieldsobjectkey If defined (for example $object->table_element), function uses the new method to get extrafields data
|
||||
* @param string $extrafieldsobjectkey Required (for example $object->table_element).
|
||||
* @return string Formated value
|
||||
*/
|
||||
public function showOutputField($key, $value, $moreparam = '', $extrafieldsobjectkey = '')
|
||||
@ -1510,11 +1510,9 @@ class ExtraFields
|
||||
$help = $this->attributes[$extrafieldsobjectkey]['help'][$key];
|
||||
$hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
|
||||
} else {
|
||||
// Old usage
|
||||
$label = $this->attribute_label[$key];
|
||||
$type = $this->attribute_type[$key];
|
||||
$help = ''; // Not supported with old syntax
|
||||
$hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
|
||||
// Old usage not allowed anymore
|
||||
dol_syslog(get_class($this).'::showOutputField extrafieldsobjectkey required', LOG_WARNING);
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($hidden) {
|
||||
|
||||
@ -8435,7 +8435,7 @@ class Form
|
||||
'label'=>'LinkToContract',
|
||||
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t, ".MAIN_DB_PREFIX."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier'
|
||||
),
|
||||
'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'),
|
||||
'fichinter'=>array('enabled'=>!empty($conf->ficheinter->enabled) ? $conf->ficheinter->enabled : 0, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'),
|
||||
'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled, 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'),
|
||||
'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled, 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
|
||||
'invoice_supplier'=>array('enabled'=>$conf->supplier_invoice->enabled, 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'),
|
||||
|
||||
@ -1676,6 +1676,12 @@ class FormFile
|
||||
} elseif ($modulepart == 'tax') {
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||
$object_instance = new ChargeSociales($this->db);
|
||||
} elseif ($modulepart == 'tax-vat') {
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||
$object_instance = new Tva($this->db);
|
||||
} elseif ($modulepart == 'salaries') {
|
||||
include_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php';
|
||||
$object_instance = new Salary($this->db);
|
||||
} elseif ($modulepart == 'project') {
|
||||
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
$object_instance = new Project($this->db);
|
||||
@ -1723,6 +1729,7 @@ class FormFile
|
||||
}
|
||||
|
||||
//var_dump($filearray);
|
||||
//var_dump($object_instance);
|
||||
|
||||
// Get list of files stored into database for same relative directory
|
||||
$relativepathfromroot = preg_replace('/'.preg_quote(DOL_DATA_ROOT.'/', '/').'/', '', $upload_dir);
|
||||
@ -1752,7 +1759,7 @@ class FormFile
|
||||
// To show ref or specific information according to view to show (defined by $modulepart)
|
||||
// $modulepart can be $object->table_name (that is 'mymodule_myobject') or $object->element.'-'.$module (for compatibility purpose)
|
||||
$reg = array();
|
||||
if ($modulepart == 'company' || $modulepart == 'tax') {
|
||||
if ($modulepart == 'company' || $modulepart == 'tax' || $modulepart == 'tax-vat' || $modulepart == 'salaries') {
|
||||
preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg);
|
||||
$id = (isset($reg[1]) ? $reg[1] : '');
|
||||
} elseif ($modulepart == 'invoice_supplier') {
|
||||
|
||||
@ -77,7 +77,10 @@ class FormOther
|
||||
$out .= '<input type="radio" name="barcodemode" value="barcodeforproduct"> Scan a product barcode<br>';
|
||||
$out .= '<input type="radio" name="barcodemode" value="barcodeforlotserial"> Scan a product lot or serial number<br>';
|
||||
|
||||
$out .= $langs->trans("QtyToAddAfterBarcodeScan").' <input type="text" name="barcodeproductqty" class="width50 right" value="1"><br>';
|
||||
$stringaddbarcode = $langs->trans("QtyToAddAfterBarcodeScan", "tmphtml");
|
||||
$htmltoreplaceby = '<select name="selectaddorreplace"><option selected value="add">'.$langs->trans("Add").'</option><option value="replace">'.$langs->trans("ToReplace").'</option></select>';
|
||||
$stringaddbarcode = str_replace("tmphtml", $htmltoreplaceby, $stringaddbarcode);
|
||||
$out .= $stringaddbarcode.' <input type="text" name="barcodeproductqty" class="width50 right" value="1"><br>';
|
||||
$out .= '<textarea type="text" name="barcodelist" class="centpercent" autofocus rows="'.ROWS_3.'"></textarea>';
|
||||
|
||||
/*print '<br>'.$langs->trans("or").'<br>';
|
||||
|
||||
@ -29,15 +29,29 @@
|
||||
/**
|
||||
* The session open handler called by PHP whenever a session is initialized.
|
||||
*
|
||||
* @param string $database_name Database NamedConstraint
|
||||
* @param string $table_name Table name
|
||||
* @param string $save_path Value of session.save_path into php.ini
|
||||
* @param string $session_name Session name (Example: 'DOLSESSID_xxxxxx')
|
||||
* @return boolean Always true
|
||||
*/
|
||||
function dolSessionOpen($database_name, $table_name)
|
||||
function dolSessionOpen($save_path, $session_name)
|
||||
{
|
||||
global $conf, $dbsession;
|
||||
global $dbsession;
|
||||
|
||||
$dbsession = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port);
|
||||
global $dolibarr_main_db_type, $dolibarr_main_db_host;
|
||||
global $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name, $dolibarr_main_db_port;
|
||||
|
||||
global $dolibarr_session_db_type, $dolibarr_session_db_host;
|
||||
global $dolibarr_session_db_user, $dolibarr_session_db_pass, $dolibarr_session_db_name, $dolibarr_session_db_port;
|
||||
|
||||
if (empty($dolibarr_session_db_type)) { $dolibarr_session_db_type = $dolibarr_main_db_type; }
|
||||
if (empty($dolibarr_session_db_host)) { $dolibarr_session_db_host = $dolibarr_main_db_host; }
|
||||
if (empty($dolibarr_session_db_user)) { $dolibarr_session_db_user = $dolibarr_main_db_user; }
|
||||
if (empty($dolibarr_session_db_pass)) { $dolibarr_session_db_pass = $dolibarr_main_db_pass; }
|
||||
if (empty($dolibarr_session_db_name)) { $dolibarr_session_db_name = $dolibarr_main_db_name; }
|
||||
if (empty($dolibarr_session_db_port)) { $dolibarr_session_db_port = $dolibarr_main_db_port; }
|
||||
//var_dump('open '.$database_name.' '.$table_name);
|
||||
|
||||
$dbsession = getDoliDBInstance($dolibarr_session_db_type, $dolibarr_session_db_host, $dolibarr_session_db_user, $dolibarr_session_db_pass, $dolibarr_session_db_name, $dolibarr_session_db_port);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -51,8 +65,10 @@ function dolSessionOpen($database_name, $table_name)
|
||||
function dolSessionRead($sess_id)
|
||||
{
|
||||
global $dbsession;
|
||||
global $sessionlastvalueread;
|
||||
global $sessionidfound;
|
||||
|
||||
$sql = "SELECT session_variable FROM ".MAIN_DB_PREFIX."session";
|
||||
$sql = "SELECT session_id, session_variable FROM ".MAIN_DB_PREFIX."session";
|
||||
$sql .= " WHERE session_id = '".$dbsession->escape($sess_id)."'";
|
||||
|
||||
// Execute the query
|
||||
@ -60,10 +76,16 @@ function dolSessionRead($sess_id)
|
||||
$num_rows = $dbsession->num_rows($resql);
|
||||
if ($num_rows == 0) {
|
||||
// No session found - return an empty string
|
||||
$sessionlastvalueread = '';
|
||||
$sessionidfound = '';
|
||||
return '';
|
||||
} else {
|
||||
// Found a session - return the serialized string
|
||||
$obj = $dbsession->fetch_object($resql);
|
||||
$sessionlastvalueread = $obj->session_variable;
|
||||
$sessionidfound = $obj->session_id;
|
||||
//var_dump($sessionlastvalueread);
|
||||
//var_dump($sessionidfound);
|
||||
return $obj->session_variable;
|
||||
}
|
||||
}
|
||||
@ -79,42 +101,84 @@ function dolSessionRead($sess_id)
|
||||
function dolSessionWrite($sess_id, $val)
|
||||
{
|
||||
global $dbsession;
|
||||
global $sessionlastvalueread;
|
||||
global $sessionidfound;
|
||||
|
||||
$time_stamp = dol_now();
|
||||
/*var_dump('write '.$sess_id);
|
||||
var_dump($val);
|
||||
var_dump('sessionlastvalueread='.$sessionlastvalueread.' sessionidfound='.$sessionidfound);
|
||||
*/
|
||||
|
||||
$sql = "SELECT session_id FROM ".MAIN_DB_PREFIX."session";
|
||||
$sql .= " WHERE session_id = '".$dbsession->escape($sess_id)."'";
|
||||
//$sessionlastvalueread='';
|
||||
if ($sessionlastvalueread != $val) {
|
||||
$time_stamp = dol_now();
|
||||
|
||||
// Execute the query
|
||||
$resql = $dbsession->query($sql);
|
||||
$num_rows = $dbsession->num_rows($resql);
|
||||
if ($num_rows == 0) {
|
||||
// No session found, insert a new one
|
||||
$insert_query = "INSERT INTO ".MAIN_DB_PREFIX."session";
|
||||
$insert_query .= "(session_id, session_variable, last_accessed)";
|
||||
$insert_query .= " VALUES ('".$dbsession->escape($sess_id)."', '".$dbsession->escape($val)."', '".$dbsession->idate($time_stamp)."')";
|
||||
$dbsession->query($insert_query);
|
||||
} else {
|
||||
// Existing session found - Update the session variables
|
||||
$update_query = "UPDATE ".MAIN_DB_PREFIX."session";
|
||||
$update_query .= "SET session_variable = '".$dbsession->escape($val)."',";
|
||||
$update_query .= " last_accessed = '".$dbsession->idate($time_stamp)."'";
|
||||
$update_query .= " WHERE session_id = '".$dbsession->escape($sess_id)."'";
|
||||
$dbsession->query($update_query);
|
||||
if (empty($sessionidfound)) {
|
||||
// No session found, insert a new one
|
||||
$insert_query = "INSERT INTO ".MAIN_DB_PREFIX."session";
|
||||
$insert_query .= "(session_id, session_variable, last_accessed, fk_user, remote_ip, user_agent)";
|
||||
$insert_query .= " VALUES ('".$dbsession->escape($sess_id)."', '".$dbsession->escape($val)."', '".$dbsession->idate($time_stamp)."', 0, '".$dbsession->escape(getUserRemoteIP())."', '".$dbsession->escape($_SERVER['HTTP_USER_AGENT'])."')";
|
||||
|
||||
$result = $dbsession->query($insert_query);
|
||||
if (!$result) {
|
||||
dol_print_error($dbsession);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if ($sessionidfound != $sess_id) {
|
||||
// oops. How can this happen ?
|
||||
dol_print_error($dbsession, 'Oops sess_id received in dolSessionWrite differs from the cache value $sessionidfound. How can this happen ?');
|
||||
return false;
|
||||
}
|
||||
/*$sql = "SELECT session_id, session_variable FROM ".MAIN_DB_PREFIX."session";
|
||||
$sql .= " WHERE session_id = '".$dbsession->escape($sess_id)."'";
|
||||
|
||||
// Execute the query
|
||||
$resql = $dbsession->query($sql);
|
||||
$num_rows = $dbsession->num_rows($resql);
|
||||
if ($num_rows == 0) {
|
||||
// No session found, insert a new one
|
||||
$insert_query = "INSERT INTO ".MAIN_DB_PREFIX."session";
|
||||
$insert_query .= "(session_id, session_variable, last_accessed, fk_user, remote_ip, user_agent)";
|
||||
$insert_query .= " VALUES ('".$dbsession->escape($sess_id)."', '".$dbsession->escape($val)."', '".$dbsession->idate($time_stamp)."', 0, '".$dbsession->escape(getUserRemoteIP())."', '".$dbsession->escape($_SERVER['HTTP_USER_AGENT'])."')";
|
||||
var_dump($insert_query);
|
||||
$result = $dbsession->query($insert_query);
|
||||
if (!$result) {
|
||||
dol_print_error($dbsession);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
*/
|
||||
// Existing session found - Update the session variables
|
||||
$update_query = "UPDATE ".MAIN_DB_PREFIX."session";
|
||||
$update_query .= " SET session_variable = '".$dbsession->escape($val)."',";
|
||||
$update_query .= " last_accessed = '".$dbsession->idate($time_stamp)."',";
|
||||
$update_query .= " remote_ip = '".$dbsession->escape(getUserRemoteIP())."',";
|
||||
$update_query .= " user_agent = '".$dbsession->escape($_SERVER['HTTP_USER_AGENT'])."'";
|
||||
$update_query .= " WHERE session_id = '".$dbsession->escape($sess_id)."'";
|
||||
|
||||
$result = $dbsession->query($update_query);
|
||||
if (!$result) {
|
||||
dol_print_error($dbsession);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is executed on shutdown of the session.
|
||||
*
|
||||
* @param string $sess_id Session ID
|
||||
* @return boolean Always returns true.
|
||||
*/
|
||||
function dolSessionClose($sess_id)
|
||||
function dolSessionClose()
|
||||
{
|
||||
global $dbsession;
|
||||
|
||||
//var_dump('close');
|
||||
|
||||
$dbsession->close();
|
||||
|
||||
return true;
|
||||
@ -130,6 +194,8 @@ function dolSessionDestroy($sess_id)
|
||||
{
|
||||
global $dbsession;
|
||||
|
||||
//var_dump('destroy');
|
||||
|
||||
$delete_query = "DELETE FROM ".MAIN_DB_PREFIX."session";
|
||||
$delete_query .= " WHERE session_id = '".$dbsession->escape($sess_id)."'";
|
||||
$dbsession->query($delete_query);
|
||||
|
||||
@ -1049,15 +1049,19 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps,PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
* Create tables and keys required by module.
|
||||
* Files module.sql and module.key.sql with create table and create keys
|
||||
* commands must be stored in directory reldir='/module/sql/'
|
||||
* This function is called by this->init
|
||||
* Create tables and keys required by module:
|
||||
* - Files module.sql files with create table instructions
|
||||
* - Then files modules.key.sql with create keys instructions
|
||||
* - Then data_xxx.sql (usualy provided by external modules only)
|
||||
* - Then update_xxx.sql (usualy provided by external modules only)
|
||||
* Files must be stored in directory defined by reldir (Example: '/install/mysql/tables' or '/module/sql/')
|
||||
* This function is usually called by the this->init of module descriptors.
|
||||
*
|
||||
* @param string $reldir Relative directory where to scan files
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
* @param string $reldir Relative directory where to scan files. Example: '/install/mysql/tables' or '/module/sql/'
|
||||
* @param string $onlywithsuffix Only with the defined suffix
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
protected function _load_tables($reldir)
|
||||
protected function _load_tables($reldir, $onlywithsuffix = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
@ -1088,6 +1092,14 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
}
|
||||
sort($files);
|
||||
foreach ($files as $file) {
|
||||
if ($onlywithsuffix) {
|
||||
if (!preg_match('/\-'.preg_quote($onlywithsuffix, '/').'\./i', $file)) {
|
||||
//print 'File '.$file.' does not match suffix '.$onlywithsuffix.' so it is discarded<br>'."\n";
|
||||
continue;
|
||||
} else {
|
||||
//print 'File '.$file.' match suffix '.$onlywithsuffix.' so we keep it<br>'."\n";
|
||||
}
|
||||
}
|
||||
if (preg_match('/\.sql$/i', $file) && !preg_match('/\.key\.sql$/i', $file) && substr($file, 0, 4) == 'llx_' && substr($file, 0, 4) != 'data') {
|
||||
$result = run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG) ? 1 : 0, '', 1);
|
||||
if ($result <= 0) {
|
||||
@ -1105,6 +1117,14 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
}
|
||||
sort($files);
|
||||
foreach ($files as $file) {
|
||||
if ($onlywithsuffix) {
|
||||
if (!preg_match('/\-'.preg_quote($onlywithsuffix, '/').'\./i', $file)) {
|
||||
//print 'File '.$file.' does not match suffix '.$onlywithsuffix.' so it is discarded<br>'."\n";
|
||||
continue;
|
||||
} else {
|
||||
//print 'File '.$file.' match suffix '.$onlywithsuffix.' so we keep it<br>'."\n";
|
||||
}
|
||||
}
|
||||
if (preg_match('/\.key\.sql$/i', $file) && substr($file, 0, 4) == 'llx_' && substr($file, 0, 4) != 'data') {
|
||||
$result = run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG) ? 1 : 0, '', 1);
|
||||
if ($result <= 0) {
|
||||
@ -1122,6 +1142,14 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
}
|
||||
sort($files);
|
||||
foreach ($files as $file) {
|
||||
if ($onlywithsuffix) {
|
||||
if (!preg_match('/\-'.preg_quote($onlywithsuffix, '/').'\./i', $file)) {
|
||||
//print 'File '.$file.' does not match suffix '.$onlywithsuffix.' so it is discarded<br>'."\n";
|
||||
continue;
|
||||
} else {
|
||||
//print 'File '.$file.' match suffix '.$onlywithsuffix.' so we keep it<br>'."\n";
|
||||
}
|
||||
}
|
||||
if (preg_match('/\.sql$/i', $file) && !preg_match('/\.key\.sql$/i', $file) && substr($file, 0, 4) == 'data') {
|
||||
$result = run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG) ? 1 : 0, '', 1);
|
||||
if ($result <= 0) {
|
||||
@ -1139,6 +1167,14 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
}
|
||||
sort($files);
|
||||
foreach ($files as $file) {
|
||||
if ($onlywithsuffix) {
|
||||
if (!preg_match('/\-'.preg_quote($onlywithsuffix, '/').'\./i', $file)) {
|
||||
//print 'File '.$file.' does not match suffix '.$onlywithsuffix.' so it is discarded<br>'."\n";
|
||||
continue;
|
||||
} else {
|
||||
//print 'File '.$file.' match suffix '.$onlywithsuffix.' so we keep it<br>'."\n";
|
||||
}
|
||||
}
|
||||
if (preg_match('/\.sql$/i', $file) && !preg_match('/\.key\.sql$/i', $file) && substr($file, 0, 6) == 'update') {
|
||||
$result = run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG) ? 1 : 0, '', 1);
|
||||
if ($result <= 0) {
|
||||
|
||||
@ -56,7 +56,7 @@ class modHRM extends DolibarrModules
|
||||
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->description = "HRM";
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = 'development';
|
||||
$this->version = 'experimental';
|
||||
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
// Name of image file used for this module.
|
||||
@ -268,10 +268,10 @@ class modHRM extends DolibarrModules
|
||||
// Permissions
|
||||
$this->remove($options);
|
||||
|
||||
/*$result = $this->_load_tables('/hrm/sql/');
|
||||
$result = $this->_load_tables('/install/mysql/tables/', 'hrm');
|
||||
if ($result < 0) {
|
||||
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
|
||||
}*/
|
||||
}
|
||||
|
||||
$sql = array();
|
||||
|
||||
|
||||
@ -233,7 +233,7 @@ if (!in_array($nowyear, $arrayyears)) {
|
||||
$arrayyears[$nowyear] = $nowyear;
|
||||
}
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0, 0, 0, '', 0, 0, 0, '', 'width75');
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="center" colspan="2"><input type="submit" name="submit" class="button small" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
|
||||
@ -310,59 +310,73 @@ $rowspan = 0;
|
||||
$sectionauto = array();
|
||||
if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) {
|
||||
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
|
||||
$langs->load("products"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'product', 'test'=>(!empty($conf->product->enabled) || !empty($conf->service->enabled)), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts"));
|
||||
$langs->load("products");
|
||||
$rowspan++; $sectionauto[] = array('position'=>10, 'level'=>1, 'module'=>'product', 'test'=>(!empty($conf->product->enabled) || !empty($conf->service->enabled)), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts"));
|
||||
}
|
||||
if (!empty($conf->societe->enabled)) {
|
||||
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ThirdParties")));
|
||||
$rowspan++; $sectionauto[] = array('position'=>20, 'level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ThirdParties")));
|
||||
}
|
||||
if (!empty($conf->propal->enabled)) {
|
||||
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Proposals")));
|
||||
$rowspan++; $sectionauto[] = array('position'=>30, 'level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Proposals")));
|
||||
}
|
||||
if (!empty($conf->contrat->enabled)) {
|
||||
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'contract', 'test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Contracts")));
|
||||
$rowspan++; $sectionauto[] = array('position'=>40, 'level'=>1, 'module'=>'contract', 'test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Contracts")));
|
||||
}
|
||||
if (!empty($conf->commande->enabled)) {
|
||||
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled, 'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Orders")));
|
||||
$rowspan++; $sectionauto[] = array('position'=>50, 'level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled, 'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Orders")));
|
||||
}
|
||||
if (!empty($conf->facture->enabled)) {
|
||||
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Invoices")));
|
||||
$rowspan++; $sectionauto[] = array('position'=>60, 'level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Invoices")));
|
||||
}
|
||||
if (!empty($conf->supplier_proposal->enabled)) {
|
||||
$langs->load("supplier_proposal"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'supplier_proposal', 'test'=>$conf->supplier_proposal->enabled, 'label'=>$langs->trans("SupplierProposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierProposals")));
|
||||
$langs->load("supplier_proposal");
|
||||
$rowspan++; $sectionauto[] = array('position'=>70, 'level'=>1, 'module'=>'supplier_proposal', 'test'=>$conf->supplier_proposal->enabled, 'label'=>$langs->trans("SupplierProposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierProposals")));
|
||||
}
|
||||
if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) {
|
||||
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order_supplier', 'test'=>(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)), 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("PurchaseOrders")));
|
||||
$rowspan++; $sectionauto[] = array('position'=>80, 'level'=>1, 'module'=>'order_supplier', 'test'=>(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)), 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("PurchaseOrders")));
|
||||
}
|
||||
if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) {
|
||||
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice_supplier', 'test'=>(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)), 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierInvoices")));
|
||||
$rowspan++; $sectionauto[] = array('position'=>90, 'level'=>1, 'module'=>'invoice_supplier', 'test'=>(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)), 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierInvoices")));
|
||||
}
|
||||
if (!empty($conf->tax->enabled)) {
|
||||
$langs->load("compta"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SocialContributions")));
|
||||
$langs->load("compta");
|
||||
$rowspan++; $sectionauto[] = array('position'=>100, 'level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SocialContributions")));
|
||||
$rowspan++; $sectionauto[] = array('position'=>110, 'level'=>1, 'module'=>'tax-vat', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("VAT"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("VAT")));
|
||||
}
|
||||
if (!empty($conf->salaries->enabled)) {
|
||||
$langs->load("compta");
|
||||
$rowspan++; $sectionauto[] = array('position'=>120, 'level'=>1, 'module'=>'salaries', 'test'=>$conf->salaries->enabled, 'label'=>$langs->trans("Salaries"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Salaries")));
|
||||
}
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects")));
|
||||
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project_task', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Tasks"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Tasks")));
|
||||
$rowspan++; $sectionauto[] = array('position'=>130, 'level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects")));
|
||||
$rowspan++; $sectionauto[] = array('position'=>140, 'level'=>1, 'module'=>'project_task', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Tasks"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Tasks")));
|
||||
}
|
||||
if (!empty($conf->ficheinter->enabled)) {
|
||||
$langs->load("interventions"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions")));
|
||||
$langs->load("interventions");
|
||||
$rowspan++; $sectionauto[] = array('position'=>150, 'level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions")));
|
||||
}
|
||||
if (!empty($conf->expensereport->enabled)) {
|
||||
$langs->load("trips"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'expensereport', 'test'=>$conf->expensereport->enabled, 'label'=>$langs->trans("ExpenseReports"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ExpenseReports")));
|
||||
$langs->load("trips");
|
||||
$rowspan++; $sectionauto[] = array('position'=>160, 'level'=>1, 'module'=>'expensereport', 'test'=>$conf->expensereport->enabled, 'label'=>$langs->trans("ExpenseReports"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ExpenseReports")));
|
||||
}
|
||||
if (!empty($conf->holiday->enabled)) {
|
||||
$langs->load("holiday"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'holiday', 'test'=>$conf->holiday->enabled, 'label'=>$langs->trans("Holidays"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Holidays")));
|
||||
$langs->load("holiday");
|
||||
$rowspan++; $sectionauto[] = array('position'=>170, 'level'=>1, 'module'=>'holiday', 'test'=>$conf->holiday->enabled, 'label'=>$langs->trans("Holidays"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Holidays")));
|
||||
}
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
$langs->load("banks"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'banque', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("BankAccount"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("BankAccount")));
|
||||
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'chequereceipt', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("CheckReceipt"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("CheckReceipt")));
|
||||
$langs->load("banks");
|
||||
$rowspan++; $sectionauto[] = array('position'=>180, 'level'=>1, 'module'=>'banque', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("BankAccount"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("BankAccount")));
|
||||
$rowspan++; $sectionauto[] = array('position'=>190, 'level'=>1, 'module'=>'chequereceipt', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("CheckReceipt"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("CheckReceipt")));
|
||||
}
|
||||
if (!empty($conf->mrp->enabled)) {
|
||||
$langs->load("mrp"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'mrp-mo', 'test'=>$conf->mrp->enabled, 'label'=>$langs->trans("MOs"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ManufacturingOrders")));
|
||||
$langs->load("mrp");
|
||||
$rowspan++; $sectionauto[] = array('position'=>200, 'level'=>1, 'module'=>'mrp-mo', 'test'=>$conf->mrp->enabled, 'label'=>$langs->trans("MOs"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ManufacturingOrders")));
|
||||
}
|
||||
if (!empty($conf->recruitment->enabled)) {
|
||||
$langs->load("recruitment"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'recruitment-recruitmentcandidature', 'test'=>$conf->recruitment->enabled, 'label'=>$langs->trans("Candidatures"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("JobApplications")));
|
||||
$langs->load("recruitment");
|
||||
$rowspan++; $sectionauto[] = array('position'=>210, 'level'=>1, 'module'=>'recruitment-recruitmentcandidature', 'test'=>$conf->recruitment->enabled, 'label'=>$langs->trans("Candidatures"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("JobApplications")));
|
||||
}
|
||||
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'user', 'test'=>1, 'label'=>$langs->trans("Users"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Users")));
|
||||
$rowspan++; $sectionauto[] = array('position'=>220, 'level'=>1, 'module'=>'user', 'test'=>1, 'label'=>$langs->trans("Users"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Users")));
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters);
|
||||
@ -439,7 +453,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i', $act
|
||||
$oldvallevel = 0;
|
||||
foreach ($sectionauto as $key => $val) {
|
||||
if (empty($val['test'])) {
|
||||
continue; // If condition to show is ok
|
||||
continue; // If condition to show the ECM auto directory is ok
|
||||
}
|
||||
|
||||
print '<li class="directory collapsed">';
|
||||
@ -482,7 +496,6 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i', $act
|
||||
<?php
|
||||
// Start right panel
|
||||
|
||||
|
||||
$mode = 'noajax';
|
||||
$url = DOL_URL_ROOT.'/ecm/index_auto.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php';
|
||||
|
||||
@ -238,7 +238,7 @@ if (!in_array($nowyear, $arrayyears)) {
|
||||
$arrayyears[$nowyear] = $nowyear;
|
||||
}
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0, 0, 0, '', 0, 0, 0, '', 'width75');
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="center" colspan="2"><input type="submit" name="submit" class="button small" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
|
||||
@ -1098,6 +1098,7 @@ if (empty($reshook)) {
|
||||
$arrayoffiles = GETPOST('attachfile', 'array');
|
||||
if (is_array($arrayoffiles) && !empty($arrayoffiles[0])) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
|
||||
$entityprefix = ($conf->entity != '1') ? $conf->entity.'/' : '';
|
||||
$relativepath = 'expensereport/'.$object->ref.'/'.$arrayoffiles[0];
|
||||
$ecmfiles = new EcmFiles($db);
|
||||
$ecmfiles->fetch(0, '', $relativepath);
|
||||
|
||||
@ -249,7 +249,7 @@ if (!in_array($year, $arrayyears)) {
|
||||
$arrayyears[$year] = $year;
|
||||
}
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0, 0, 0, '', 0, 0, 0, '', 'width75');
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="center" colspan="2"><input type="submit" name="submit" class="button small" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
|
||||
@ -245,7 +245,7 @@ if (!in_array($nowyear, $arrayyears)) {
|
||||
$arrayyears[$nowyear] = $nowyear;
|
||||
}
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0, 0, 0, '', 0, 0, 0, '', 'width75');
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="center" colspan="2"><input type="submit" name="submit" class="button small" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
|
||||
@ -348,7 +348,7 @@ if ($moreforfilter) {
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER['PHP_SELF'] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
if ($massactionbutton) {
|
||||
if (!empty($massactionbutton)) {
|
||||
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
||||
}
|
||||
|
||||
|
||||
@ -25,5 +25,5 @@ ALTER TABLE llx_hrm_evaluationdet ADD INDEX idx_hrm_evaluationdet_fk_evaluation
|
||||
|
||||
--ALTER TABLE llx_hrm_evaluationdet ADD UNIQUE INDEX uk_hrm_evaluationdet_fieldxy(fieldx, fieldy);
|
||||
|
||||
--ALTER TABLE llx_hrm_evaluationdet ADD CONSTRAINT llx_hrm_evaluationdet_fk_field FOREIGN KEY (fk_field) REFERENCES llx_hrm_myotherobject(rowid);
|
||||
ALTER TABLE llx_hrm_evaluationdet ADD CONSTRAINT llx_hrm_evaluationdet_fk_evaluation FOREIGN KEY (fk_evaluation) REFERENCES llx_hrm_evaluation(rowid);
|
||||
|
||||
|
||||
@ -23,5 +23,5 @@ ALTER TABLE llx_hrm_skilldet ADD CONSTRAINT llx_hrm_skilldet_fk_user_creat FOREI
|
||||
|
||||
--ALTER TABLE llx_hrm_skilldet ADD UNIQUE INDEX uk_hrm_skilldet_fieldxy(fieldx, fieldy);
|
||||
|
||||
--ALTER TABLE llx_hrm_skilldet ADD CONSTRAINT llx_hrm_skilldet_fk_field FOREIGN KEY (fk_field) REFERENCES llx_hrm_myotherobject(rowid);
|
||||
ALTER TABLE llx_hrm_skilldet ADD CONSTRAINT llx_hrm_skilldet_fk_skill FOREIGN KEY (fk_skill) REFERENCES llx_hrm_skill(rowid);
|
||||
|
||||
|
||||
@ -23,5 +23,5 @@ ALTER TABLE llx_hrm_skillrank ADD CONSTRAINT llx_hrm_skillrank_fk_user_creat FOR
|
||||
|
||||
--ALTER TABLE llx_hrm_skillrank ADD UNIQUE INDEX uk_hrm_skillrank_fieldxy(fieldx, fieldy);
|
||||
|
||||
--ALTER TABLE llx_hrm_skillrank ADD CONSTRAINT llx_hrm_skillrank_fk_field FOREIGN KEY (fk_field) REFERENCES llx_hrm_myotherobject(rowid);
|
||||
ALTER TABLE llx_hrm_skillrank ADD CONSTRAINT llx_hrm_skillrank_fk_skill FOREIGN KEY (fk_skill) REFERENCES llx_hrm_skill(rowid);
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ ManageLotMask=Custom mask
|
||||
CustomMasks=Option to define a different numbering mask for each product
|
||||
BatchLotNumberingModules=Numbering rule for automatic generation of lot number
|
||||
BatchSerialNumberingModules=Numbering rule for automatic generation of serial number (for products with property 1 unique lot/serial for each product)
|
||||
QtyToAddAfterBarcodeScan=Qty to add for each barcode/lot/serial scanned
|
||||
QtyToAddAfterBarcodeScan=Qty to %s for each barcode/lot/serial scanned
|
||||
LifeTime=Life span (in days)
|
||||
EndOfLife=End of life
|
||||
ManufacturingDate=Manufacturing date
|
||||
@ -42,3 +42,4 @@ HideLots=Hide lots
|
||||
#Traceability - qc status
|
||||
OutOfOrder=Out of order
|
||||
InWorkingOrder=In working order
|
||||
ToReplace=Replace
|
||||
@ -265,4 +265,5 @@ ProductBarcodeDoesNotExist=Product with barcode does not exist
|
||||
WarehouseId=Warehouse ID
|
||||
WarehouseRef=Warehouse Ref
|
||||
SaveQtyFirst=Save the real inventoried quantities first, before asking creation of the stock movement.
|
||||
InventoryStartedShort=Started
|
||||
InventoryStartedShort=Started
|
||||
ErrorOnElementsInventory=Scan was aborted due to following barcode or batch number on error
|
||||
@ -30,7 +30,7 @@ ManageLotMask=Masque personnalisé
|
||||
CustomMasks=Option pour définir un masque de numérotation différent pour chaque produit
|
||||
BatchLotNumberingModules=Règle de numérotation pour la génération automatique de numéro de lot
|
||||
BatchSerialNumberingModules=Règle de numérotation pour la génération automatique de numéro de série (pour les produits avec propriété 1 lot/série unique pour chaque produit)
|
||||
QtyToAddAfterBarcodeScan=Quantité à ajouter pour chaque code à barres/lot/série scanné
|
||||
QtyToAddAfterBarcodeScan=Quantité à %s pour chaque code à barres/lot/série scanné
|
||||
LifeTime=Durée de vie (en jours)
|
||||
EndOfLife=Fin d'utilisation
|
||||
ManufacturingDate=Date de fabrication
|
||||
|
||||
@ -272,10 +272,10 @@ if (!empty($_POST["DOL_AUTOSET_COOKIE"])) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set the handler of session
|
||||
if (ini_get('session.save_handler') == 'user') {
|
||||
require_once 'core/lib/phpsessionindb.lib.php';
|
||||
// if (ini_get('session.save_handler') == 'user')
|
||||
if (!empty($php_session_save_handler) && $php_session_save_handler == 'db') {
|
||||
require_once 'core/lib/phpsessionin'.$php_session_save_handler.'.lib.php';
|
||||
}
|
||||
|
||||
// Init session. Name of session is specific to Dolibarr instance.
|
||||
@ -294,7 +294,8 @@ if (!empty($_COOKIE[$sessiontimeout])) {
|
||||
if (!defined('NOSESSION')) {
|
||||
session_set_cookie_params(0, '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // Add tag secure and httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start.
|
||||
session_name($sessionname);
|
||||
session_start();
|
||||
session_start(); // This call the open and read of session handler
|
||||
//exit; // this exist generates a call to write and close
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -161,9 +161,10 @@ if (!defined('NOREQUIREDB')) {
|
||||
}
|
||||
|
||||
// Now database connexion is known, so we can forget password
|
||||
//unset($dolibarr_main_db_pass); // We comment this because this constant is used in a lot of pages
|
||||
//unset($dolibarr_main_db_pass); // We comment this because this constant is used in some other pages
|
||||
unset($conf->db->pass); // This is to avoid password to be shown in memory/swap dump
|
||||
|
||||
|
||||
/*
|
||||
* Object $user
|
||||
*/
|
||||
@ -171,9 +172,9 @@ if (!defined('NOREQUIREUSER')) {
|
||||
$user = new User($db);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Load object $conf
|
||||
* After this, all parameters conf->global->CONSTANTS are loaded
|
||||
*/
|
||||
|
||||
// By default conf->entity is 1, but we change this if we ask another value.
|
||||
@ -190,15 +191,12 @@ if (session_id() && !empty($_SESSION["dol_entity"])) {
|
||||
// For public page with MultiCompany module
|
||||
$conf->entity = constant('DOLENTITY');
|
||||
}
|
||||
|
||||
// Sanitize entity
|
||||
if (!is_numeric($conf->entity)) {
|
||||
$conf->entity = 1;
|
||||
}
|
||||
|
||||
//print "We work with data into entity instance number '".$conf->entity."'";
|
||||
|
||||
// Here we read database (llx_const table) and define $conf->global->XXX var.
|
||||
//print "We work with data into entity instance number '".$conf->entity."'";
|
||||
$conf->setValues($db);
|
||||
|
||||
// Create object $mysoc (A thirdparty object that contains properties of companies managed by Dolibarr.
|
||||
|
||||
@ -1,47 +0,0 @@
|
||||
<?php
|
||||
|
||||
require '../../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/inventory/class/inventory.class.php';
|
||||
|
||||
$get = GETPOST('get', 'alpha');
|
||||
$put = GETPOST('put', 'alpha');
|
||||
|
||||
switch ($put) {
|
||||
case 'qty':
|
||||
if (empty($user->rights->stock->creer)) {
|
||||
echo -1; exit;
|
||||
}
|
||||
|
||||
$fk_det_inventory = GETPOST('fk_det_inventory');
|
||||
|
||||
$det = new InventoryLine($db);
|
||||
if ($det->fetch($fk_det_inventory)) {
|
||||
$det->qty_view += GETPOST('qty');
|
||||
$res = $det->update($user);
|
||||
|
||||
echo $det->qty_view;
|
||||
} else {
|
||||
echo -2;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'pmp':
|
||||
if (empty($user->rights->stock->creer) || empty($user->rights->stock->changePMP)) {
|
||||
echo -1; exit;
|
||||
}
|
||||
|
||||
$fk_det_inventory = GETPOST('fk_det_inventory');
|
||||
|
||||
$det = new InventoryLine($db);
|
||||
if ($det->fetch($fk_det_inventory)) {
|
||||
$det->new_pmp = price2num(GETPOST('pmp'));
|
||||
$det->update($user);
|
||||
|
||||
echo $det->new_pmp;
|
||||
} else {
|
||||
echo -2;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
135
htdocs/product/inventory/ajax/searchfrombarcode.php
Normal file
135
htdocs/product/inventory/ajax/searchfrombarcode.php
Normal file
@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file /htdocs/product/inventory/ajax/searchfrombarcode.php
|
||||
* \brief File to make Ajax action on product and stock
|
||||
*/
|
||||
|
||||
if (!defined('NOTOKENRENEWAL')) {
|
||||
define('NOTOKENRENEWAL', 1); // Disables token renewal
|
||||
}
|
||||
if (!defined('NOREQUIREMENU')) {
|
||||
define('NOREQUIREMENU', '1');
|
||||
}
|
||||
if (!defined('NOREQUIREHTML')) {
|
||||
define('NOREQUIREHTML', '1');
|
||||
}
|
||||
if (!defined('NOREQUIREAJAX')) {
|
||||
define('NOREQUIREAJAX', '1');
|
||||
}
|
||||
if (!defined('NOREQUIRESOC')) {
|
||||
define('NOREQUIRESOC', '1');
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define('NOCSRFCHECK', '1');
|
||||
}
|
||||
require '../../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT."/product/stock/class/entrepot.class.php";
|
||||
$warehouse = new Entrepot($db);
|
||||
|
||||
$action = GETPOST("action", "alpha");
|
||||
$barcode = GETPOST("barcode", "aZ09");
|
||||
$product = GETPOST("product");
|
||||
$response = "";
|
||||
|
||||
$fk_entrepot = GETPOST("fk_entrepot", "int");
|
||||
$fk_inventory = GETPOST("fk_inventory", "int");
|
||||
$fk_product = GETPOST("fk_product", "int");
|
||||
$reelqty = GETPOST("reelqty", "int");
|
||||
$batch = GETPOST("batch", "int");
|
||||
$mode = GETPOST("mode", "aZ");
|
||||
|
||||
$warehousefound = 0;
|
||||
$warehouseid = 0;
|
||||
$objectreturn = array();
|
||||
|
||||
if ($action == "existbarcode" && !empty($barcode)) {
|
||||
if (!empty($mode) && $mode == "lotserial") {
|
||||
$sql = "SELECT ps.fk_entrepot, ps.fk_product, p.barcode, ps.reel, pb.batch";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_batch as pb";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."product_stock as ps ON pb.fk_product_stock = ps.rowid JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid";
|
||||
$sql .= " WHERE pb.batch = '".$db->escape($barcode)."'";
|
||||
} else {
|
||||
$sql = "SELECT ps.fk_entrepot, ps.fk_product, p.barcode,ps.reel";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid";
|
||||
$sql .= " WHERE p.barcode = '".$db->escape($barcode)."'";
|
||||
}
|
||||
if (!empty($fk_entrepot)) {
|
||||
$sql .= " AND ps.fk_entrepot = '".$db->escape($fk_entrepot)."'";
|
||||
}
|
||||
if (!empty($fk_product)) {
|
||||
$sql .= " AND ps.fk_product = '".$db->escape($fk_product)."'";
|
||||
}
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$nbline = $db->num_rows($result);
|
||||
for ($i=0; $i < $nbline; $i++) {
|
||||
$object = $db->fetch_object($result);
|
||||
if (($mode == "barcode" && $barcode == $object->barcode) || ($mode == "lotserial" && $barcode == $object->batch)) {
|
||||
$warehouse->fetch(0, $product["Warehouse"]);
|
||||
if (!empty($object->fk_entrepot) && $warehouse->id == $object->fk_entrepot) {
|
||||
$warehousefound++;
|
||||
$warehouseid = $object->fk_entrepot;
|
||||
$fk_product = $object->fk_product;
|
||||
$reelqty = $object->reel;
|
||||
|
||||
$objectreturn = array('fk_warehouse'=>$warehouseid,'fk_product'=>$fk_product,'reelqty'=>$reelqty);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($warehousefound < 1) {
|
||||
$response = array('status'=>'error','errorcode'=>'NotFound','message'=>'No warehouse found for barcode'.$barcode);
|
||||
} elseif ($warehousefound > 1) {
|
||||
$response = array('status'=>'error','errorcode'=>'TooManyWarehouse','message'=>'Too many warehouse found');
|
||||
} else {
|
||||
$response = array('status'=>'success','message'=>'Warehouse found','object'=>$objectreturn);
|
||||
}
|
||||
} else {
|
||||
$response = array('status'=>'error','errorcode'=>'NotFound','message'=>"No results found for barcode");
|
||||
}
|
||||
} else {
|
||||
$response = array('status'=>'error','errorcode'=>'ActionError','message'=>"Error on action");
|
||||
}
|
||||
|
||||
if ($action == "addnewlineproduct") {
|
||||
require_once DOL_DOCUMENT_ROOT."/product/inventory/class/inventory.class.php";
|
||||
$inventoryline = new InventoryLine($db);
|
||||
if (!empty($fk_inventory)) {
|
||||
$inventoryline->fk_inventory = $fk_inventory;
|
||||
|
||||
$inventoryline->fk_warehouse = $fk_entrepot;
|
||||
$inventoryline->fk_product = $fk_product;
|
||||
$inventoryline->qty_stock = $reelqty;
|
||||
if (!empty($batch)) {
|
||||
$inventoryline->batch = $batch;
|
||||
}
|
||||
$inventoryline->datec = dol_now();
|
||||
|
||||
$result = $inventoryline->create($user);
|
||||
if ($result > 0) {
|
||||
$response = array('status'=>'success','message'=>'Success on creating line','id_line'=>$result);
|
||||
} else {
|
||||
$response = array('status'=>'error','errorcode'=>'ErrorCreation','message'=>"Error on line creation");
|
||||
}
|
||||
} else {
|
||||
$response = array('status'=>'error','errorcode'=>'NoIdForInventory','message'=>"No id for inventory");
|
||||
}
|
||||
}
|
||||
|
||||
$response = json_encode($response);
|
||||
echo $response;
|
||||
@ -26,6 +26,7 @@
|
||||
|
||||
// Put here all includes required by your class file
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
|
||||
|
||||
@ -452,7 +452,7 @@ if ($object->id > 0) {
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
||||
print '<form name="formrecord" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<form id="formrecord" name="formrecord" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="updateinventorylines">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
@ -541,14 +541,18 @@ if ($object->id > 0) {
|
||||
if ($action == 'updatebyscaning') {
|
||||
if ($permissiontoadd) {
|
||||
print '<script>';
|
||||
print 'function barcodescannerjs(){
|
||||
|
||||
print '
|
||||
var errortab = [];
|
||||
function barcodescannerjs(){
|
||||
console.log("We catch inputs in sacnner box");
|
||||
var selectaddorreplace = $("select[name=selectaddorreplace]").val();
|
||||
var barcodemode = $("input[name=barcodemode]:checked").val();
|
||||
var barcodeproductqty = $("input[name=barcodeproductqty]").val();
|
||||
var textarea = $("textarea[name=barcodelist]").val();
|
||||
var textarray = textarea.split("\n");
|
||||
var tabproduct = [];
|
||||
if(textarray[0] != ""){
|
||||
var tabproduct = [];
|
||||
$(".expectedqty").each(function(){
|
||||
id = this.id;
|
||||
warehouse = $("#"+id+"_warehouse").children().first().text();
|
||||
@ -560,81 +564,147 @@ if ($object->id > 0) {
|
||||
productbatchcode = $("#"+id+"_batch").text();
|
||||
if(barcodemode != "barcodeforproduct"){
|
||||
tabproduct.forEach(product=>{
|
||||
if(product.Batch == productbatchcode){
|
||||
alert("'.$langs->trans('ErrorSameBatchNumber').': "+productbatchcode);
|
||||
throw"'.$langs->trans('ErrorSameBatchNumber').': "+productbatchcode;
|
||||
if(product.Batch != "" && product.Batch == productbatchcode){
|
||||
alert("'.$langs->transnoentities('ErrorSameBatchNumber').': "+productbatchcode);
|
||||
throw"'.$langs->transnoentities('ErrorSameBatchNumber').': "+productbatchcode;
|
||||
}
|
||||
})
|
||||
}
|
||||
tabproduct.push({\'Id\':id,\'Warehouse\':warehouse,\'Barcode\':productbarcode,\'Batch\':productbatchcode,\'Qty\':0});
|
||||
productinput = $("#"+id+"_input").val();
|
||||
if(productinput == ""){
|
||||
productinput = 0
|
||||
}
|
||||
tabproduct.push({\'Id\':id,\'Warehouse\':warehouse,\'Barcode\':productbarcode,\'Batch\':productbatchcode,\'Qty\':productinput,\'fetched\':false});
|
||||
})
|
||||
switch(barcodemode){
|
||||
case "barcodeforautodetect":
|
||||
textarray.forEach(function(element,index){
|
||||
console.log("Product autodetect "+(index+=1)+": "+element);
|
||||
BatchCodeDoesNotExist=0;
|
||||
tabproduct.forEach(product => {
|
||||
if(product.Batch == element || product.Barcode == element){
|
||||
product.Qty+=1;
|
||||
}else{
|
||||
BatchCodeDoesNotExist+=1;
|
||||
}
|
||||
})
|
||||
if(BatchCodeDoesNotExist >= tabproduct.length){
|
||||
alert("'.$langs->trans('ProductDoesNotExist').': "+element);
|
||||
textarray.forEach(function(element,index){
|
||||
var verify_batch = false;
|
||||
var verify_barcode = false;
|
||||
switch(barcodemode){
|
||||
case "barcodeforautodetect":
|
||||
verify_barcode = barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,selectaddorreplace,"barcode",true);
|
||||
verify_batch = barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,selectaddorreplace,"lotserial",true);
|
||||
break;
|
||||
case "barcodeforproduct":
|
||||
barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,selectaddorreplace,"barcode");
|
||||
break;
|
||||
case "barcodeforlotserial":
|
||||
barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,selectaddorreplace,"lotserial");
|
||||
break;
|
||||
default:
|
||||
alert("'.$langs->trans("ErrorWrongBarcodemode").' \""+barcodemode+"\"");
|
||||
throw "'.$langs->trans('ErrorWrongBarcodemode').' \""+barcodemode+"\"";
|
||||
}
|
||||
if(verify_batch == true && verify_barcode == true){
|
||||
errortab.push(element);
|
||||
}
|
||||
});
|
||||
if (Object.keys(errortab).length < 1){
|
||||
tabproduct.forEach(product => {
|
||||
if(product.Qty!=0){
|
||||
console.log("We change #"+product.Id+"_input to match input in scanner box");
|
||||
if(product.hasOwnProperty("reelqty")){
|
||||
$.ajax({ url: \''.DOL_URL_ROOT.'/product/inventory/ajax/searchfrombarcode.php\',
|
||||
data: { "action":"addnewlineproduct","fk_entrepot":product.Warehouse,"batch":product.Batch,"fk_inventory":'.dol_escape_js($object->id).',"fk_product":product.fk_product,"reelqty":product.reelqty},
|
||||
type: \'POST\',
|
||||
async: false,
|
||||
success: function(response) {
|
||||
response = JSON.parse(response);
|
||||
if(response.status == "success"){
|
||||
console.log(response.message);
|
||||
$("<input type=\'text\' value=\'"+product.Qty+"\' />")
|
||||
.attr("id", "id_"+response.id_line+"_input")
|
||||
.attr("name", "id_"+response.id_line)
|
||||
.appendTo("#formrecord");
|
||||
}else{
|
||||
console.error(response.message);
|
||||
}
|
||||
},
|
||||
error : function(output) {
|
||||
console.error("Error on line creation function");
|
||||
},
|
||||
});
|
||||
} else {
|
||||
$("#"+product.Id+"_input").val(product.Qty);
|
||||
}
|
||||
})
|
||||
break;
|
||||
case "barcodeforproduct":
|
||||
textarray.forEach(function(element,index){
|
||||
console.log("Product "+(index+=1)+": "+element);
|
||||
BarCodeDoesNotExist=0;
|
||||
tabproduct.forEach(product => {
|
||||
if(product.Barcode == element){
|
||||
product.Qty+=1;
|
||||
}else{
|
||||
BarCodeDoesNotExist+=1;
|
||||
}
|
||||
})
|
||||
if(BarCodeDoesNotExist >= tabproduct.length){
|
||||
alert("'.$langs->trans('ProductBarcodeDoesNotExist').': "+element);
|
||||
}
|
||||
})
|
||||
break;
|
||||
case "barcodeforlotserial":
|
||||
textarray.forEach(function(element,index){
|
||||
console.log("Product batch/serial "+(index+=1)+": "+element);
|
||||
BatchCodeDoesNotExist=0;
|
||||
tabproduct.forEach(product => {
|
||||
if(product.Batch == element){
|
||||
product.Qty+=1;
|
||||
}else{
|
||||
BatchCodeDoesNotExist+=1;
|
||||
}
|
||||
})
|
||||
if(BatchCodeDoesNotExist >= tabproduct.length){
|
||||
alert("'.$langs->trans('ProductBatchDoesNotExist').': "+element);
|
||||
}
|
||||
})
|
||||
break;
|
||||
default:
|
||||
alert("'.$langs->trans("ErrorWrongBarcodemode").' \""+barcodemode+"\"");
|
||||
throw"'.$langs->trans('ErrorWrongBarcodemode').' \""+barcodemode+"\"";
|
||||
}
|
||||
})
|
||||
document.forms["formrecord"].submit();
|
||||
}else{
|
||||
let stringerror = "";
|
||||
errortab.forEach(element => {
|
||||
stringerror += (element + ",")
|
||||
});
|
||||
stringerror = stringerror.slice(0, -1);
|
||||
alert("'.$langs->trans("ErrorOnElementsInventory").' :\n" + stringerror);
|
||||
}
|
||||
tabproduct.forEach(product => {
|
||||
if(product.Qty!=0){
|
||||
console.log("We change #"+product.Id+"_input to match input in scanner box");
|
||||
$("#"+product.Id+"_input").val(product.Qty*barcodeproductqty);
|
||||
}
|
||||
})
|
||||
document.forms["formrecord"].submit();
|
||||
}
|
||||
}';
|
||||
|
||||
}
|
||||
|
||||
function barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,selectaddorreplace,mode,autodetect=false){
|
||||
BarcodeIsInProduct=0;
|
||||
newproductrow=0
|
||||
result=false;
|
||||
tabproduct.forEach(product => {
|
||||
$.ajax({ url: \''.DOL_URL_ROOT.'/product/inventory/ajax/searchfrombarcode.php\',
|
||||
data: { "action":"existbarcode",'.(!empty($object->fk_warehouse)?'"fk_entrepot":'.$object->fk_warehouse.',':'').(!empty($object->fk_product)?'"fk_product":'.$object->fk_product.',':'').'"barcode":element,"product":product,"mode":mode},
|
||||
type: \'POST\',
|
||||
async: false,
|
||||
success: function(response) {
|
||||
response = JSON.parse(response);
|
||||
if(response.status == "success"){
|
||||
console.log(response.message);
|
||||
if(!newproductrow){
|
||||
newproductrow = response.object;
|
||||
}
|
||||
}else{
|
||||
if (mode!="lotserial" && autodetect==false && !errortab.includes(element)){
|
||||
errortab.push(element);
|
||||
console.error(response.message);
|
||||
}
|
||||
}
|
||||
},
|
||||
error : function(output) {
|
||||
console.error("Error on barcodeserialforproduct function");
|
||||
},
|
||||
});
|
||||
console.log("Product "+(index+=1)+": "+element);
|
||||
if(mode == "barcode"){
|
||||
testonproduct = product.Barcode
|
||||
}else if (mode == "lotserial"){
|
||||
testonproduct = product.Batch
|
||||
}
|
||||
if(testonproduct == element){
|
||||
if(selectaddorreplace == "add"){
|
||||
productqty = parseInt(product.Qty,10);
|
||||
product.Qty = productqty + parseInt(barcodeproductqty,10);
|
||||
}else if(selectaddorreplace == "replace"){
|
||||
if(product.fetched == false){
|
||||
product.Qty = barcodeproductqty
|
||||
product.fetched=true
|
||||
}else{
|
||||
productqty = parseInt(product.Qty,10);
|
||||
product.Qty = productqty + parseInt(barcodeproductqty,10);
|
||||
}
|
||||
}
|
||||
BarcodeIsInProduct+=1;
|
||||
}
|
||||
})
|
||||
if(BarcodeIsInProduct==0 && newproductrow!=0){
|
||||
tabproduct.push({\'Id\':tabproduct.length-1,\'Warehouse\':newproductrow.fk_warehouse,\'Barcode\':mode=="barcode"?element:null,\'Batch\':mode=="lotserial"?element:null,\'Qty\':barcodeproductqty,\'fetched\':true,\'reelqty\':newproductrow.reelqty,\'fk_product\':newproductrow.fk_product,\'mode\':mode});
|
||||
result = true;
|
||||
}
|
||||
if(BarcodeIsInProduct > 0){
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
';
|
||||
print '</script>';
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
$formother = new FormOther($db);
|
||||
print $formother->getHTMLScannerForm();
|
||||
print $formother->getHTMLScannerForm("barcodescannerjs");
|
||||
}
|
||||
|
||||
//Call method to undo changes in real qty
|
||||
|
||||
@ -298,7 +298,7 @@ if (!in_array($nowyear, $arrayyears)) {
|
||||
$arrayyears[$nowyear] = $nowyear;
|
||||
}
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0, 0, 0, '', 0, 0, 0, '', 'width75');
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="center" colspan="2"><input type="submit" name="submit" class="button small" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
|
||||
@ -168,7 +168,7 @@ if (!in_array($nowyear, $arrayyears)) {
|
||||
$arrayyears[$nowyear] = $nowyear;
|
||||
}
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0, 0, 0, '', 0, 0, 0, '', 'width75');
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="center" colspan="2"><input type="submit" name="submit" class="button small" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
|
||||
@ -233,7 +233,7 @@ if (!in_array($nowyear, $arrayyears)) {
|
||||
$arrayyears[$nowyear] = $nowyear;
|
||||
}
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0, 0, 0, '', 0, 0, 0, '', 'width75');
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="center" colspan="2"><input type="submit" name="submit" class="button small" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
|
||||
@ -212,7 +212,7 @@ if (!in_array($year, $arrayyears)) {
|
||||
$arrayyears[$year] = $year;
|
||||
}
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0, 0, 0, '', 0, 0, 0, '', 'width75');
|
||||
print '</td></tr>';
|
||||
print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button small" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
|
||||
@ -125,15 +125,17 @@ if (GETPOST('newcompany') || GETPOST('socid', 'int') || GETPOST('id_fourn', 'int
|
||||
if ($resql) {
|
||||
while ($row = $db->fetch_array($resql)) {
|
||||
$label = '';
|
||||
if ($conf->global->SOCIETE_ADD_REF_IN_LIST) {
|
||||
if (! empty($conf->global->SOCIETE_ADD_REF_IN_LIST)) {
|
||||
if (($row['client']) && (!empty($row['code_client']))) {
|
||||
$label = $row['code_client'].' - ';
|
||||
}
|
||||
if (($row['fournisseur']) && (!empty($row['code_fournisseur']))) {
|
||||
$label .= $row['code_fournisseur'].' - ';
|
||||
}
|
||||
$label .= ' '.$row['name'];
|
||||
}
|
||||
|
||||
$label .= $row['nom'];
|
||||
|
||||
if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) {
|
||||
$label .= ($row['address'] ? ' - '.$row['address'] : '').($row['zip'] ? ' - '.$row['zip'] : '').($row['town'] ? ' '.$row['town'] : '');
|
||||
if (!empty($row['country_code'])) {
|
||||
|
||||
@ -3607,7 +3607,7 @@ div.refidno {
|
||||
font-weight: normal;
|
||||
color: var(--refidnocolor);
|
||||
font-size: <?php print is_numeric($fontsize) ? $fontsize.'px' : $fontsize ?>;
|
||||
line-height: 21px;
|
||||
line-height: 1.4em;
|
||||
}
|
||||
div.refidno form {
|
||||
display: inline-block;
|
||||
|
||||
@ -243,7 +243,7 @@ if (!in_array($nowyear, $arrayyears)) {
|
||||
$arrayyears[$nowyear] = $nowyear;
|
||||
}
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0, 0, 0, '', 0, 0, 0, '', 'width75');
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="center" colspan="2"><input type="submit" name="submit" class="button small" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user