prepare new rule
This commit is contained in:
parent
6522bb70fd
commit
174ddc5fd4
@ -52,8 +52,7 @@ $type = 'propal';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
$error = 0;
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
if ($action == 'updateMask') {
|
||||
$maskconstpropal = GETPOST('maskconstpropal', 'alpha');
|
||||
$maskpropal = GETPOST('maskpropal', 'alpha');
|
||||
if ($maskconstpropal) $res = dolibarr_set_const($db, $maskconstpropal, $maskpropal, 'chaine', 0, '', $conf->entity);
|
||||
@ -66,8 +65,7 @@ if ($action == 'updateMask')
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
} elseif ($action == 'specimen')
|
||||
{
|
||||
} elseif ($action == 'specimen') {
|
||||
$modele = GETPOST('module', 'alpha');
|
||||
|
||||
$propal = new Propal($db);
|
||||
@ -87,8 +85,7 @@ if ($action == 'updateMask')
|
||||
}
|
||||
}
|
||||
|
||||
if ($filefound)
|
||||
{
|
||||
if ($filefound) {
|
||||
require_once $file;
|
||||
|
||||
$module = new $classname($db);
|
||||
@ -105,8 +102,7 @@ if ($action == 'updateMask')
|
||||
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
|
||||
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||
}
|
||||
} elseif ($action == 'setribchq')
|
||||
{
|
||||
} elseif ($action == 'setribchq') {
|
||||
$rib = GETPOST('rib', 'alpha');
|
||||
$chq = GETPOST('chq', 'alpha');
|
||||
|
||||
@ -121,8 +117,7 @@ if ($action == 'updateMask')
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
} elseif ($action == 'set_PROPALE_DRAFT_WATERMARK')
|
||||
{
|
||||
} elseif ($action == 'set_PROPALE_DRAFT_WATERMARK') {
|
||||
$draft = GETPOST('PROPALE_DRAFT_WATERMARK', 'alpha');
|
||||
|
||||
$res = dolibarr_set_const($db, "PROPALE_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
|
||||
@ -134,8 +129,7 @@ if ($action == 'updateMask')
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
} elseif ($action == 'set_PROPOSAL_FREE_TEXT')
|
||||
{
|
||||
} elseif ($action == 'set_PROPOSAL_FREE_TEXT') {
|
||||
$freetext = GETPOST('PROPOSAL_FREE_TEXT', 'none'); // No alpha here, we want exact string
|
||||
|
||||
$res = dolibarr_set_const($db, "PROPOSAL_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
|
||||
@ -148,8 +142,7 @@ if ($action == 'updateMask')
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
} elseif ($action == 'setdefaultduration')
|
||||
{
|
||||
} elseif ($action == 'setdefaultduration') {
|
||||
$res = dolibarr_set_const($db, "PROPALE_VALIDITY_DURATION", $value, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (!$res > 0) $error++;
|
||||
@ -160,45 +153,35 @@ if ($action == 'updateMask')
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
} elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL')
|
||||
{
|
||||
} elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL') {
|
||||
$res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL", $value, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
// Activate a model
|
||||
elseif ($action == 'set')
|
||||
{
|
||||
} elseif ($action == 'set') {
|
||||
// Activate a model
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
} elseif ($action == 'del')
|
||||
{
|
||||
} elseif ($action == 'del') {
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($ret > 0) {
|
||||
if ($conf->global->PROPALE_ADDON_PDF == "$value") dolibarr_del_const($db, 'PROPALE_ADDON_PDF', $conf->entity);
|
||||
}
|
||||
} elseif ($action == 'setdoc')
|
||||
{
|
||||
if (dolibarr_set_const($db, "PROPALE_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity))
|
||||
{
|
||||
} elseif ($action == 'setdoc') {
|
||||
if (dolibarr_set_const($db, "PROPALE_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) {
|
||||
$conf->global->PROPALE_ADDON_PDF = $value;
|
||||
}
|
||||
|
||||
// On active le modele
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($ret > 0) {
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
} elseif ($action == 'setmod')
|
||||
{
|
||||
} elseif ($action == 'setmod') {
|
||||
// TODO Verifier si module numerotation choisi peut etre active
|
||||
// par appel methode canBeActivated
|
||||
|
||||
|
||||
@ -1995,8 +1995,7 @@ class ActionComm extends CommonObject
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
|
||||
@ -1137,8 +1137,7 @@ if (empty($action) || $action == 'show_month') // View by month
|
||||
echo ' <td class="'.$style.' nowrap" width="14%" valign="top">';
|
||||
show_day_events($db, $max_day_in_prev_month + $tmpday, $prev_month, $prev_year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam);
|
||||
echo " </td>\n";
|
||||
}
|
||||
/* Show days of the current month */
|
||||
} /* Show days of the current month */
|
||||
elseif ($tmpday <= $max_day_in_month)
|
||||
{
|
||||
$curtime = dol_mktime(0, 0, 0, $month, $tmpday, $year);
|
||||
@ -1152,8 +1151,7 @@ if (empty($action) || $action == 'show_month') // View by month
|
||||
echo ' <td class="'.$style.' nowrap" width="14%" valign="top">';
|
||||
show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam);
|
||||
echo " </td>\n";
|
||||
}
|
||||
/* Show days after the current month (next month) */
|
||||
} /* Show days after the current month (next month) */
|
||||
else {
|
||||
$style = 'cal_other_month';
|
||||
if ($iter_day == 6) $style .= ' cal_other_month_right';
|
||||
|
||||
@ -700,8 +700,7 @@ while ($currentdaytoshow < $lastdaytoshow) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Use this list to have for all users */
|
||||
} /* Use this list to have for all users */
|
||||
else {
|
||||
$sql = "SELECT u.rowid, u.lastname as lastname, u.firstname, u.statut, u.login, u.admin, u.entity";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
|
||||
@ -764,13 +764,11 @@ if ($action == 'create')
|
||||
if ($action == 'valid')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("ValidMailing"), $langs->trans("ConfirmValidMailing"), "confirm_valid", '', '', 1);
|
||||
}
|
||||
// Confirm reset
|
||||
} // Confirm reset
|
||||
elseif ($action == 'reset')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("ResetMailing"), $langs->trans("ConfirmResetMailing", $object->ref), "confirm_reset", '', '', 2);
|
||||
}
|
||||
// Confirm delete
|
||||
} // Confirm delete
|
||||
elseif ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id.(!empty($urlfrom) ? '&urlfrom='.urlencode($urlfrom) : ''), $langs->trans("DeleteAMailing"), $langs->trans("ConfirmDeleteMailing"), "confirm_delete", '', '', 1);
|
||||
|
||||
@ -202,9 +202,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Delete proposal
|
||||
} // Delete proposal
|
||||
elseif ($action == 'confirm_delete' && $confirm == 'yes' && $usercandelete)
|
||||
{
|
||||
$result = $object->delete($user);
|
||||
@ -215,9 +213,7 @@ if (empty($reshook))
|
||||
$langs->load("errors");
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Remove line
|
||||
} // Remove line
|
||||
elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate)
|
||||
{
|
||||
$result = $object->deleteline($lineid);
|
||||
@ -239,9 +235,7 @@ if (empty($reshook))
|
||||
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||
exit();
|
||||
}
|
||||
|
||||
// Validation
|
||||
} // Validation
|
||||
elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate)
|
||||
{
|
||||
$result = $object->valid($user);
|
||||
@ -291,9 +285,7 @@ if (empty($reshook))
|
||||
$result = $object->set_date_livraison($user, dol_mktime(12, 0, 0, $_POST['date_livraisonmonth'], $_POST['date_livraisonday'], $_POST['date_livraisonyear']));
|
||||
if ($result < 0)
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
// Positionne ref client
|
||||
} // Positionne ref client
|
||||
elseif ($action == 'setref_client' && $usercancreate)
|
||||
{
|
||||
$result = $object->set_ref_client($user, GETPOST('ref_client'));
|
||||
@ -301,15 +293,11 @@ if (empty($reshook))
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Set incoterm
|
||||
} // Set incoterm
|
||||
elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled) && $usercancreate)
|
||||
{
|
||||
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
||||
}
|
||||
|
||||
// Create proposal
|
||||
} // Create proposal
|
||||
elseif ($action == 'add' && $usercancreate)
|
||||
{
|
||||
$object->socid = $socid;
|
||||
@ -543,7 +531,7 @@ if (empty($reshook))
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
} // Standard creation
|
||||
} // Standard creation
|
||||
else {
|
||||
$id = $object->create($user);
|
||||
}
|
||||
@ -606,9 +594,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Classify billed
|
||||
} // Classify billed
|
||||
elseif ($action == 'classifybilled' && $usercanclose)
|
||||
{
|
||||
$db->begin();
|
||||
@ -626,9 +612,7 @@ if (empty($reshook))
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
// Close proposal
|
||||
} // Close proposal
|
||||
elseif ($action == 'setstatut' && $usercanclose && !GETPOST('cancel', 'alpha')) {
|
||||
if (!(GETPOST('statut', 'int') > 0)) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CloseAs")), null, 'errors');
|
||||
@ -654,9 +638,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reopen proposal
|
||||
} // Reopen proposal
|
||||
elseif ($action == 'confirm_reopen' && $usercanclose && !GETPOST('cancel', 'alpha')) {
|
||||
// prevent browser refresh from reopening proposal several times
|
||||
if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED)
|
||||
@ -677,9 +659,7 @@ if (empty($reshook))
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add lines from objectlinked
|
||||
} // add lines from objectlinked
|
||||
elseif ($action == 'import_lines_from_object'
|
||||
&& $user->rights->propal->creer
|
||||
&& $object->statut == Propal::STATUS_DRAFT
|
||||
@ -795,9 +775,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add line
|
||||
} // Add line
|
||||
elseif ($action == 'addline' && $usercancreate) {
|
||||
// Set if we used free entry or predefined product
|
||||
$predef = '';
|
||||
@ -901,8 +879,7 @@ if (empty($reshook))
|
||||
if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx = $prod->multiprices_tva_tx[$object->thirdparty->price_level];
|
||||
if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr = $prod->multiprices_recuperableonly[$object->thirdparty->price_level];
|
||||
}
|
||||
}
|
||||
// If price per customer
|
||||
} // If price per customer
|
||||
elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php';
|
||||
@ -924,8 +901,7 @@ if (empty($reshook))
|
||||
if (empty($tva_tx)) $tva_npr = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
// If price per quantity
|
||||
} // If price per quantity
|
||||
elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY))
|
||||
{
|
||||
if ($prod->prices_by_qty[0]) // yes, this product has some prices per quantity
|
||||
@ -948,8 +924,7 @@ if (empty($reshook))
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// If price per quantity and customer
|
||||
} // If price per quantity and customer
|
||||
elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))
|
||||
{
|
||||
if ($prod->prices_by_qty[$object->thirdparty->price_level]) // yes, this product has some prices per quantity
|
||||
@ -981,8 +956,7 @@ if (empty($reshook))
|
||||
if (!empty($price_ht)) {
|
||||
$pu_ht = price2num($price_ht, 'MU');
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||
}
|
||||
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||
} // On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
||||
elseif ($tmpvat != $tmpprodvat) {
|
||||
if ($price_base_type != 'HT') {
|
||||
@ -1153,9 +1127,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update a line within proposal
|
||||
} // Update a line within proposal
|
||||
elseif ($action == 'updateline' && $usercancreate && GETPOST('save'))
|
||||
{
|
||||
// Define info_bits
|
||||
@ -1295,48 +1267,32 @@ if (empty($reshook))
|
||||
} elseif ($action == 'classin' && $usercancreate) {
|
||||
// Set project
|
||||
$object->setProject(GETPOST('projectid', 'int'));
|
||||
}
|
||||
|
||||
// Delivery time
|
||||
} // Delivery time
|
||||
elseif ($action == 'setavailability' && $usercancreate) {
|
||||
$result = $object->set_availability($user, GETPOST('availability_id', 'int'));
|
||||
}
|
||||
|
||||
// Origin of the commercial proposal
|
||||
} // Origin of the commercial proposal
|
||||
elseif ($action == 'setdemandreason' && $usercancreate) {
|
||||
$result = $object->set_demand_reason($user, GETPOST('demand_reason_id', 'int'));
|
||||
}
|
||||
|
||||
// Terms of payment
|
||||
} // Terms of payment
|
||||
elseif ($action == 'setconditions' && $usercancreate) {
|
||||
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
|
||||
} elseif ($action == 'setremisepercent' && $usercancreate) {
|
||||
$result = $object->set_remise_percent($user, $_POST['remise_percent']);
|
||||
} elseif ($action == 'setremiseabsolue' && $usercancreate) {
|
||||
$result = $object->set_remise_absolue($user, $_POST['remise_absolue']);
|
||||
}
|
||||
|
||||
// Payment choice
|
||||
} // Payment choice
|
||||
elseif ($action == 'setmode' && $usercancreate) {
|
||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
||||
}
|
||||
|
||||
// Multicurrency Code
|
||||
} // Multicurrency Code
|
||||
elseif ($action == 'setmulticurrencycode' && $usercancreate) {
|
||||
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
|
||||
}
|
||||
|
||||
// Multicurrency rate
|
||||
} // Multicurrency rate
|
||||
elseif ($action == 'setmulticurrencyrate' && $usercancreate) {
|
||||
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')));
|
||||
}
|
||||
|
||||
// bank account
|
||||
} // bank account
|
||||
elseif ($action == 'setbankaccount' && $usercancreate) {
|
||||
$result = $object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
}
|
||||
|
||||
// shipping method
|
||||
} // shipping method
|
||||
elseif ($action == 'setshippingmethod' && $usercancreate) {
|
||||
$result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
|
||||
} elseif ($action == 'update_extras') {
|
||||
@ -1377,18 +1333,14 @@ if (empty($reshook))
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Toggle the status of a contact
|
||||
} // Toggle the status of a contact
|
||||
elseif ($action == 'swapstatut') {
|
||||
if ($object->fetch($id) > 0) {
|
||||
$result = $object->swapContactStatus(GETPOST('ligne'));
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Delete a contact
|
||||
} // Delete a contact
|
||||
elseif ($action == 'deletecontact') {
|
||||
$object->fetch($id);
|
||||
$result = $object->delete_contact($lineid);
|
||||
@ -1871,24 +1823,16 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetAcceptedRefused'), $text, 'setstatut', $formquestion, '', 1, 250);
|
||||
}
|
||||
|
||||
// Confirm delete
|
||||
} // Confirm delete
|
||||
elseif ($action == 'delete') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp', $object->ref), 'confirm_delete', '', 0, 1);
|
||||
}
|
||||
|
||||
// Confirm reopen
|
||||
} // Confirm reopen
|
||||
elseif ($action == 'reopen') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenProp', $object->ref), 'confirm_reopen', '', 0, 1);
|
||||
}
|
||||
|
||||
// Confirmation delete product/service line
|
||||
} // Confirmation delete product/service line
|
||||
elseif ($action == 'ask_deleteline') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1);
|
||||
}
|
||||
|
||||
// Confirm validate proposal
|
||||
} // Confirm validate proposal
|
||||
elseif ($action == 'validate') {
|
||||
$error = 0;
|
||||
|
||||
|
||||
@ -2823,8 +2823,7 @@ class Propal extends CommonObject
|
||||
if ($objecttype == 'facture')
|
||||
{
|
||||
$linkedInvoices[] = $object;
|
||||
}
|
||||
// Cas des factures liees par un autre objet (ex: commande)
|
||||
} // Cas des factures liees par un autre objet (ex: commande)
|
||||
else {
|
||||
$this->fetchObjectLinked($object, $objecttype);
|
||||
foreach ($this->linkedObjectsIds as $subobjecttype => $subobjectid)
|
||||
|
||||
@ -95,18 +95,14 @@ if ($action == 'addcontact' && $user->rights->propale->creer)
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Toggle the status of a contact
|
||||
} // Toggle the status of a contact
|
||||
elseif ($action == 'swapstatut' && $user->rights->propale->creer)
|
||||
{
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$result = $object->swapContactStatus(GETPOST('ligne'));
|
||||
}
|
||||
}
|
||||
|
||||
// Deletes a contact
|
||||
} // Deletes a contact
|
||||
elseif ($action == 'deletecontact' && $user->rights->propale->creer)
|
||||
{
|
||||
$result = $object->delete_contact($lineid);
|
||||
|
||||
@ -1020,8 +1020,7 @@ if ($resql)
|
||||
if ($sortfield == 'b.datev,b.dateo,b.rowid' && $sortorder == 'desc,desc,desc')
|
||||
{
|
||||
$balancebefore = $objforbalance->previoustotal + ($sign * $objp->amount);
|
||||
}
|
||||
// If sort is asc,asc,asc then total of previous date is balance of line before the next line to show
|
||||
} // If sort is asc,asc,asc then total of previous date is balance of line before the next line to show
|
||||
else {
|
||||
$balance = $objforbalance->previoustotal;
|
||||
}
|
||||
|
||||
@ -553,8 +553,7 @@ if ($action == 'create')
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
/* ************************************************************************** */
|
||||
} /* ************************************************************************** */
|
||||
/* */
|
||||
/* Visu et edition */
|
||||
/* */
|
||||
|
||||
@ -148,9 +148,7 @@ if ($action == 'validate' && $user->rights->deplacement->creer)
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Update record
|
||||
} // Update record
|
||||
elseif ($action == 'update' && $user->rights->deplacement->creer)
|
||||
{
|
||||
if (!GETPOST('cancel', 'alpha'))
|
||||
@ -178,17 +176,13 @@ elseif ($action == 'update' && $user->rights->deplacement->creer)
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Set into a project
|
||||
} // Set into a project
|
||||
elseif ($action == 'classin' && $user->rights->deplacement->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->setProject(GETPOST('projectid', 'int'));
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
// Set fields
|
||||
} // Set fields
|
||||
elseif ($action == 'setdated' && $user->rights->deplacement->creer)
|
||||
{
|
||||
$dated = dol_mktime(GETPOST('datedhour', 'int'), GETPOST('datedmin', 'int'), GETPOST('datedsec', 'int'), GETPOST('datedmonth', 'int'), GETPOST('datedday', 'int'), GETPOST('datedyear', 'int'));
|
||||
|
||||
@ -275,18 +275,15 @@ if (empty($reshook))
|
||||
if ($action == 'setconditions' && $user->rights->facture->creer)
|
||||
{
|
||||
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
|
||||
}
|
||||
// Set mode
|
||||
} // Set mode
|
||||
elseif ($action == 'setmode' && $user->rights->facture->creer)
|
||||
{
|
||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
||||
}
|
||||
// Set project
|
||||
} // Set project
|
||||
elseif ($action == 'classin' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->setProject(GETPOST('projectid', 'int'));
|
||||
}
|
||||
// Set bank account
|
||||
} // Set bank account
|
||||
elseif ($action == 'setref' && $user->rights->facture->creer)
|
||||
{
|
||||
//var_dump(GETPOST('ref', 'alpha'));exit;
|
||||
@ -297,45 +294,36 @@ if (empty($reshook))
|
||||
$object->title = GETPOST('ref', 'alpha');
|
||||
$object->ref = $object->title;
|
||||
} else dol_print_error($db, $object->error, $object->errors);
|
||||
}
|
||||
// Set bank account
|
||||
} // Set bank account
|
||||
elseif ($action == 'setbankaccount' && $user->rights->facture->creer)
|
||||
{
|
||||
$result = $object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
}
|
||||
// Set frequency and unit frequency
|
||||
} // Set frequency and unit frequency
|
||||
elseif ($action == 'setfrequency' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->setFrequencyAndUnit(GETPOST('frequency', 'int'), GETPOST('unit_frequency', 'alpha'));
|
||||
}
|
||||
// Set next date of execution
|
||||
} // Set next date of execution
|
||||
elseif ($action == 'setdate_when' && $user->rights->facture->creer)
|
||||
{
|
||||
$date = dol_mktime(GETPOST('date_whenhour'), GETPOST('date_whenmin'), 0, GETPOST('date_whenmonth'), GETPOST('date_whenday'), GETPOST('date_whenyear'));
|
||||
if (!empty($date)) $object->setNextDate($date);
|
||||
}
|
||||
// Set max period
|
||||
} // Set max period
|
||||
elseif ($action == 'setnb_gen_max' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->setMaxPeriod(GETPOST('nb_gen_max', 'int'));
|
||||
}
|
||||
// Set auto validate
|
||||
} // Set auto validate
|
||||
elseif ($action == 'setauto_validate' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->setAutoValidate(GETPOST('auto_validate', 'int'));
|
||||
}
|
||||
// Set generate pdf
|
||||
} // Set generate pdf
|
||||
elseif ($action == 'setgenerate_pdf' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->setGeneratepdf(GETPOST('generate_pdf', 'int'));
|
||||
}
|
||||
// Set model pdf
|
||||
} // Set model pdf
|
||||
elseif ($action == 'setmodelpdf' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->setModelpdf(GETPOST('modelpdf', 'alpha'));
|
||||
}
|
||||
|
||||
// Set status disabled
|
||||
} // Set status disabled
|
||||
elseif ($action == 'disable' && $user->rights->facture->creer)
|
||||
{
|
||||
$db->begin();
|
||||
@ -355,9 +343,7 @@ if (empty($reshook))
|
||||
$db->rollback();
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Set status enabled
|
||||
} // Set status enabled
|
||||
elseif ($action == 'enable' && $user->rights->facture->creer)
|
||||
{
|
||||
$db->begin();
|
||||
@ -377,13 +363,10 @@ if (empty($reshook))
|
||||
$db->rollback();
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
// Multicurrency Code
|
||||
} // Multicurrency Code
|
||||
elseif ($action == 'setmulticurrencycode' && $usercancreate) {
|
||||
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
|
||||
}
|
||||
|
||||
// Multicurrency rate
|
||||
} // Multicurrency rate
|
||||
elseif ($action == 'setmulticurrencyrate' && $usercancreate) {
|
||||
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')), GETPOST('calculation_mode', 'int'));
|
||||
}
|
||||
@ -554,8 +537,7 @@ if (empty($reshook))
|
||||
{
|
||||
$pu_ht = price2num($price_ht, 'MU');
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||
}
|
||||
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||
} // On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
||||
elseif ($tmpvat != $tmpprodvat)
|
||||
{
|
||||
|
||||
@ -188,9 +188,7 @@ if (empty($reshook))
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Change status of invoice
|
||||
} // Change status of invoice
|
||||
elseif ($action == 'reopen' && $usercancreate) {
|
||||
$result = $object->fetch($id);
|
||||
|
||||
@ -203,9 +201,7 @@ if (empty($reshook))
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Delete invoice
|
||||
} // Delete invoice
|
||||
elseif ($action == 'confirm_delete' && $confirm == 'yes') {
|
||||
$result = $object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
@ -233,9 +229,7 @@ if (empty($reshook))
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Delete line
|
||||
} // Delete line
|
||||
elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate)
|
||||
{
|
||||
$object->fetch($id);
|
||||
@ -267,17 +261,13 @@ if (empty($reshook))
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Delete link of credit note to invoice
|
||||
} // Delete link of credit note to invoice
|
||||
elseif ($action == 'unlinkdiscount' && $usercancreate)
|
||||
{
|
||||
$discount = new DiscountAbsolute($db);
|
||||
$result = $discount->fetch(GETPOST("discountid"));
|
||||
$discount->unlink_invoice();
|
||||
}
|
||||
|
||||
// Validation
|
||||
} // Validation
|
||||
elseif ($action == 'valid' && $usercancreate)
|
||||
{
|
||||
$object->fetch($id);
|
||||
@ -377,15 +367,10 @@ if (empty($reshook))
|
||||
$result = $object->setRetainedWarrantyDateLimit(GETPOST('retained_warranty_date_limit', 'float'));
|
||||
if ($result < 0)
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
|
||||
// Multicurrency Code
|
||||
} // Multicurrency Code
|
||||
elseif ($action == 'setmulticurrencycode' && $usercancreate) {
|
||||
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
|
||||
}
|
||||
|
||||
// Multicurrency rate
|
||||
} // Multicurrency rate
|
||||
elseif ($action == 'setmulticurrencyrate' && $usercancreate) {
|
||||
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')), GETPOST('calculation_mode', 'int'));
|
||||
} elseif ($action == 'setinvoicedate' && $usercancreate)
|
||||
@ -472,15 +457,11 @@ if (empty($reshook))
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set incoterm
|
||||
} // Set incoterm
|
||||
elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled))
|
||||
{
|
||||
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
||||
}
|
||||
|
||||
// bank account
|
||||
} // bank account
|
||||
elseif ($action == 'setbankaccount' && $usercancreate)
|
||||
{
|
||||
$result = $object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
@ -552,9 +533,7 @@ if (empty($reshook))
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->set_ref_client(GETPOST('ref_client'));
|
||||
}
|
||||
|
||||
// Classify to validated
|
||||
} // Classify to validated
|
||||
elseif ($action == 'confirm_valid' && $confirm == 'yes' && $usercanvalidate)
|
||||
{
|
||||
$idwarehouse = GETPOST('idwarehouse', 'int');
|
||||
@ -668,9 +647,7 @@ if (empty($reshook))
|
||||
else setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Go back to draft status (unvalidate)
|
||||
} // Go back to draft status (unvalidate)
|
||||
elseif ($action == 'confirm_modif' && $usercanunvalidate)
|
||||
{
|
||||
$idwarehouse = GETPOST('idwarehouse', 'int');
|
||||
@ -751,9 +728,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Classify "paid"
|
||||
} // Classify "paid"
|
||||
elseif ($action == 'confirm_paid' && $confirm == 'yes' && $usercanissuepayment)
|
||||
{
|
||||
$object->fetch($id);
|
||||
@ -782,9 +757,7 @@ if (empty($reshook))
|
||||
} else {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Convertir en reduc
|
||||
} // Convertir en reduc
|
||||
elseif ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $usercancreate)
|
||||
{
|
||||
$object->fetch($id);
|
||||
@ -949,9 +922,7 @@ if (empty($reshook))
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Delete payment
|
||||
} // Delete payment
|
||||
elseif ($action == 'confirm_delete_paiement' && $confirm == 'yes' && $usercancreate)
|
||||
{
|
||||
$object->fetch($id);
|
||||
@ -967,9 +938,7 @@ if (empty($reshook))
|
||||
setEventMessages($paiement->error, $paiement->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
} /*
|
||||
* Insert new invoice in database
|
||||
*/
|
||||
elseif ($action == 'add' && $usercancreate)
|
||||
@ -1853,9 +1822,7 @@ if (empty($reshook))
|
||||
$_GET["originid"] = $_POST["originid"];
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Add a new line
|
||||
} // Add a new line
|
||||
elseif ($action == 'addline' && $usercancreate)
|
||||
{
|
||||
$langs->load('errors');
|
||||
@ -2000,8 +1967,7 @@ if (empty($reshook))
|
||||
{
|
||||
$pu_ht = price2num($price_ht, 'MU');
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||
}
|
||||
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||
} // On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
||||
elseif ($tmpvat != $tmpprodvat)
|
||||
{
|
||||
@ -2398,9 +2364,7 @@ if (empty($reshook))
|
||||
} elseif ($action == 'updateline' && $usercancreate && $_POST['cancel'] == $langs->trans('Cancel')) {
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); // To show again edited page
|
||||
exit();
|
||||
}
|
||||
|
||||
// Outing situation invoice from cycle
|
||||
} // Outing situation invoice from cycle
|
||||
elseif ($action == 'confirm_situationout' && $confirm == 'yes' && $usercancreate)
|
||||
{
|
||||
$object->fetch($id, '', '', '', true);
|
||||
@ -2507,9 +2471,7 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans('ErrorFindNextSituationInvoice'), array(), 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add lines from objectlinked
|
||||
} // add lines from objectlinked
|
||||
elseif ($action == 'import_lines_from_object'
|
||||
&& $usercancreate
|
||||
&& $object->statut == Facture::STATUS_DRAFT
|
||||
@ -2824,14 +2786,12 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// when payment condition is empty (means not override by payment condition form a other object, like third-party), try to use default value
|
||||
if(empty($cond_reglement_id))
|
||||
{
|
||||
if (empty($cond_reglement_id)) {
|
||||
$cond_reglement_id = GETPOST("cond_reglement_id");
|
||||
}
|
||||
|
||||
// when payment mode is empty (means not override by payment mode form a other object, like third-party), try to use default value
|
||||
if(empty($mode_reglement_id))
|
||||
{
|
||||
if (empty($mode_reglement_id)) {
|
||||
$mode_reglement_id = GETPOST("mode_reglement_id");
|
||||
}
|
||||
|
||||
@ -2839,8 +2799,7 @@ if ($action == 'create')
|
||||
$note_public = $object->getDefaultCreateValueFor('note_public', ((!empty($origin) && !empty($originid) && is_object($objectsrc) && !empty($conf->global->FACTURE_REUSE_NOTES_ON_CREATE_FROM)) ? $objectsrc->note_public : null));
|
||||
$note_private = $object->getDefaultCreateValueFor('note_private', ((!empty($origin) && !empty($originid) && is_object($objectsrc) && !empty($conf->global->FACTURE_REUSE_NOTES_ON_CREATE_FROM)) ? $objectsrc->note_private : null));
|
||||
|
||||
if (!empty($conf->use_javascript_ajax))
|
||||
{
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
||||
print ajax_combobox('fac_replacement');
|
||||
print ajax_combobox('fac_avoir');
|
||||
|
||||
@ -78,9 +78,7 @@ if ($action == 'addcontact' && $user->rights->facture->creer)
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Toggle the status of a contact
|
||||
} // Toggle the status of a contact
|
||||
elseif ($action == 'swapstatut' && $user->rights->facture->creer)
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
@ -89,9 +87,7 @@ elseif ($action == 'swapstatut' && $user->rights->facture->creer)
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Deletes a contact
|
||||
} // Deletes a contact
|
||||
elseif ($action == 'deletecontact' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
|
||||
@ -247,9 +247,7 @@ if ($action == 'builddoc' && $user->rights->banque->cheque)
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc'));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove file in doc form
|
||||
} // Remove file in doc form
|
||||
elseif ($action == 'remove_file' && $user->rights->banque->cheque)
|
||||
{
|
||||
if ($object->fetch($id) > 0)
|
||||
|
||||
@ -2198,20 +2198,17 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
if (empty($entity) || empty($conf->medias->multidir_output[$entity])) return array('accessallowed'=>0, 'error'=>'Value entity must be provided');
|
||||
$accessallowed = 1;
|
||||
$original_file = $conf->medias->multidir_output[$entity].'/'.$original_file;
|
||||
}
|
||||
// Wrapping for *.log files, like when used with url http://.../document.php?modulepart=logs&file=dolibarr.log
|
||||
} // Wrapping for *.log files, like when used with url http://.../document.php?modulepart=logs&file=dolibarr.log
|
||||
elseif ($modulepart == 'logs' && !empty($dolibarr_main_data_root))
|
||||
{
|
||||
$accessallowed = ($user->admin && basename($original_file) == $original_file && preg_match('/^dolibarr.*\.log$/', basename($original_file)));
|
||||
$original_file = $dolibarr_main_data_root.'/'.$original_file;
|
||||
}
|
||||
// Wrapping for *.log files, like when used with url http://.../document.php?modulepart=logs&file=dolibarr.log
|
||||
} // Wrapping for *.log files, like when used with url http://.../document.php?modulepart=logs&file=dolibarr.log
|
||||
elseif ($modulepart == 'doctemplateswebsite' && !empty($dolibarr_main_data_root))
|
||||
{
|
||||
$accessallowed = ($fuser->rights->website->write && preg_match('/\.jpg$/i', basename($original_file)));
|
||||
$original_file = $dolibarr_main_data_root.'/doctemplates/websites/'.$original_file;
|
||||
}
|
||||
// Wrapping for *.zip files, like when used with url http://.../document.php?modulepart=packages&file=module_myfile.zip
|
||||
} // Wrapping for *.zip files, like when used with url http://.../document.php?modulepart=packages&file=module_myfile.zip
|
||||
elseif ($modulepart == 'packages' && !empty($dolibarr_main_data_root))
|
||||
{
|
||||
// Dir for custom dirs
|
||||
@ -2220,86 +2217,72 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
|
||||
$accessallowed = ($user->admin && preg_match('/^module_.*\.zip$/', basename($original_file)));
|
||||
$original_file = $dirins.'/'.$original_file;
|
||||
}
|
||||
// Wrapping for some images
|
||||
} // Wrapping for some images
|
||||
elseif ($modulepart == 'mycompany' && !empty($conf->mycompany->dir_output))
|
||||
{
|
||||
$accessallowed = 1;
|
||||
$original_file = $conf->mycompany->dir_output.'/'.$original_file;
|
||||
}
|
||||
// Wrapping for users photos
|
||||
} // Wrapping for users photos
|
||||
elseif ($modulepart == 'userphoto' && !empty($conf->user->dir_output))
|
||||
{
|
||||
$accessallowed = 1;
|
||||
$original_file = $conf->user->dir_output.'/'.$original_file;
|
||||
}
|
||||
// Wrapping for members photos
|
||||
} // Wrapping for members photos
|
||||
elseif ($modulepart == 'memberphoto' && !empty($conf->adherent->dir_output))
|
||||
{
|
||||
$accessallowed = 1;
|
||||
$original_file = $conf->adherent->dir_output.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les apercu factures
|
||||
} // Wrapping pour les apercu factures
|
||||
elseif ($modulepart == 'apercufacture' && !empty($conf->facture->multidir_output[$entity]))
|
||||
{
|
||||
if ($fuser->rights->facture->{$lire}) $accessallowed = 1;
|
||||
$original_file = $conf->facture->multidir_output[$entity].'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les apercu propal
|
||||
} // Wrapping pour les apercu propal
|
||||
elseif ($modulepart == 'apercupropal' && !empty($conf->propal->multidir_output[$entity]))
|
||||
{
|
||||
if ($fuser->rights->propale->{$lire}) $accessallowed = 1;
|
||||
$original_file = $conf->propal->multidir_output[$entity].'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les apercu commande
|
||||
} // Wrapping pour les apercu commande
|
||||
elseif ($modulepart == 'apercucommande' && !empty($conf->commande->multidir_output[$entity]))
|
||||
{
|
||||
if ($fuser->rights->commande->{$lire}) $accessallowed = 1;
|
||||
$original_file = $conf->commande->multidir_output[$entity].'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les apercu intervention
|
||||
} // Wrapping pour les apercu intervention
|
||||
elseif (($modulepart == 'apercufichinter' || $modulepart == 'apercuficheinter') && !empty($conf->ficheinter->dir_output))
|
||||
{
|
||||
if ($fuser->rights->ficheinter->{$lire}) $accessallowed = 1;
|
||||
$original_file = $conf->ficheinter->dir_output.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les apercu conat
|
||||
} // Wrapping pour les apercu conat
|
||||
elseif (($modulepart == 'apercucontract') && !empty($conf->contrat->dir_output))
|
||||
{
|
||||
if ($fuser->rights->contrat->{$lire}) $accessallowed = 1;
|
||||
$original_file = $conf->contrat->dir_output.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les apercu supplier proposal
|
||||
} // Wrapping pour les apercu supplier proposal
|
||||
elseif (($modulepart == 'apercusupplier_proposal' || $modulepart == 'apercusupplier_proposal') && !empty($conf->supplier_proposal->dir_output))
|
||||
{
|
||||
if ($fuser->rights->supplier_proposal->{$lire}) $accessallowed = 1;
|
||||
$original_file = $conf->supplier_proposal->dir_output.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les apercu supplier order
|
||||
} // Wrapping pour les apercu supplier order
|
||||
elseif (($modulepart == 'apercusupplier_order' || $modulepart == 'apercusupplier_order') && !empty($conf->fournisseur->commande->dir_output))
|
||||
{
|
||||
if ($fuser->rights->fournisseur->commande->{$lire}) $accessallowed = 1;
|
||||
$original_file = $conf->fournisseur->commande->dir_output.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les apercu supplier invoice
|
||||
} // Wrapping pour les apercu supplier invoice
|
||||
elseif (($modulepart == 'apercusupplier_invoice' || $modulepart == 'apercusupplier_invoice') && !empty($conf->fournisseur->facture->dir_output))
|
||||
{
|
||||
if ($fuser->rights->fournisseur->facture->{$lire}) $accessallowed = 1;
|
||||
$original_file = $conf->fournisseur->facture->dir_output.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les apercu supplier invoice
|
||||
} // Wrapping pour les apercu supplier invoice
|
||||
elseif (($modulepart == 'apercuexpensereport') && !empty($conf->expensereport->dir_output))
|
||||
{
|
||||
if ($fuser->rights->expensereport->{$lire}) $accessallowed = 1;
|
||||
$original_file = $conf->expensereport->dir_output.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les images des stats propales
|
||||
} // Wrapping pour les images des stats propales
|
||||
elseif ($modulepart == 'propalstats' && !empty($conf->propal->multidir_temp[$entity]))
|
||||
{
|
||||
if ($fuser->rights->propale->{$lire}) $accessallowed = 1;
|
||||
$original_file = $conf->propal->multidir_temp[$entity].'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les images des stats commandes
|
||||
} // Wrapping pour les images des stats commandes
|
||||
elseif ($modulepart == 'orderstats' && !empty($conf->commande->dir_temp))
|
||||
{
|
||||
if ($fuser->rights->commande->{$lire}) $accessallowed = 1;
|
||||
@ -2308,8 +2291,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
{
|
||||
if ($fuser->rights->fournisseur->commande->{$lire}) $accessallowed = 1;
|
||||
$original_file = $conf->fournisseur->commande->dir_temp.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les images des stats factures
|
||||
} // Wrapping pour les images des stats factures
|
||||
elseif ($modulepart == 'billstats' && !empty($conf->facture->dir_temp))
|
||||
{
|
||||
if ($fuser->rights->facture->{$lire}) $accessallowed = 1;
|
||||
@ -2318,103 +2300,86 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
{
|
||||
if ($fuser->rights->fournisseur->facture->{$lire}) $accessallowed = 1;
|
||||
$original_file = $conf->fournisseur->facture->dir_temp.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les images des stats expeditions
|
||||
} // Wrapping pour les images des stats expeditions
|
||||
elseif ($modulepart == 'expeditionstats' && !empty($conf->expedition->dir_temp))
|
||||
{
|
||||
if ($fuser->rights->expedition->{$lire}) $accessallowed = 1;
|
||||
$original_file = $conf->expedition->dir_temp.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les images des stats expeditions
|
||||
} // Wrapping pour les images des stats expeditions
|
||||
elseif ($modulepart == 'tripsexpensesstats' && !empty($conf->deplacement->dir_temp))
|
||||
{
|
||||
if ($fuser->rights->deplacement->{$lire}) $accessallowed = 1;
|
||||
$original_file = $conf->deplacement->dir_temp.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les images des stats expeditions
|
||||
} // Wrapping pour les images des stats expeditions
|
||||
elseif ($modulepart == 'memberstats' && !empty($conf->adherent->dir_temp))
|
||||
{
|
||||
if ($fuser->rights->adherent->{$lire}) $accessallowed = 1;
|
||||
$original_file = $conf->adherent->dir_temp.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les images des stats produits
|
||||
} // Wrapping pour les images des stats produits
|
||||
elseif (preg_match('/^productstats_/i', $modulepart) && !empty($conf->product->dir_temp))
|
||||
{
|
||||
if ($fuser->rights->produit->{$lire} || $fuser->rights->service->{$lire}) $accessallowed = 1;
|
||||
$original_file = (!empty($conf->product->multidir_temp[$entity]) ? $conf->product->multidir_temp[$entity] : $conf->service->multidir_temp[$entity]).'/'.$original_file;
|
||||
}
|
||||
// Wrapping for taxes
|
||||
} // Wrapping for taxes
|
||||
elseif (in_array($modulepart, array('tax', 'tax-vat')) && !empty($conf->tax->dir_output))
|
||||
{
|
||||
if ($fuser->rights->tax->charges->{$lire}) $accessallowed = 1;
|
||||
$modulepartsuffix = str_replace('tax-', '', $modulepart);
|
||||
$original_file = $conf->tax->dir_output.'/'.($modulepartsuffix != 'tax' ? $modulepartsuffix.'/' : '').$original_file;
|
||||
}
|
||||
// Wrapping for events
|
||||
} // Wrapping for events
|
||||
elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output))
|
||||
{
|
||||
if ($fuser->rights->agenda->myactions->{$read}) $accessallowed = 1;
|
||||
$original_file = $conf->agenda->dir_output.'/'.$original_file;
|
||||
}
|
||||
// Wrapping for categories
|
||||
} // Wrapping for categories
|
||||
elseif ($modulepart == 'category' && !empty($conf->categorie->multidir_output[$entity]))
|
||||
{
|
||||
if (empty($entity) || empty($conf->categorie->multidir_output[$entity])) return array('accessallowed'=>0, 'error'=>'Value entity must be provided');
|
||||
if ($fuser->rights->categorie->{$lire}) $accessallowed = 1;
|
||||
$original_file = $conf->categorie->multidir_output[$entity].'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les prelevements
|
||||
} // Wrapping pour les prelevements
|
||||
elseif ($modulepart == 'prelevement' && !empty($conf->prelevement->dir_output))
|
||||
{
|
||||
if ($fuser->rights->prelevement->bons->{$lire} || preg_match('/^specimen/i', $original_file)) $accessallowed = 1;
|
||||
$original_file = $conf->prelevement->dir_output.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les graph energie
|
||||
} // Wrapping pour les graph energie
|
||||
elseif ($modulepart == 'graph_stock' && !empty($conf->stock->dir_temp))
|
||||
{
|
||||
$accessallowed = 1;
|
||||
$original_file = $conf->stock->dir_temp.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les graph fournisseurs
|
||||
} // Wrapping pour les graph fournisseurs
|
||||
elseif ($modulepart == 'graph_fourn' && !empty($conf->fournisseur->dir_temp))
|
||||
{
|
||||
$accessallowed = 1;
|
||||
$original_file = $conf->fournisseur->dir_temp.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les graph des produits
|
||||
} // Wrapping pour les graph des produits
|
||||
elseif ($modulepart == 'graph_product' && !empty($conf->product->dir_temp))
|
||||
{
|
||||
$accessallowed = 1;
|
||||
$original_file = $conf->product->multidir_temp[$entity].'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les code barre
|
||||
} // Wrapping pour les code barre
|
||||
elseif ($modulepart == 'barcode')
|
||||
{
|
||||
$accessallowed = 1;
|
||||
// If viewimage is called for barcode, we try to output an image on the fly, with no build of file on disk.
|
||||
//$original_file=$conf->barcode->dir_temp.'/'.$original_file;
|
||||
$original_file = '';
|
||||
}
|
||||
// Wrapping pour les icones de background des mailings
|
||||
} // Wrapping pour les icones de background des mailings
|
||||
elseif ($modulepart == 'iconmailing' && !empty($conf->mailing->dir_temp))
|
||||
{
|
||||
$accessallowed = 1;
|
||||
$original_file = $conf->mailing->dir_temp.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour le scanner
|
||||
} // Wrapping pour le scanner
|
||||
elseif ($modulepart == 'scanner_user_temp' && !empty($conf->scanner->dir_temp))
|
||||
{
|
||||
$accessallowed = 1;
|
||||
$original_file = $conf->scanner->dir_temp.'/'.$fuser->id.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les images fckeditor
|
||||
} // Wrapping pour les images fckeditor
|
||||
elseif ($modulepart == 'fckeditor' && !empty($conf->fckeditor->dir_output))
|
||||
{
|
||||
$accessallowed = 1;
|
||||
$original_file = $conf->fckeditor->dir_output.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping for users
|
||||
} // Wrapping for users
|
||||
elseif ($modulepart == 'user' && !empty($conf->user->dir_output))
|
||||
{
|
||||
$canreaduser = (!empty($fuser->admin) || $fuser->rights->user->user->{$lire});
|
||||
@ -2424,9 +2389,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
$accessallowed = 1;
|
||||
}
|
||||
$original_file = $conf->user->dir_output.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping for third parties
|
||||
} // Wrapping for third parties
|
||||
elseif (($modulepart == 'company' || $modulepart == 'societe' || $modulepart == 'thirdparty') && !empty($conf->societe->multidir_output[$entity]))
|
||||
{
|
||||
if (empty($entity) || empty($conf->societe->multidir_output[$entity])) return array('accessallowed'=>0, 'error'=>'Value entity must be provided');
|
||||
@ -2436,9 +2399,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
}
|
||||
$original_file = $conf->societe->multidir_output[$entity].'/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT rowid as fk_soc FROM ".MAIN_DB_PREFIX."societe WHERE rowid='".$db->escape($refname)."' AND entity IN (".getEntity('societe').")";
|
||||
}
|
||||
|
||||
// Wrapping for contact
|
||||
} // Wrapping for contact
|
||||
elseif ($modulepart == 'contact' && !empty($conf->societe->multidir_output[$entity]))
|
||||
{
|
||||
if (empty($entity) || empty($conf->societe->multidir_output[$entity])) return array('accessallowed'=>0, 'error'=>'Value entity must be provided');
|
||||
@ -2447,9 +2408,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
$accessallowed = 1;
|
||||
}
|
||||
$original_file = $conf->societe->multidir_output[$entity].'/contact/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping for invoices
|
||||
} // Wrapping for invoices
|
||||
elseif (($modulepart == 'facture' || $modulepart == 'invoice') && !empty($conf->facture->multidir_output[$entity]))
|
||||
{
|
||||
if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file))
|
||||
@ -2458,8 +2417,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
}
|
||||
$original_file = $conf->facture->multidir_output[$entity].'/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('invoice').")";
|
||||
}
|
||||
// Wrapping for mass actions
|
||||
} // Wrapping for mass actions
|
||||
elseif ($modulepart == 'massfilesarea_proposals' && !empty($conf->propal->multidir_output[$entity]))
|
||||
{
|
||||
if ($fuser->rights->propal->{$lire} || preg_match('/^specimen/i', $original_file))
|
||||
@ -2530,9 +2488,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
$accessallowed = 1;
|
||||
}
|
||||
$original_file = $conf->contrat->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping for interventions
|
||||
} // Wrapping for interventions
|
||||
elseif (($modulepart == 'fichinter' || $modulepart == 'ficheinter') && !empty($conf->ficheinter->dir_output))
|
||||
{
|
||||
if ($fuser->rights->ficheinter->{$lire} || preg_match('/^specimen/i', $original_file))
|
||||
@ -2541,9 +2497,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
}
|
||||
$original_file = $conf->ficheinter->dir_output.'/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
|
||||
}
|
||||
|
||||
// Wrapping pour les deplacements et notes de frais
|
||||
} // Wrapping pour les deplacements et notes de frais
|
||||
elseif ($modulepart == 'deplacement' && !empty($conf->deplacement->dir_output))
|
||||
{
|
||||
if ($fuser->rights->deplacement->{$lire} || preg_match('/^specimen/i', $original_file))
|
||||
@ -2552,8 +2506,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
}
|
||||
$original_file = $conf->deplacement->dir_output.'/'.$original_file;
|
||||
//$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
|
||||
}
|
||||
// Wrapping pour les propales
|
||||
} // Wrapping pour les propales
|
||||
elseif (($modulepart == 'propal' || $modulepart == 'propale') && !empty($conf->propal->multidir_output[$entity]))
|
||||
{
|
||||
if ($fuser->rights->propale->{$lire} || preg_match('/^specimen/i', $original_file))
|
||||
@ -2562,9 +2515,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
}
|
||||
$original_file = $conf->propal->multidir_output[$entity].'/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."propal WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('propal').")";
|
||||
}
|
||||
|
||||
// Wrapping pour les commandes
|
||||
} // Wrapping pour les commandes
|
||||
elseif (($modulepart == 'commande' || $modulepart == 'order') && !empty($conf->commande->multidir_output[$entity]))
|
||||
{
|
||||
if ($fuser->rights->commande->{$lire} || preg_match('/^specimen/i', $original_file))
|
||||
@ -2573,9 +2524,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
}
|
||||
$original_file = $conf->commande->multidir_output[$entity].'/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."commande WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('order').")";
|
||||
}
|
||||
|
||||
// Wrapping pour les projets
|
||||
} // Wrapping pour les projets
|
||||
elseif ($modulepart == 'project' && !empty($conf->projet->dir_output))
|
||||
{
|
||||
if ($fuser->rights->projet->{$lire} || preg_match('/^specimen/i', $original_file))
|
||||
@ -2592,9 +2541,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
}
|
||||
$original_file = $conf->projet->dir_output.'/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('project').")";
|
||||
}
|
||||
|
||||
// Wrapping pour les commandes fournisseurs
|
||||
} // Wrapping pour les commandes fournisseurs
|
||||
elseif (($modulepart == 'commande_fournisseur' || $modulepart == 'order_supplier') && !empty($conf->fournisseur->commande->dir_output))
|
||||
{
|
||||
if ($fuser->rights->fournisseur->commande->{$lire} || preg_match('/^specimen/i', $original_file))
|
||||
@ -2603,9 +2550,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
}
|
||||
$original_file = $conf->fournisseur->commande->dir_output.'/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."commande_fournisseur WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
|
||||
}
|
||||
|
||||
// Wrapping pour les factures fournisseurs
|
||||
} // Wrapping pour les factures fournisseurs
|
||||
elseif (($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_supplier') && !empty($conf->fournisseur->facture->dir_output))
|
||||
{
|
||||
if ($fuser->rights->fournisseur->facture->{$lire} || preg_match('/^specimen/i', $original_file))
|
||||
@ -2614,8 +2559,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
}
|
||||
$original_file = $conf->fournisseur->facture->dir_output.'/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture_fourn WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
|
||||
}
|
||||
// Wrapping pour les rapport de paiements
|
||||
} // Wrapping pour les rapport de paiements
|
||||
elseif ($modulepart == 'supplier_payment')
|
||||
{
|
||||
if ($fuser->rights->fournisseur->facture->{$lire} || preg_match('/^specimen/i', $original_file))
|
||||
@ -2624,9 +2568,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
}
|
||||
$original_file = $conf->fournisseur->payment->dir_output.'/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."paiementfournisseur WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
|
||||
}
|
||||
|
||||
// Wrapping pour les rapport de paiements
|
||||
} // Wrapping pour les rapport de paiements
|
||||
elseif ($modulepart == 'facture_paiement' && !empty($conf->facture->dir_output))
|
||||
{
|
||||
if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file))
|
||||
@ -2635,9 +2577,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
}
|
||||
if ($fuser->societe_id > 0) $original_file = $conf->facture->dir_output.'/payments/private/'.$fuser->id.'/'.$original_file;
|
||||
else $original_file = $conf->facture->dir_output.'/payments/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping for accounting exports
|
||||
} // Wrapping for accounting exports
|
||||
elseif ($modulepart == 'export_compta' && !empty($conf->accounting->dir_output))
|
||||
{
|
||||
if ($fuser->rights->accounting->bind->write || preg_match('/^specimen/i', $original_file))
|
||||
@ -2645,9 +2585,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
$accessallowed = 1;
|
||||
}
|
||||
$original_file = $conf->accounting->dir_output.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping pour les expedition
|
||||
} // Wrapping pour les expedition
|
||||
elseif ($modulepart == 'expedition' && !empty($conf->expedition->dir_output))
|
||||
{
|
||||
if ($fuser->rights->expedition->{$lire} || preg_match('/^specimen/i', $original_file))
|
||||
@ -2655,8 +2593,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
$accessallowed = 1;
|
||||
}
|
||||
$original_file = $conf->expedition->dir_output."/sending/".$original_file;
|
||||
}
|
||||
// Wrapping pour les bons de livraison
|
||||
} // Wrapping pour les bons de livraison
|
||||
elseif ($modulepart == 'livraison' && !empty($conf->expedition->dir_output))
|
||||
{
|
||||
if ($fuser->rights->expedition->livraison->{$lire} || preg_match('/^specimen/i', $original_file))
|
||||
@ -2664,9 +2601,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
$accessallowed = 1;
|
||||
}
|
||||
$original_file = $conf->expedition->dir_output."/receipt/".$original_file;
|
||||
}
|
||||
|
||||
// Wrapping pour les actions
|
||||
} // Wrapping pour les actions
|
||||
elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output))
|
||||
{
|
||||
if ($fuser->rights->agenda->myactions->{$read} || preg_match('/^specimen/i', $original_file))
|
||||
@ -2674,9 +2609,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
$accessallowed = 1;
|
||||
}
|
||||
$original_file = $conf->agenda->dir_output.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping pour les actions
|
||||
} // Wrapping pour les actions
|
||||
elseif ($modulepart == 'actionsreport' && !empty($conf->agenda->dir_temp))
|
||||
{
|
||||
if ($fuser->rights->agenda->allactions->{$read} || preg_match('/^specimen/i', $original_file))
|
||||
@ -2684,9 +2617,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
$accessallowed = 1;
|
||||
}
|
||||
$original_file = $conf->agenda->dir_temp."/".$original_file;
|
||||
}
|
||||
|
||||
// Wrapping pour les produits et services
|
||||
} // Wrapping pour les produits et services
|
||||
elseif ($modulepart == 'product' || $modulepart == 'produit' || $modulepart == 'service' || $modulepart == 'produit|service')
|
||||
{
|
||||
if (empty($entity) || (empty($conf->product->multidir_output[$entity]) && empty($conf->service->multidir_output[$entity]))) return array('accessallowed'=>0, 'error'=>'Value entity must be provided');
|
||||
@ -2696,9 +2627,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
}
|
||||
if (!empty($conf->product->enabled)) $original_file = $conf->product->multidir_output[$entity].'/'.$original_file;
|
||||
elseif (!empty($conf->service->enabled)) $original_file = $conf->service->multidir_output[$entity].'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping pour les lots produits
|
||||
} // Wrapping pour les lots produits
|
||||
elseif ($modulepart == 'product_batch' || $modulepart == 'produitlot')
|
||||
{
|
||||
if (empty($entity) || (empty($conf->productbatch->multidir_output[$entity]))) return array('accessallowed'=>0, 'error'=>'Value entity must be provided');
|
||||
@ -2707,9 +2636,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
$accessallowed = 1;
|
||||
}
|
||||
if (!empty($conf->productbatch->enabled)) $original_file = $conf->productbatch->multidir_output[$entity].'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping for stock movements
|
||||
} // Wrapping for stock movements
|
||||
elseif ($modulepart == 'movement' || $modulepart == 'mouvement')
|
||||
{
|
||||
if (empty($entity) || empty($conf->stock->multidir_output[$entity])) return array('accessallowed'=>0, 'error'=>'Value entity must be provided');
|
||||
@ -2718,9 +2645,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
$accessallowed = 1;
|
||||
}
|
||||
if (!empty($conf->stock->enabled)) $original_file = $conf->stock->multidir_output[$entity].'/movement/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping pour les contrats
|
||||
} // Wrapping pour les contrats
|
||||
elseif ($modulepart == 'contract' && !empty($conf->contrat->dir_output))
|
||||
{
|
||||
if ($fuser->rights->contrat->{$lire} || preg_match('/^specimen/i', $original_file))
|
||||
@ -2729,9 +2654,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
}
|
||||
$original_file = $conf->contrat->dir_output.'/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."contrat WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('contract').")";
|
||||
}
|
||||
|
||||
// Wrapping pour les dons
|
||||
} // Wrapping pour les dons
|
||||
elseif ($modulepart == 'donation' && !empty($conf->don->dir_output))
|
||||
{
|
||||
if ($fuser->rights->don->{$lire} || preg_match('/^specimen/i', $original_file))
|
||||
@ -2739,9 +2662,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
$accessallowed = 1;
|
||||
}
|
||||
$original_file = $conf->don->dir_output.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping pour les dons
|
||||
} // Wrapping pour les dons
|
||||
elseif ($modulepart == 'dolresource' && !empty($conf->resource->dir_output))
|
||||
{
|
||||
if ($fuser->rights->resource->{$read} || preg_match('/^specimen/i', $original_file))
|
||||
@ -2749,9 +2670,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
$accessallowed = 1;
|
||||
}
|
||||
$original_file = $conf->resource->dir_output.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping pour les remises de cheques
|
||||
} // Wrapping pour les remises de cheques
|
||||
elseif ($modulepart == 'remisecheque' && !empty($conf->bank->dir_output))
|
||||
{
|
||||
if ($fuser->rights->banque->{$lire} || preg_match('/^specimen/i', $original_file))
|
||||
@ -2760,9 +2679,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
}
|
||||
|
||||
$original_file = $conf->bank->dir_output.'/checkdeposits/'.$original_file; // original_file should contains relative path so include the get_exdir result
|
||||
}
|
||||
|
||||
// Wrapping for bank
|
||||
} // Wrapping for bank
|
||||
elseif (($modulepart == 'banque' || $modulepart == 'bank') && !empty($conf->bank->dir_output))
|
||||
{
|
||||
if ($fuser->rights->banque->{$lire})
|
||||
@ -2770,55 +2687,41 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
$accessallowed = 1;
|
||||
}
|
||||
$original_file = $conf->bank->dir_output.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping for export module
|
||||
} // Wrapping for export module
|
||||
elseif ($modulepart == 'export' && !empty($conf->export->dir_temp))
|
||||
{
|
||||
// Aucun test necessaire car on force le rep de download sur
|
||||
// le rep export qui est propre a l'utilisateur
|
||||
$accessallowed = 1;
|
||||
$original_file = $conf->export->dir_temp.'/'.$fuser->id.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping for import module
|
||||
} // Wrapping for import module
|
||||
elseif ($modulepart == 'import' && !empty($conf->import->dir_temp))
|
||||
{
|
||||
$accessallowed = 1;
|
||||
$original_file = $conf->import->dir_temp.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping pour l'editeur wysiwyg
|
||||
} // Wrapping pour l'editeur wysiwyg
|
||||
elseif ($modulepart == 'editor' && !empty($conf->fckeditor->dir_output))
|
||||
{
|
||||
$accessallowed = 1;
|
||||
$original_file = $conf->fckeditor->dir_output.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping for backups
|
||||
} // Wrapping for backups
|
||||
elseif ($modulepart == 'systemtools' && !empty($conf->admin->dir_output))
|
||||
{
|
||||
if ($fuser->admin) $accessallowed = 1;
|
||||
$original_file = $conf->admin->dir_output.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping for upload file test
|
||||
} // Wrapping for upload file test
|
||||
elseif ($modulepart == 'admin_temp' && !empty($conf->admin->dir_temp))
|
||||
{
|
||||
if ($fuser->admin) $accessallowed = 1;
|
||||
$original_file = $conf->admin->dir_temp.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping pour BitTorrent
|
||||
} // Wrapping pour BitTorrent
|
||||
elseif ($modulepart == 'bittorrent' && !empty($conf->bittorrent->dir_output))
|
||||
{
|
||||
$accessallowed = 1;
|
||||
$dir = 'files';
|
||||
if (dol_mimetype($original_file) == 'application/x-bittorrent') $dir = 'torrents';
|
||||
$original_file = $conf->bittorrent->dir_output.'/'.$dir.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping pour Foundation module
|
||||
} // Wrapping pour Foundation module
|
||||
elseif ($modulepart == 'member' && !empty($conf->adherent->dir_output))
|
||||
{
|
||||
if ($fuser->rights->adherent->{$lire} || preg_match('/^specimen/i', $original_file))
|
||||
@ -2826,16 +2729,12 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
$accessallowed = 1;
|
||||
}
|
||||
$original_file = $conf->adherent->dir_output.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping for Scanner
|
||||
} // Wrapping for Scanner
|
||||
elseif ($modulepart == 'scanner_user_temp' && !empty($conf->scanner->dir_temp))
|
||||
{
|
||||
$accessallowed = 1;
|
||||
$original_file = $conf->scanner->dir_temp.'/'.$fuser->id.'/'.$original_file;
|
||||
}
|
||||
|
||||
// GENERIC Wrapping
|
||||
} // GENERIC Wrapping
|
||||
// If modulepart=module_user_temp Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart/temp/iduser
|
||||
// If modulepart=module_temp Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart/temp
|
||||
// If modulepart=module_user Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart/iduser
|
||||
|
||||
@ -167,10 +167,10 @@ function getBrowserInfo($user_agent)
|
||||
if (preg_match('/linux/i', $user_agent)) { $os = 'linux'; } elseif (preg_match('/macintosh/i', $user_agent)) { $os = 'macintosh'; } elseif (preg_match('/windows/i', $user_agent)) { $os = 'windows'; }
|
||||
|
||||
// Name
|
||||
if (preg_match('/firefox(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name = 'firefox'; $version = $reg[2]; } elseif (preg_match('/edge(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name = 'edge'; $version = $reg[2]; } elseif (preg_match('/chrome(\/|\s)([\d\.]+)/i', $user_agent, $reg)) { $name = 'chrome'; $version = $reg[2]; } // we can have 'chrome (Mozilla...) chrome x.y' in one string
|
||||
elseif (preg_match('/chrome/i', $user_agent, $reg)) { $name = 'chrome'; } elseif (preg_match('/iceweasel/i', $user_agent)) { $name = 'iceweasel'; } elseif (preg_match('/epiphany/i', $user_agent)) { $name = 'epiphany'; } elseif (preg_match('/safari(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name = 'safari'; $version = $reg[2]; } // Safari is often present in string for mobile but its not.
|
||||
elseif (preg_match('/opera(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name = 'opera'; $version = $reg[2]; } elseif (preg_match('/(MSIE\s([0-9]+\.[0-9]))|.*(Trident\/[0-9]+.[0-9];.*rv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { $name = 'ie'; $version = end($reg); } // MS products at end
|
||||
elseif (preg_match('/(Windows NT\s([0-9]+\.[0-9])).*(Trident\/[0-9]+.[0-9];.*rv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { $name = 'ie'; $version = end($reg); } // MS products at end
|
||||
if (preg_match('/firefox(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name = 'firefox'; $version = $reg[2]; } elseif (preg_match('/edge(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name = 'edge'; $version = $reg[2]; } elseif (preg_match('/chrome(\/|\s)([\d\.]+)/i', $user_agent, $reg)) { $name = 'chrome'; $version = $reg[2]; } // we can have 'chrome (Mozilla...) chrome x.y' in one string
|
||||
elseif (preg_match('/chrome/i', $user_agent, $reg)) { $name = 'chrome'; } elseif (preg_match('/iceweasel/i', $user_agent)) { $name = 'iceweasel'; } elseif (preg_match('/epiphany/i', $user_agent)) { $name = 'epiphany'; } elseif (preg_match('/safari(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name = 'safari'; $version = $reg[2]; } // Safari is often present in string for mobile but its not.
|
||||
elseif (preg_match('/opera(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name = 'opera'; $version = $reg[2]; } elseif (preg_match('/(MSIE\s([0-9]+\.[0-9]))|.*(Trident\/[0-9]+.[0-9];.*rv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { $name = 'ie'; $version = end($reg); } // MS products at end
|
||||
elseif (preg_match('/(Windows NT\s([0-9]+\.[0-9])).*(Trident\/[0-9]+.[0-9];.*rv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { $name = 'ie'; $version = end($reg); } // MS products at end
|
||||
elseif (preg_match('/l(i|y)n(x|ks)(\(|\/|\s)*([\d\.]+)/i', $user_agent, $reg)) { $name = 'lynxlinks'; $version = $reg[4]; }
|
||||
|
||||
if ($tablet) {
|
||||
@ -342,8 +342,7 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
|
||||
{
|
||||
$out = $_SESSION['lastsearch_limit_'.$relativepathstring];
|
||||
}
|
||||
}
|
||||
// Else, retreive default values if we are not doing a sort
|
||||
} // Else, retreive default values if we are not doing a sort
|
||||
elseif (!isset($_GET['sortfield'])) // If we did a click on a field to sort, we do no apply default values. Same if option MAIN_ENABLE_DEFAULT_VALUES is not set
|
||||
{
|
||||
if (!empty($_GET['action']) && $_GET['action'] == 'create' && !isset($_GET[$paramname]) && !isset($_POST[$paramname]))
|
||||
@ -392,8 +391,7 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Management of default search_filters and sort order
|
||||
} // Management of default search_filters and sort order
|
||||
//elseif (preg_match('/list.php$/', $_SERVER["PHP_SELF"]) && ! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
||||
elseif (!empty($paramname) && !isset($_GET[$paramname]) && !isset($_POST[$paramname]))
|
||||
{
|
||||
@ -1120,8 +1118,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename =
|
||||
// This is when server run behind a reverse proxy
|
||||
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] != $remoteip) $data['ip'] = $_SERVER['HTTP_X_FORWARDED_FOR'].' -> '.$data['ip'];
|
||||
elseif (!empty($_SERVER['HTTP_CLIENT_IP']) && $_SERVER['HTTP_CLIENT_IP'] != $remoteip) $data['ip'] = $_SERVER['HTTP_CLIENT_IP'].' -> '.$data['ip'];
|
||||
}
|
||||
// This is when PHP session is ran inside a web server but not inside a client request (example: init code of apache)
|
||||
} // This is when PHP session is ran inside a web server but not inside a client request (example: init code of apache)
|
||||
elseif (!empty($_SERVER['SERVER_ADDR'])) $data['ip'] = $_SERVER['SERVER_ADDR'];
|
||||
// This is when PHP session is ran outside a web server, like from Windows command line (Not always defined, but useful if OS defined it).
|
||||
elseif (!empty($_SERVER['COMPUTERNAME'])) $data['ip'] = $_SERVER['COMPUTERNAME'].(empty($_SERVER['USERNAME']) ? '' : '@'.$_SERVER['USERNAME']);
|
||||
@ -2083,8 +2080,7 @@ function dol_now($mode = 'gmt')
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
$tzsecond = getServerTimeZoneInt('now'); // Contains tz+dayling saving time
|
||||
$ret = (int) (dol_now('gmt') + ($tzsecond * 3600));
|
||||
}
|
||||
/*elseif ($mode == 'tzref') // Time for now with parent company timezone is added
|
||||
} /*elseif ($mode == 'tzref') // Time for now with parent company timezone is added
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
$tzsecond=getParentCompanyTimeZoneInt(); // Contains tz+dayling saving time
|
||||
@ -5579,7 +5575,7 @@ function dolGetFirstLineOfText($text, $nboflines = 1, $charset = 'UTF-8')
|
||||
}
|
||||
|
||||
$text = strtr($text, $repTable);
|
||||
if ($charset == 'UTF-8') { $pattern = '/(<br[^>]*>)/Uu'; } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support
|
||||
if ($charset == 'UTF-8') { $pattern = '/(<br[^>]*>)/Uu'; } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support
|
||||
else $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag.
|
||||
$a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
@ -5776,7 +5772,7 @@ function dol_nboflines_bis($text, $maxlinesize = 0, $charset = 'UTF-8')
|
||||
if (dol_textishtml($text)) $repTable = array("\t" => " ", "\n" => " ", "\r" => " ", "\0" => " ", "\x0B" => " ");
|
||||
|
||||
$text = strtr($text, $repTable);
|
||||
if ($charset == 'UTF-8') { $pattern = '/(<br[^>]*>)/Uu'; } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support
|
||||
if ($charset == 'UTF-8') { $pattern = '/(<br[^>]*>)/Uu'; } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support
|
||||
else $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag.
|
||||
$a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
@ -8205,8 +8201,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
|
||||
$return = !empty($html) ? $html : $statusLabel;
|
||||
} elseif ($displayMode == 1) {
|
||||
$return = !empty($html) ? $html : (!empty($statusLabelShort) ? $statusLabelShort : $statusLabel);
|
||||
}
|
||||
// Use status with images (for backward compatibility)
|
||||
} // Use status with images (for backward compatibility)
|
||||
elseif (!empty($conf->global->MAIN_STATUS_USES_IMAGES)) {
|
||||
$return = '';
|
||||
$htmlLabel = (in_array($displayMode, array(1, 2, 5)) ? '<span class="hideonsmartphone">' : '').(!empty($html) ? $html : $statusLabel).(in_array($displayMode, array(1, 2, 5)) ? '</span>' : '');
|
||||
@ -8251,8 +8246,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
|
||||
} else { // $displayMode >= 6
|
||||
$return = $htmlLabel.' '.$htmlImg;
|
||||
}
|
||||
}
|
||||
// Use new badge
|
||||
} // Use new badge
|
||||
elseif (empty($conf->global->MAIN_STATUS_USES_IMAGES) && !empty($displayMode)) {
|
||||
$statusLabelShort = !empty($statusLabelShort) ? $statusLabelShort : $statusLabel;
|
||||
|
||||
|
||||
@ -904,11 +904,9 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
|
||||
{
|
||||
// If before of next new year date
|
||||
if ($date < $nextnewyeardate && $yearoffsettype == '+') $yearoffset = 1;
|
||||
}
|
||||
// If after or equal of current new year date
|
||||
} // If after or equal of current new year date
|
||||
elseif ($date >= $newyeardate && $yearoffsettype == '-') $yearoffset = -1;
|
||||
}
|
||||
// For backward compatibility
|
||||
} // For backward compatibility
|
||||
elseif (date("m", $date) < $maskraz && empty($resetEveryMonth)) { $yearoffset = -1; } // If current month lower that month of return to zero, year is previous year
|
||||
|
||||
if ($yearlen == 4) $yearcomp = sprintf("%04d", date("Y", $date) + $yearoffset);
|
||||
|
||||
@ -86,8 +86,7 @@ function dol_setcache($memoryid, $data)
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// Using shmop
|
||||
} // Using shmop
|
||||
elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02))
|
||||
{
|
||||
$result = dol_setshmop($memoryid, $data);
|
||||
@ -153,8 +152,7 @@ function dol_getcache($memoryid)
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// Using shmop
|
||||
} // Using shmop
|
||||
elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02))
|
||||
{
|
||||
$data = dol_getshmop($memoryid);
|
||||
|
||||
@ -497,8 +497,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
|
||||
if ($user->socid > 0)
|
||||
{
|
||||
if ($user->socid <> $objectid) return false;
|
||||
}
|
||||
// If internal user: Check permission for internal users that are restricted on their objects
|
||||
} // If internal user: Check permission for internal users that are restricted on their objects
|
||||
elseif (!empty($conf->societe->enabled) && ($user->rights->societe->lire && !$user->rights->societe->client->voir))
|
||||
{
|
||||
$sql = "SELECT COUNT(sc.fk_soc) as nb";
|
||||
@ -508,8 +507,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
|
||||
$sql .= " AND sc.fk_user = ".$user->id;
|
||||
$sql .= " AND sc.fk_soc = s.rowid";
|
||||
$sql .= " AND s.entity IN (".getEntity($sharedelement, 1).")";
|
||||
}
|
||||
// If multicompany and internal users with all permissions, check user is in correct entity
|
||||
} // If multicompany and internal users with all permissions, check user is in correct entity
|
||||
elseif (!empty($conf->multicompany->enabled))
|
||||
{
|
||||
$sql = "SELECT COUNT(s.rowid) as nb";
|
||||
@ -526,8 +524,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
|
||||
$sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")";
|
||||
$sql .= " AND dbt.fk_soc = ".$user->socid;
|
||||
}
|
||||
// If internal user: Check permission for internal users that are restricted on their objects
|
||||
} // If internal user: Check permission for internal users that are restricted on their objects
|
||||
elseif (!empty($conf->societe->enabled) && ($user->rights->societe->lire && !$user->rights->societe->client->voir))
|
||||
{
|
||||
$sql = "SELECT COUNT(dbt.".$dbt_select.") as nb";
|
||||
@ -536,8 +533,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
|
||||
$sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")";
|
||||
$sql .= " AND (dbt.fk_soc IS NULL OR sc.fk_soc IS NOT NULL)"; // Contact not linked to a company or to a company of user
|
||||
$sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
|
||||
}
|
||||
// If multicompany and internal users with all permissions, check user is in correct entity
|
||||
} // If multicompany and internal users with all permissions, check user is in correct entity
|
||||
elseif (!empty($conf->multicompany->enabled))
|
||||
{
|
||||
$sql = "SELECT COUNT(dbt.".$dbt_select.") as nb";
|
||||
@ -588,8 +584,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
|
||||
$sql .= " WHERE dbt.rowid IN (".$objectid.")";
|
||||
$sql .= " AND dbt.".$dbt_keyfield." = ".$user->socid;
|
||||
}
|
||||
// If internal user: Check permission for internal users that are restricted on their objects
|
||||
} // If internal user: Check permission for internal users that are restricted on their objects
|
||||
elseif (!empty($conf->societe->enabled) && ($user->rights->societe->lire && !$user->rights->societe->client->voir))
|
||||
{
|
||||
if (empty($dbt_keyfield)) dol_print_error('', 'Param dbt_keyfield is required but not defined');
|
||||
@ -602,8 +597,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
|
||||
$sql .= " AND dbt.".$dbt_keyfield." = s.rowid";
|
||||
$sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
|
||||
$sql .= " AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
// If multicompany and internal users with all permissions, check user is in correct entity
|
||||
} // If multicompany and internal users with all permissions, check user is in correct entity
|
||||
elseif (!empty($conf->multicompany->enabled))
|
||||
{
|
||||
$sql = "SELECT COUNT(dbt.".$dbt_select.") as nb";
|
||||
|
||||
@ -267,8 +267,7 @@ function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper)
|
||||
if (!empty($conf->global->MAIN_UMASK)) {
|
||||
@chmod($fileindex, octdec($conf->global->MAIN_UMASK));
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$result1 = true;
|
||||
}
|
||||
|
||||
|
||||
@ -700,12 +700,10 @@ if ($id > 0 || !empty($ref)) {
|
||||
$i = 0;
|
||||
|
||||
if ($num) {
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
if (!empty($conf->productbatch->enabled))
|
||||
{
|
||||
if (!empty($conf->productbatch->enabled)) {
|
||||
print '<td class="dispatch_batch_number_title">'.$langs->trans("batch_number").'</td>';
|
||||
print '<td class="dispatch_dluo_title">'.$langs->trans("EatByDate").'</td>';
|
||||
print '<td class="dispatch_dlc_title">'.$langs->trans("SellByDate").'</td>';
|
||||
@ -731,11 +729,9 @@ if ($id > 0 || !empty($ref)) {
|
||||
print '<td align="right">'.$langs->trans("Warehouse");
|
||||
|
||||
// Select warehouse to force it everywhere
|
||||
if (count($listwarehouses) > 1)
|
||||
{
|
||||
if (count($listwarehouses) > 1) {
|
||||
print '<br>'.$langs->trans("ForceTo").' '.$form->selectarray('fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 1, 0, 0, '', 0, 0, $disabled);
|
||||
} elseif (count($listwarehouses) == 1)
|
||||
{
|
||||
} elseif (count($listwarehouses) == 1) {
|
||||
print '<br>'.$langs->trans("ForceTo").' '.$form->selectarray('fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 0, 0, 0, '', 0, 0, $disabled);
|
||||
}
|
||||
|
||||
|
||||
@ -1716,14 +1716,12 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// when payment condition is empty (means not override by payment condition form a other object, like third-party), try to use default value
|
||||
if(empty($cond_reglement_id))
|
||||
{
|
||||
if (empty($cond_reglement_id)) {
|
||||
$cond_reglement_id = GETPOST("cond_reglement_id");
|
||||
}
|
||||
|
||||
// when payment mode is empty (means not override by payment condition form a other object, like third-party), try to use default value
|
||||
if(empty($mode_reglement_id))
|
||||
{
|
||||
if (empty($mode_reglement_id)) {
|
||||
$mode_reglement_id = GETPOST("mode_reglement_id");
|
||||
}
|
||||
|
||||
|
||||
@ -2040,7 +2040,7 @@ function top_menu_quickadd()
|
||||
|
||||
if (! empty($conf->service->enabled) && $user->rights->service->creer) {
|
||||
$langs->load("products");
|
||||
$dropDownQuickAddHtml.= '
|
||||
$dropDownQuickAddHtml .= '
|
||||
<!-- Service link -->
|
||||
<div class="quickaddblock center">
|
||||
<a class="quickadddropdown-icon-link" href="'.DOL_URL_ROOT.'/product/card.php?action=create&type=1" title="'.$langs->trans("NewService").'">
|
||||
@ -2054,20 +2054,18 @@ function top_menu_quickadd()
|
||||
// Execute hook printTopRightMenu (hooks should output string like '<div class="login"><a href="">mylink</a></div>')
|
||||
$parameters = array();
|
||||
$result = $hookmanager->executeHooks('printQuickAddBlock', $parameters); // Note that $action and $object may have been modified by some hooks
|
||||
if (is_numeric($result))
|
||||
{
|
||||
if ($result == 0)
|
||||
if (is_numeric($result)) {
|
||||
if ($result == 0) {
|
||||
$dropDownQuickAddHtml.= $hookmanager->resPrint; // add
|
||||
else
|
||||
} else {
|
||||
$dropDownQuickAddHtml = $hookmanager->resPrint; // replace
|
||||
}
|
||||
else
|
||||
{
|
||||
$dropDownQuickAddHtml.= $result; // For backward compatibility
|
||||
}
|
||||
} else {
|
||||
$dropDownQuickAddHtml .= $result; // For backward compatibility
|
||||
}
|
||||
|
||||
$dropDownQuickAddHtml.= '</div>';
|
||||
$dropDownQuickAddHtml.= '</div>';
|
||||
$dropDownQuickAddHtml .= '</div>';
|
||||
$dropDownQuickAddHtml .= '</div>';
|
||||
|
||||
$html.= '<!-- div for quick add link -->
|
||||
<div id="topmenu-quickadd-dropdown" class="atoplogin dropdown inline-block">
|
||||
|
||||
@ -1672,9 +1672,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
// Fiche en mode visu
|
||||
else {
|
||||
} else {
|
||||
// Fiche en mode visu
|
||||
$showbarcode = empty($conf->barcode->enabled) ? 0 : 1;
|
||||
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode = 0;
|
||||
|
||||
|
||||
@ -1603,9 +1603,8 @@ class Product extends CommonObject
|
||||
if (isset($this->multiprices_recuperableonly[$thirdparty_buyer->price_level])) $tva_npr = $this->multiprices_recuperableonly[$thirdparty_buyer->price_level];
|
||||
if (empty($tva_tx)) $tva_npr = 0;
|
||||
}
|
||||
}
|
||||
// If price per customer
|
||||
elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||
} elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||
// If price per customer
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php';
|
||||
|
||||
$prodcustprice = new Productcustomerprice($db);
|
||||
@ -1624,14 +1623,12 @@ class Product extends CommonObject
|
||||
if (empty($tva_tx)) $tva_npr = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
// If price per quantity
|
||||
elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) {
|
||||
if ($this->prices_by_qty[0]) // yes, this product has some prices per quantity
|
||||
{
|
||||
} elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) {
|
||||
// If price per quantity
|
||||
if ($this->prices_by_qty[0]) {
|
||||
// yes, this product has some prices per quantity
|
||||
// Search price into product_price_by_qty from $this->id
|
||||
foreach ($this->prices_by_qty_list[0] as $priceforthequantityarray)
|
||||
{
|
||||
foreach ($this->prices_by_qty_list[0] as $priceforthequantityarray) {
|
||||
if ($priceforthequantityarray['rowid'] != $pqp) continue;
|
||||
// We found the price
|
||||
if ($priceforthequantityarray['price_base_type'] == 'HT')
|
||||
@ -1643,11 +1640,10 @@ class Product extends CommonObject
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// If price per quantity and customer
|
||||
elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
|
||||
if ($this->prices_by_qty[$thirdparty_buyer->price_level]) // yes, this product has some prices per quantity
|
||||
{
|
||||
} elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
|
||||
// If price per quantity and customer
|
||||
if ($this->prices_by_qty[$thirdparty_buyer->price_level]) {
|
||||
// yes, this product has some prices per quantity
|
||||
// Search price into product_price_by_qty from $this->id
|
||||
foreach ($this->prices_by_qty_list[$thirdparty_buyer->price_level] as $priceforthequantityarray)
|
||||
{
|
||||
@ -3777,9 +3773,8 @@ class Product extends CommonObject
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// If the supplier price already exists for this product and quantity
|
||||
else {
|
||||
} else {
|
||||
// If the supplier price already exists for this product and quantity
|
||||
$this->product_fourn_price_id = $obj->rowid;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user