Merge branch '14.0up' into 14.0
This commit is contained in:
commit
8c969c7765
@ -614,7 +614,6 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/scripts`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/src`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/test`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/php-iban/docs`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/sabre/sabre/*/tests`;
|
||||
|
||||
@ -235,10 +235,18 @@ if ($action != 'export_csv') {
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
$button = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
|
||||
|
||||
if (empty($reshook)) {
|
||||
$button = '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
|
||||
$button .= '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
|
||||
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
|
||||
@ -763,12 +763,19 @@ if (count($filter)) {
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
$newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
|
||||
|
||||
if (empty($reshook)) {
|
||||
// Button re-export
|
||||
if (!empty($conf->global->ACCOUNTING_REEXPORT)) {
|
||||
$newcardbutton = '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=0'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Activated"), 'switch_on').'</a> ';
|
||||
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=0'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Activated"), 'switch_on').'</a> ';
|
||||
} else {
|
||||
$newcardbutton = '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a> ';
|
||||
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a> ';
|
||||
}
|
||||
$newcardbutton .= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>';
|
||||
|
||||
|
||||
@ -474,8 +474,15 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
$newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
|
||||
|
||||
if (empty($reshook)) {
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbysubaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create');
|
||||
|
||||
@ -474,8 +474,15 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
$newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
|
||||
|
||||
if (empty($reshook)) {
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbysubaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create');
|
||||
|
||||
@ -657,9 +657,12 @@ class AccountancyExport
|
||||
|
||||
/**
|
||||
* Export format : WinFic - eWinfic - WinSis Compta
|
||||
* Last review for this format : 2022-11-01 Alexandre Spangaro (aspangaro@open-dsi.fr)
|
||||
*
|
||||
* Help : https://wiki.gestan.fr/lib/exe/fetch.php?media=wiki:v15:compta:accountancy-format_winfic-ewinfic-winsiscompta.pdf
|
||||
*
|
||||
* @param array $TData data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function exportWinfic(&$TData)
|
||||
@ -667,10 +670,14 @@ class AccountancyExport
|
||||
global $conf;
|
||||
|
||||
$end_line = "\r\n";
|
||||
$index = 1;
|
||||
|
||||
//We should use dol_now function not time however this is wrong date to transfert in accounting
|
||||
//$date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
||||
//$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
||||
|
||||
// Warning ! When truncation is necessary, no dot because 3 dots = three characters. The columns are shifted
|
||||
|
||||
foreach ($TData as $data) {
|
||||
$code_compta = $data->numero_compte;
|
||||
if (!empty($data->subledger_account)) {
|
||||
@ -679,7 +686,7 @@ class AccountancyExport
|
||||
|
||||
$Tab = array();
|
||||
//$Tab['type_ligne'] = 'M';
|
||||
$Tab['code_journal'] = str_pad(self::trunc($data->code_journal, 2), 2);
|
||||
$Tab['code_journal'] = str_pad(dol_trunc($data->code_journal, 2, 'right', 'UTF-8', 1), 2);
|
||||
|
||||
//We use invoice date $data->doc_date not $date_ecriture which is the transfert date
|
||||
//maybe we should set an option for customer who prefer to keep in accounting software the tranfert date instead of invoice date ?
|
||||
@ -688,11 +695,11 @@ class AccountancyExport
|
||||
|
||||
$Tab['folio'] = ' 1';
|
||||
|
||||
$Tab['num_ecriture'] = str_pad(self::trunc($data->piece_num, 6), 6, ' ', STR_PAD_LEFT);
|
||||
$Tab['num_ecriture'] = str_pad(dol_trunc($index, 6, 'right', 'UTF-8', 1), 6, ' ', STR_PAD_LEFT);
|
||||
|
||||
$Tab['jour_ecriture'] = dol_print_date($data->doc_date, '%d%m%y');
|
||||
|
||||
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 6), 6, '0');
|
||||
$Tab['num_compte'] = str_pad(dol_trunc($code_compta, 6, 'right', 'UTF-8', 1), 6, '0');
|
||||
|
||||
if ($data->sens == 'D') {
|
||||
$Tab['montant_debit'] = str_pad(number_format($data->debit, 2, ',', ''), 13, ' ', STR_PAD_LEFT);
|
||||
@ -704,11 +711,11 @@ class AccountancyExport
|
||||
$Tab['montant_crebit'] = str_pad(number_format($data->credit, 2, ',', ''), 13, ' ', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30), 30);
|
||||
$Tab['libelle_ecriture'] = str_pad(dol_trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30, 'right', 'UTF-8', 1), 30);
|
||||
|
||||
$Tab['lettrage'] = str_repeat(' ', 2);
|
||||
$Tab['lettrage'] = str_repeat(dol_trunc($data->lettering_code, 2, 'left', 'UTF-8', 1), 2);
|
||||
|
||||
$Tab['code_piece'] = str_repeat(' ', 5);
|
||||
$Tab['code_piece'] = str_pad(dol_trunc($data->piece_num, 5, 'left', 'UTF-8', 1), 5, ' ', STR_PAD_LEFT);
|
||||
|
||||
$Tab['code_stat'] = str_repeat(' ', 4);
|
||||
|
||||
@ -732,6 +739,8 @@ class AccountancyExport
|
||||
$Tab['end_line'] = $end_line;
|
||||
|
||||
print implode('|', $Tab);
|
||||
|
||||
$index++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2319,7 +2319,7 @@ class Adherent extends CommonObject
|
||||
$labelStatus = $langs->trans("MemberStatusDraft");
|
||||
$labelStatusShort = $langs->trans("MemberStatusDraftShort");
|
||||
} elseif ($status >= self::STATUS_VALIDATED) {
|
||||
if ($need_subscription == 0) {
|
||||
if ($need_subscription === 0) {
|
||||
$statusType = 'status4';
|
||||
$labelStatus = $langs->trans("MemberStatusNoSubscription");
|
||||
$labelStatusShort = $langs->trans("MemberStatusNoSubscriptionShort");
|
||||
|
||||
@ -382,14 +382,18 @@ class Members extends DolibarrApi
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if (!$member->delete($member->id, DolibarrApiAccess::$user)) {
|
||||
throw new RestException(401, 'error when deleting member');
|
||||
|
||||
$res = $member->delete($member->id, DolibarrApiAccess::$user);
|
||||
if ($res < 0) {
|
||||
throw new RestException(500, "Can't delete, error occurs");
|
||||
} elseif ($res == 0) {
|
||||
throw new RestException(409, "Can't delete, that product is probably used");
|
||||
}
|
||||
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'member deleted'
|
||||
'message' => 'Member deleted'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -228,14 +228,17 @@ class MembersTypes extends DolibarrApi
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if (!$membertype->delete()) {
|
||||
throw new RestException(401, 'error when deleting member type');
|
||||
$res = $membertype->delete();
|
||||
if ($res < 0) {
|
||||
throw new RestException(500, "Can't delete, error occurs");
|
||||
} elseif ($res == 0) {
|
||||
throw new RestException(409, "Can't delete, that product is probably used");
|
||||
}
|
||||
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'member type deleted'
|
||||
'message' => 'Member type deleted'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -214,14 +214,17 @@ class Subscriptions extends DolibarrApi
|
||||
throw new RestException(404, 'Subscription not found');
|
||||
}
|
||||
|
||||
if (!$subscription->delete(DolibarrApiAccess::$user)) {
|
||||
throw new RestException(401, 'error when deleting subscription');
|
||||
$res = $subscription->delete(DolibarrApiAccess::$user);
|
||||
if ($res < 0) {
|
||||
throw new RestException(500, "Can't delete, error occurs");
|
||||
} elseif ($res == 0) {
|
||||
throw new RestException(409, "Can't delete, that product is probably used");
|
||||
}
|
||||
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'subscription deleted'
|
||||
'message' => 'Subscription deleted'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -911,7 +911,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) {
|
||||
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
setEventMessages($db->error(), null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -462,6 +462,9 @@ class Documents extends DolibarrApi
|
||||
throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.');
|
||||
}
|
||||
|
||||
$objectType = $modulepart;
|
||||
if (! empty($object->id) && ! empty($object->table_element)) $objectType = $object->table_element;
|
||||
|
||||
$filearray = dol_dir_list($upload_dir, $type, $recursive, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
|
||||
if (empty($filearray)) {
|
||||
throw new RestException(404, 'Search for modulepart '.$modulepart.' with Id '.$object->id.(!empty($object->ref) ? ' or Ref '.$object->ref : '').' does not return any document.');
|
||||
@ -469,11 +472,14 @@ class Documents extends DolibarrApi
|
||||
if (($object->id) > 0 && !empty($modulepart)) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/ecm/class/ecmfiles.class.php';
|
||||
$ecmfile = new EcmFiles($this->db);
|
||||
$result = $ecmfile->fetchAll('', '', 0, 0, array('t.src_object_type' => $modulepart, 't.src_object_id' => $object->id));
|
||||
$result = $ecmfile->fetchAll('', '', 0, 0, array('t.src_object_type' => $objectType, 't.src_object_id' => $object->id));
|
||||
if ($result < 0) {
|
||||
throw new RestException(503, 'Error when retrieve ecm list : ' . $this->db->lasterror());
|
||||
} elseif (is_array($ecmfile->lines) && count($ecmfile->lines) > 0) {
|
||||
$filearray['ecmfiles_infos'] = $ecmfile->lines;
|
||||
$count = count($filearray);
|
||||
for ($i = 0 ; $i < $count ; $i++) {
|
||||
if ($filearray[$i]['name'] == $ecmfile->lines[$i]->filename) $filearray[$i] = array_merge($filearray[$i], (array) $ecmfile->lines[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ foreach ($tmptype2label as $key => $val) {
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$attrname = GETPOST('attrname', 'alpha');
|
||||
$elementtype = 'don'; //Must be the $table_element of the class that manage extrafield
|
||||
$elementtype = 'asset'; //Must be the $table_element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
|
||||
@ -44,7 +44,7 @@ $thirdpartytmp = new Societe($db);
|
||||
|
||||
$modBarCodeProduct = '';
|
||||
|
||||
$maxperinit = 1000;
|
||||
$maxperinit = empty($conf->global->BARCODE_INIT_MAX) ? 1000 : $conf->global->BARCODE_INIT_MAX;
|
||||
|
||||
|
||||
/*
|
||||
@ -64,14 +64,16 @@ if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) {
|
||||
if (preg_match('/^mod_barcode_product_.*php$/', $file)) {
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
try {
|
||||
dol_include_once($dirroot.$file.'.php');
|
||||
} catch (Exception $e) {
|
||||
dol_syslog($e->getMessage(), LOG_ERR);
|
||||
}
|
||||
if ($file == $conf->global->BARCODE_PRODUCT_ADDON_NUM) {
|
||||
try {
|
||||
dol_include_once($dirroot.$file.'.php');
|
||||
} catch (Exception $e) {
|
||||
dol_syslog($e->getMessage(), LOG_ERR);
|
||||
}
|
||||
|
||||
$modBarCodeProduct = new $file();
|
||||
break;
|
||||
$modBarCodeProduct = new $file();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
|
||||
@ -508,9 +508,10 @@ if (empty($reshook)) {
|
||||
exit;
|
||||
}
|
||||
$mesgs[] = $object->error;
|
||||
$mesgs = array_merge($mesgs, $object->errors);
|
||||
}
|
||||
|
||||
setEventMessages(null, $mesgs, 'errors');
|
||||
setEventMessages('', $mesgs, 'errors');
|
||||
$action = "create";
|
||||
}
|
||||
|
||||
@ -595,9 +596,10 @@ if (empty($reshook)) {
|
||||
exit;
|
||||
}
|
||||
$mesgs[] = $object->error;
|
||||
$mesgs = array_merge($mesgs, $object->errors);
|
||||
}
|
||||
|
||||
setEventMessages($mesg, $mesgs, 'errors');
|
||||
setEventMessages('', $mesgs, 'errors');
|
||||
$action = "edit";
|
||||
} else {
|
||||
$action = "edit";
|
||||
|
||||
@ -1635,13 +1635,13 @@ if ($action == 'create') {
|
||||
// Terms of payment
|
||||
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
|
||||
print img_picto('', 'paiment');
|
||||
$form->select_conditions_paiements((GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id), 'cond_reglement_id', -1, 1);
|
||||
$form->select_conditions_paiements(((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id', 'int') > 0) ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id), 'cond_reglement_id', -1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Mode of payment
|
||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>';
|
||||
print img_picto('', 'bank').' ';
|
||||
$form->select_types_paiements((GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id', 'int') : $soc->mode_reglement_id), 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx');
|
||||
$form->select_types_paiements(((GETPOSTISSET('mode_reglement_id') && GETPOST('mode_reglement_id', 'int') > 0) ? GETPOST('mode_reglement_id', 'int') : $soc->mode_reglement_id), 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx');
|
||||
print '</td></tr>';
|
||||
|
||||
// Bank Account
|
||||
|
||||
@ -93,9 +93,6 @@ class PropaleStats extends Stats
|
||||
}
|
||||
//$this->where.= " AND p.fk_soc = s.rowid AND p.entity = ".$conf->entity;
|
||||
$this->where .= ($this->where ? ' AND ' : '')."p.entity IN (".getEntity('propal').")";
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
$this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($this->socid) {
|
||||
$this->where .= " AND p.fk_soc = ".((int) $this->socid);
|
||||
}
|
||||
@ -130,7 +127,7 @@ class PropaleStats extends Stats
|
||||
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, COUNT(*) as nb";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= $this->join;
|
||||
$sql .= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
@ -155,7 +152,7 @@ class PropaleStats extends Stats
|
||||
$sql = "SELECT date_format(".$this->field_date.",'%Y') as dm, COUNT(*) as nb, SUM(c.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= $this->join;
|
||||
$sql .= " WHERE ".$this->where;
|
||||
@ -179,7 +176,7 @@ class PropaleStats extends Stats
|
||||
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, SUM(p.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= $this->join;
|
||||
$sql .= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
@ -204,7 +201,7 @@ class PropaleStats extends Stats
|
||||
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, AVG(p.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= $this->join;
|
||||
$sql .= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
@ -227,7 +224,7 @@ class PropaleStats extends Stats
|
||||
$sql = "SELECT date_format(".$this->field_date.",'%Y') as year, COUNT(*) as nb, SUM(".$this->field.") as total, AVG(".$this->field.") as avg";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= $this->join;
|
||||
$sql .= " WHERE ".$this->where;
|
||||
@ -253,7 +250,7 @@ class PropaleStats extends Stats
|
||||
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
|
||||
$sql .= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= $this->join;
|
||||
$sql .= " WHERE ".$this->where;
|
||||
|
||||
@ -1281,6 +1281,7 @@ class Commande extends CommonOrder
|
||||
{
|
||||
global $conf, $hookmanager;
|
||||
|
||||
dol_include_once('/multicurrency/class/multicurrency.class.php');
|
||||
dol_include_once('/core/class/extrafields.class.php');
|
||||
|
||||
$error = 0;
|
||||
@ -1355,6 +1356,29 @@ class Commande extends CommonOrder
|
||||
$this->origin = $object->element;
|
||||
$this->origin_id = $object->id;
|
||||
|
||||
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (!empty($object->multicurrency_code)) {
|
||||
$this->multicurrency_code = $object->multicurrency_code;
|
||||
}
|
||||
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($object->multicurrency_tx)) {
|
||||
$this->multicurrency_tx = $object->multicurrency_tx;
|
||||
}
|
||||
|
||||
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) {
|
||||
$tmparray = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date_commande);
|
||||
$this->fk_multicurrency = $tmparray[0];
|
||||
$this->multicurrency_tx = $tmparray[1];
|
||||
} else {
|
||||
$this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
|
||||
}
|
||||
if (empty($this->fk_multicurrency)) {
|
||||
$this->multicurrency_code = $conf->currency;
|
||||
$this->fk_multicurrency = 0;
|
||||
$this->multicurrency_tx = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// get extrafields from original line
|
||||
$object->fetch_optionals();
|
||||
|
||||
|
||||
@ -93,9 +93,6 @@ class CommandeStats extends Stats
|
||||
//$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity;
|
||||
$this->where .= ($this->where ? ' AND ' : '').'c.entity IN ('.getEntity('commande').')';
|
||||
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
$this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($this->socid) {
|
||||
$this->where .= " AND c.fk_soc = ".((int) $this->socid);
|
||||
}
|
||||
@ -129,7 +126,7 @@ class CommandeStats extends Stats
|
||||
$sql = "SELECT date_format(c.date_commande,'%m') as dm, COUNT(*) as nb";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= $this->join;
|
||||
$sql .= " WHERE c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
@ -154,7 +151,7 @@ class CommandeStats extends Stats
|
||||
$sql = "SELECT date_format(c.date_commande,'%Y') as dm, COUNT(*) as nb, SUM(c.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= $this->join;
|
||||
$sql .= " WHERE ".$this->where;
|
||||
@ -178,7 +175,7 @@ class CommandeStats extends Stats
|
||||
$sql = "SELECT date_format(c.date_commande,'%m') as dm, SUM(c.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= $this->join;
|
||||
$sql .= " WHERE c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
@ -203,7 +200,7 @@ class CommandeStats extends Stats
|
||||
$sql = "SELECT date_format(c.date_commande,'%m') as dm, AVG(c.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= $this->join;
|
||||
$sql .= " WHERE c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
@ -226,7 +223,7 @@ class CommandeStats extends Stats
|
||||
$sql = "SELECT date_format(c.date_commande,'%Y') as year, COUNT(*) as nb, SUM(c.".$this->field.") as total, AVG(".$this->field.") as avg";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= $this->join;
|
||||
$sql .= " WHERE ".$this->where;
|
||||
@ -250,7 +247,7 @@ class CommandeStats extends Stats
|
||||
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
|
||||
$sql .= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= $this->join;
|
||||
$sql .= " WHERE ".$this->where;
|
||||
|
||||
@ -650,6 +650,7 @@ if ($result) {
|
||||
|
||||
// Accounting account
|
||||
if ($arrayfields['account']['checked']) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
$accountingaccount->fetch('', $obj->accountancy_code, 1);
|
||||
|
||||
print '<td>'.$accountingaccount->getNomUrl(0, 1, 1, '', 1).'</td>';
|
||||
|
||||
@ -2928,6 +2928,11 @@ if ($action == 'create') {
|
||||
$remise_percent = (!empty($expesrc->remise_percent) ? $expesrc->remise_percent : (!empty($soc->remise_percent) ? $soc->remise_percent : 0));
|
||||
$remise_absolue = (!empty($expesrc->remise_absolue) ? $expesrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
|
||||
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
$currency_code = (!empty($expesrc->multicurrency_code) ? $expesrc->multicurrency_code : (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : $objectsrc->multicurrency_code));
|
||||
$currency_tx = (!empty($expesrc->multicurrency_tx) ? $expesrc->multicurrency_tx : (!empty($soc->multicurrency_tx) ? $soc->multicurrency_tx : $objectsrc->multicurrency_tx));
|
||||
}
|
||||
|
||||
//Replicate extrafields
|
||||
$expesrc->fetch_optionals();
|
||||
$object->array_options = $expesrc->array_options;
|
||||
@ -4512,13 +4517,13 @@ if ($action == 'create') {
|
||||
print '<table id="retained-warranty-table" class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('RetainedWarranty');
|
||||
print '</td>';
|
||||
if ($action != 'editretainedwarranty' && $user->rights->facture->creer) {
|
||||
if ($action != 'editretainedwarranty' && $user->rights->facture->creer && $object->statut == Facture::STATUS_DRAFT) {
|
||||
print '<td align="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editretainedwarranty&facid='.$object->id.'">'.img_edit($langs->trans('setretainedwarranty'), 1).'</a></td>';
|
||||
}
|
||||
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editretainedwarranty') {
|
||||
if ($action == 'editretainedwarranty' && $object->statut == Facture::STATUS_DRAFT) {
|
||||
print '<form id="retained-warranty-form" method="POST" action="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'">';
|
||||
print '<input type="hidden" name="action" value="setretainedwarranty">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
@ -4535,7 +4540,7 @@ if ($action == 'create') {
|
||||
print '<table id="retained-warranty-cond-reglement-table" class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentConditionsShortRetainedWarranty');
|
||||
print '</td>';
|
||||
if ($action != 'editretainedwarrantypaymentterms' && $user->rights->facture->creer) {
|
||||
if ($action != 'editretainedwarrantypaymentterms' && $user->rights->facture->creer && $object->statut == Facture::STATUS_DRAFT) {
|
||||
print '<td align="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editretainedwarrantypaymentterms&facid='.$object->id.'">'.img_edit($langs->trans('setPaymentConditionsShortRetainedWarranty'), 1).'</a></td>';
|
||||
}
|
||||
|
||||
@ -4546,7 +4551,7 @@ if ($action == 'create') {
|
||||
$defaultDate = $object->date;
|
||||
}
|
||||
|
||||
if ($action == 'editretainedwarrantypaymentterms') {
|
||||
if ($action == 'editretainedwarrantypaymentterms' && $object->statut == Facture::STATUS_DRAFT) {
|
||||
//date('Y-m-d',$object->date_lim_reglement)
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'">';
|
||||
print '<input type="hidden" name="action" value="setretainedwarrantyconditions">';
|
||||
@ -4570,7 +4575,7 @@ if ($action == 'create') {
|
||||
print '<table id="retained-warranty-date-limit-table" class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('RetainedWarrantyDateLimit');
|
||||
print '</td>';
|
||||
if ($action != 'editretainedwarrantydatelimit' && $user->rights->facture->creer) {
|
||||
if ($action != 'editretainedwarrantydatelimit' && $user->rights->facture->creer && $object->statut == Facture::STATUS_DRAFT) {
|
||||
print '<td align="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editretainedwarrantydatelimit&facid='.$object->id.'">'.img_edit($langs->trans('setretainedwarrantyDateLimit'), 1).'</a></td>';
|
||||
}
|
||||
|
||||
@ -4581,7 +4586,7 @@ if ($action == 'create') {
|
||||
$defaultDate = $object->date;
|
||||
}
|
||||
|
||||
if ($action == 'editretainedwarrantydatelimit') {
|
||||
if ($action == 'editretainedwarrantydatelimit' && $object->statut == Facture::STATUS_DRAFT) {
|
||||
//date('Y-m-d',$object->date_lim_reglement)
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'">';
|
||||
print '<input type="hidden" name="action" value="setretainedwarrantydatelimit">';
|
||||
|
||||
@ -386,6 +386,9 @@ if ($resql) {
|
||||
if (!empty($limit)) {
|
||||
print '<input type="hidden" name="limit" value="'.$limit.'"/>';
|
||||
}
|
||||
if ($type != '') {
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
}
|
||||
|
||||
$title = $langs->trans("InvoiceWaitingWithdraw");
|
||||
if ($type == 'bank-transfer') {
|
||||
|
||||
@ -191,6 +191,9 @@ if ($result) {
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
if ($type != '') {
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
}
|
||||
|
||||
$title = $langs->trans("WithdrawalsLines");
|
||||
if ($type == 'bank-transfer') {
|
||||
|
||||
@ -158,7 +158,9 @@ if ($result) {
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
if ($type != '') {
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
}
|
||||
$titlekey = "WithdrawalsReceipts";
|
||||
$title = $langs->trans("WithdrawalsReceipts");
|
||||
if ($type == 'bank-transfer') {
|
||||
|
||||
@ -152,7 +152,7 @@ if (empty($_SESSION['auto_check_events_not_before']) || $time >= $_SESSION['auto
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_reminder as ar ON a.id = ar.fk_actioncomm AND ar.fk_user = '.$user->id;
|
||||
$sql .= ' WHERE a.code <> "AC_OTH_AUTO"';
|
||||
$sql .= ' AND (';
|
||||
$sql .= " (ar.typeremind = 'browser' AND ar.dateremind < '".$db->idate(dol_now())."' AND ar.status = 0 AND ar.entity = ".$conf->entity;
|
||||
$sql .= " ar.typeremind = 'browser' AND ar.dateremind < '".$db->idate(dol_now())."' AND ar.status = 0 AND ar.entity = ".$conf->entity;
|
||||
$sql .= ' )';
|
||||
} else {
|
||||
$sql .= ' JOIN '.MAIN_DB_PREFIX.'actioncomm_reminder as ar ON a.id = ar.fk_actioncomm AND ar.fk_user = '.$user->id;
|
||||
|
||||
@ -2072,7 +2072,7 @@ abstract class CommonObject
|
||||
$sql .= " AND te.entity IS NOT NULL"; // Show all users
|
||||
} else {
|
||||
$sql .= " AND ug.fk_user = te.rowid";
|
||||
$sql .= " AND ug.entity IN (".getEntity($this->element).")";
|
||||
$sql .= " AND ug.entity IN (".getEntity('usergroup').")";
|
||||
}
|
||||
} else {
|
||||
$sql .= ' AND te.entity IN ('.getEntity($this->element).')';
|
||||
@ -2142,7 +2142,7 @@ abstract class CommonObject
|
||||
$sql .= " AND te.entity IS NOT NULL"; // Show all users
|
||||
} else {
|
||||
$sql .= " AND ug.fk_user = te.rowid";
|
||||
$sql .= " AND ug.entity IN (".getEntity($this->element).")";
|
||||
$sql .= " AND ug.entity IN (".getEntity('usergroup').")";
|
||||
}
|
||||
} else {
|
||||
$sql .= ' AND te.entity IN ('.getEntity($this->element).')';
|
||||
@ -3490,7 +3490,9 @@ abstract class CommonObject
|
||||
}
|
||||
$sqlfix = "UPDATE ".MAIN_DB_PREFIX.$this->table_element_line." SET ".$fieldtva." = ".($obj->total_tva - $diff).", total_ttc = ".($obj->total_ttc - $diff)." WHERE rowid = ".$obj->rowid;
|
||||
dol_syslog('We found a difference of '.$diff.' for line rowid = '.$obj->rowid.". We fix the total_vat and total_ttc of line by running sqlfix = ".$sqlfix);
|
||||
$resqlfix = $this->db->query($sqlfix);
|
||||
|
||||
$resqlfix = $this->db->query($sqlfix);
|
||||
|
||||
if (!$resqlfix) {
|
||||
dol_print_error($this->db, 'Failed to update line');
|
||||
}
|
||||
@ -7540,7 +7542,7 @@ abstract class CommonObject
|
||||
|
||||
if ($display_type == 'card') {
|
||||
$out .= '<tr '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="valuefieldcreate '.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.(!empty($this->id)?'_'.$this->id:'').'" '.$domData.' >';
|
||||
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER) && ($action == 'view' || $action == 'valid' || $action == 'editline')) {
|
||||
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER) && ($action == 'view' || $action == 'valid' || $action == 'editline' || $action == 'confirm_valid' || $action == 'confirm_cancel')) {
|
||||
$out .= '<td></td>';
|
||||
}
|
||||
$out .= '<td class="wordbreak';
|
||||
|
||||
@ -2084,13 +2084,21 @@ class ExtraFields
|
||||
|
||||
$enabled = 1;
|
||||
if (isset($this->attributes[$object->table_element]['list'][$key])) {
|
||||
$enabled = dol_eval($this->attributes[$object->table_element]['list'][$key], 1);
|
||||
$enabled = intval(dol_eval($this->attributes[$object->table_element]['list'][$key], 1));
|
||||
}
|
||||
$perms = 1;
|
||||
if (isset($this->attributes[$object->table_element]['perms'][$key])) {
|
||||
$perms = dol_eval($this->attributes[$object->table_element]['perms'][$key], 1);
|
||||
}
|
||||
if (empty($enabled)) {
|
||||
if (
|
||||
empty($enabled)
|
||||
|| (
|
||||
$onlykey === '@GETPOSTISSET'
|
||||
&& in_array($this->attributes[$object->table_element]['type'][$key], array('boolean', 'chkbxlst'))
|
||||
&& in_array(abs($enabled), array(2, 5))
|
||||
&& ! GETPOSTISSET('options_' . $key) // Update hidden checkboxes and multiselect only if they are provided
|
||||
)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
if (empty($perms)) {
|
||||
|
||||
@ -127,12 +127,14 @@ class FormTicket
|
||||
/**
|
||||
* Show the form to input ticket
|
||||
*
|
||||
* @param int $withdolfichehead With dol_get_fiche_head() and dol_get_fiche_end()
|
||||
* @param string $mode Mode ('create' or 'edit')
|
||||
* @param int $public 1=If we show the form for the public interface
|
||||
* @param int $withdolfichehead With dol_get_fiche_head() and dol_get_fiche_end()
|
||||
* @param string $mode Mode ('create' or 'edit')
|
||||
* @param int $public 1=If we show the form for the public interface
|
||||
* @param Contact|null $with_contact [=NULL] Contact to link to this ticket if exists
|
||||
* @param string $action [=''] Action in card
|
||||
* @return void
|
||||
*/
|
||||
public function showForm($withdolfichehead = 0, $mode = 'edit', $public = 0)
|
||||
public function showForm($withdolfichehead = 0, $mode = 'edit', $public = 0, Contact $with_contact = null, $action = '')
|
||||
{
|
||||
global $conf, $langs, $user, $hookmanager;
|
||||
|
||||
@ -441,7 +443,7 @@ class FormTicket
|
||||
|
||||
// Other attributes
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $ticketstat, $this->action); // Note that $action and $object may have been modified by hook
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $ticketstat, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) {
|
||||
print $ticketstat->showOptionals($extrafields, 'create');
|
||||
}
|
||||
|
||||
@ -1182,7 +1182,7 @@ class DoliDBPgsql extends DoliDB
|
||||
// phpcs:enable
|
||||
$sql = "ALTER TABLE ".$table;
|
||||
$sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type'];
|
||||
if (in_array($field_desc['type'], array('double', 'tinyint', 'int', 'varchar')) && $field_desc['value']) {
|
||||
if (in_array($field_desc['type'], array('double', 'varchar')) && $field_desc['value']) {
|
||||
$sql .= "(".$field_desc['value'].")";
|
||||
}
|
||||
|
||||
|
||||
@ -3724,7 +3724,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
// Add CSS
|
||||
$arrayconvpictotomorcess = array(
|
||||
'action'=>'infobox-action', 'account'=>'infobox-bank_account', 'accountline'=>'infobox-bank_account', 'accountancy'=>'infobox-bank_account', 'asset'=>'infobox-bank_account',
|
||||
'bank_account'=>'bg-infobox-bank_account',
|
||||
'bank_account'=>'infobox-bank_account',
|
||||
'bill'=>'infobox-commande', 'billa'=>'infobox-commande', 'billr'=>'infobox-commande', 'billd'=>'infobox-commande',
|
||||
'margin'=>'infobox-bank_account', 'conferenceorbooth'=>'infobox-project',
|
||||
'cash-register'=>'infobox-bank_account', 'contract'=>'infobox-contrat', 'check'=>'font-status4', 'collab'=>'infobox-action', 'conversation'=>'infobox-contrat',
|
||||
@ -6996,7 +6996,11 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
||||
$substitutionarray['__REF_SUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null);
|
||||
$substitutionarray['__NOTE_PUBLIC__'] = (isset($object->note_public) ? $object->note_public : null);
|
||||
$substitutionarray['__NOTE_PRIVATE__'] = (isset($object->note_private) ? $object->note_private : null);
|
||||
$substitutionarray['__DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs) : '');
|
||||
if ($object->element == "shipping") {
|
||||
$substitutionarray['__DATE_DELIVERY__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, 'day', 0, $outputlangs) : '');
|
||||
} else {
|
||||
$substitutionarray['__DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs) : '');
|
||||
}
|
||||
$substitutionarray['__DATE_DELIVERY_DAY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, "%d") : '');
|
||||
$substitutionarray['__DATE_DELIVERY_DAY_TEXT__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, "%A") : '');
|
||||
$substitutionarray['__DATE_DELIVERY_MON__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, "%m") : '');
|
||||
@ -8133,7 +8137,7 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1)
|
||||
}
|
||||
|
||||
// We block using of php exec or php file functions
|
||||
$forbiddenphpstrings = array("exec(", "passthru(", "shell_exec(", "system(", "proc_open(", "popen(", "eval(", "dol_eval(", "executeCLI(");
|
||||
$forbiddenphpstrings = array("exec(", "passthru(", "shell_exec(", "system(", "proc_open(", "popen(", "eval(", "dol_eval(", "executeCLI(", "base64_decode(");
|
||||
$forbiddenphpstrings = array_merge($forbiddenphpstrings, array("fopen(", "file_put_contents(", "fputs(", "fputscsv(", "fwrite(", "fpassthru(", "unlink(", "mkdir(", "rmdir(", "symlink(", "touch(", "umask("));
|
||||
$forbiddenphpstrings = array_merge($forbiddenphpstrings, array('function(', '$$', 'call_user_func('));
|
||||
$forbiddenphpstrings = array_merge($forbiddenphpstrings, array('_ENV', '_SESSION', '_COOKIE', '_GET', '_POST', '_REQUEST'));
|
||||
|
||||
@ -1215,7 +1215,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
|
||||
} elseif ($yearlen == 2) {
|
||||
$yearcomp = sprintf("%02d", date("y", $date) + $yearoffset);
|
||||
} elseif ($yearlen == 1) {
|
||||
$yearcomp = substr(date("y", $date), 2, 1) + $yearoffset;
|
||||
$yearcomp = substr(date('y', $date), 1, 1) + $yearoffset;
|
||||
}
|
||||
if ($monthcomp > 1 && empty($resetEveryMonth)) { // Test with month is useless if monthcomp = 0 or 1 (0 is same as 1) (regis: $monthcomp can't equal 0)
|
||||
if ($yearlen == 4) {
|
||||
|
||||
@ -567,7 +567,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
|
||||
// Total HT line
|
||||
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN)) {
|
||||
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs);
|
||||
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->SetXY($this->postotalht, $curY);
|
||||
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0, 'R', 0);
|
||||
}
|
||||
|
||||
@ -733,7 +733,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
|
||||
<?php
|
||||
if (!empty($conf->global->PRODUCT_LOAD_EXTRAFIELD_INTO_OBJECTLINES)) { ?>
|
||||
jQuery.each(data.array_options, function( key, value ) {
|
||||
jQuery('div[class$="det'+key.replace('options_','_extras_')+'"] > #'+key).val(value);
|
||||
jQuery('div[class*="det'+key.replace('options_','_extras_')+'"] > #'+key).val(value);
|
||||
});
|
||||
<?php
|
||||
} ?>
|
||||
|
||||
@ -240,12 +240,9 @@ class EcmFiles extends CommonObject
|
||||
}
|
||||
|
||||
// If ref not defined
|
||||
$ref = '';
|
||||
if (!empty($this->ref)) {
|
||||
$ref = $this->ref;
|
||||
} else {
|
||||
if (empty($this->ref)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
|
||||
$ref = dol_hash($this->filepath.'/'.$this->filename, 3);
|
||||
$this->ref = dol_hash($this->filepath.'/'.$this->filename, 3);
|
||||
}
|
||||
|
||||
$maxposition = 0;
|
||||
@ -300,7 +297,7 @@ class EcmFiles extends CommonObject
|
||||
$sql .= 'src_object_type,';
|
||||
$sql .= 'src_object_id';
|
||||
$sql .= ') VALUES (';
|
||||
$sql .= " '".$this->db->escape($ref)."', ";
|
||||
$sql .= " '".$this->db->escape($this->ref)."', ";
|
||||
$sql .= ' '.(!isset($this->label) ? 'NULL' : "'".$this->db->escape($this->label)."'").',';
|
||||
$sql .= ' '.(!isset($this->share) ? 'NULL' : "'".$this->db->escape($this->share)."'").',';
|
||||
$sql .= ' '.$this->entity.',';
|
||||
|
||||
@ -419,7 +419,11 @@ class ProductFournisseur extends Product
|
||||
$productfournisseurprice->array_options[$key] = $value;
|
||||
}
|
||||
$res = $productfournisseurprice->update($user);
|
||||
if ($res < 0) $error++;
|
||||
if ($res < 0) {
|
||||
$this->error = $productfournisseurprice->error;
|
||||
$this->errors = $productfournisseurprice->errors;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -506,6 +510,7 @@ class ProductFournisseur extends Product
|
||||
if ($resql) {
|
||||
$this->product_fourn_price_id = $this->db->last_insert_id(MAIN_DB_PREFIX."product_fournisseur_price");
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
$error++;
|
||||
}
|
||||
|
||||
@ -518,7 +523,11 @@ class ProductFournisseur extends Product
|
||||
$productfournisseurprice->array_options[$key] = $value;
|
||||
}
|
||||
$res = $productfournisseurprice->update($user);
|
||||
if ($res < 0) $error++;
|
||||
if ($res < 0) {
|
||||
$this->error = $productfournisseurprice->error;
|
||||
$this->errors = $productfournisseurprice->errors;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
||||
*/
|
||||
(function(a){if("undefined"==typeof a)throw Error("jQuery should be loaded before CKEditor jQuery adapter.");if("undefined"==typeof CKEDITOR)throw Error("CKEditor should be loaded before CKEditor jQuery adapter.");CKEDITOR.config.jqueryOverrideVal="undefined"==typeof CKEDITOR.config.jqueryOverrideVal?!0:CKEDITOR.config.jqueryOverrideVal;a.extend(a.fn,{ckeditorGet:function(){var a=this.eq(0).data("ckeditorInstance");if(!a)throw"CKEditor is not initialized yet, use ckeditor() with a callback.";return a},
|
||||
ckeditor:function(g,e){if(!CKEDITOR.env.isCompatible)throw Error("The environment is incompatible.");if(!a.isFunction(g)){var m=e;e=g;g=m}var k=[];e=e||{};this.each(function(){var b=a(this),c=b.data("ckeditorInstance"),f=b.data("_ckeditorInstanceLock"),h=this,l=new a.Deferred;k.push(l.promise());if(c&&!f)g&&g.apply(c,[this]),l.resolve();else if(f)c.once("instanceReady",function(){setTimeout(function d(){c.element?(c.element.$==h&&g&&g.apply(c,[h]),l.resolve()):setTimeout(d,100)},0)},null,null,9999);
|
||||
else{if(e.autoUpdateElement||"undefined"==typeof e.autoUpdateElement&&CKEDITOR.config.autoUpdateElement)e.autoUpdateElementJquery=!0;e.autoUpdateElement=!1;b.data("_ckeditorInstanceLock",!0);c=a(this).is("textarea")?CKEDITOR.replace(h,e):CKEDITOR.inline(h,e);b.data("ckeditorInstance",c);c.on("instanceReady",function(e){var d=e.editor;setTimeout(function n(){if(d.element){e.removeListener();d.on("dataReady",function(){b.trigger("dataReady.ckeditor",[d])});d.on("setData",function(a){b.trigger("setData.ckeditor",
|
||||
[d,a.data])});d.on("getData",function(a){b.trigger("getData.ckeditor",[d,a.data])},999);d.on("destroy",function(){b.trigger("destroy.ckeditor",[d])});d.on("save",function(){a(h.form).submit();return!1},null,null,20);if(d.config.autoUpdateElementJquery&&b.is("textarea")&&a(h.form).length){var c=function(){b.ckeditor(function(){d.updateElement()})};a(h.form).submit(c);a(h.form).bind("form-pre-serialize",c);b.bind("destroy.ckeditor",function(){a(h.form).unbind("submit",c);a(h.form).unbind("form-pre-serialize",
|
||||
c)})}d.on("destroy",function(){b.removeData("ckeditorInstance")});b.removeData("_ckeditorInstanceLock");b.trigger("instanceReady.ckeditor",[d]);g&&g.apply(d,[h]);l.resolve()}else setTimeout(n,100)},0)},null,null,9999)}});var f=new a.Deferred;this.promise=f.promise();a.when.apply(this,k).then(function(){f.resolve()});this.editor=this.eq(0).data("ckeditorInstance");return this}});CKEDITOR.config.jqueryOverrideVal&&(a.fn.val=CKEDITOR.tools.override(a.fn.val,function(g){return function(e){if(arguments.length){var m=
|
||||
this,k=[],f=this.each(function(){var b=a(this),c=b.data("ckeditorInstance");if(b.is("textarea")&&c){var f=new a.Deferred;c.setData(e,function(){f.resolve()});k.push(f.promise());return!0}return g.call(b,e)});if(k.length){var b=new a.Deferred;a.when.apply(this,k).done(function(){b.resolveWith(m)});return b.promise()}return f}var f=a(this).eq(0),c=f.data("ckeditorInstance");return f.is("textarea")&&c?c.getData():g.call(f)}}))})(window.jQuery);
|
||||
@ -22,6 +22,7 @@
|
||||
CREATE TABLE llx_establishment (
|
||||
rowid integer NOT NULL auto_increment PRIMARY KEY,
|
||||
entity integer NOT NULL DEFAULT 1,
|
||||
label varchar(255),
|
||||
ref varchar(30),
|
||||
name varchar(128),
|
||||
address varchar(255),
|
||||
|
||||
@ -220,9 +220,9 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) {
|
||||
print $langs->trans("AdminLoginCreatedSuccessfuly", $login)."<br>";
|
||||
$success = 1;
|
||||
} else {
|
||||
if ($newuser->error == 'ErrorLoginAlreadyExists') {
|
||||
if ($result == -6) { //login or email already exists
|
||||
dolibarr_install_syslog('step5: AdminLoginAlreadyExists', LOG_WARNING);
|
||||
print '<br><div class="warning">'.$langs->trans("AdminLoginAlreadyExists", $login)."</div><br>";
|
||||
print '<br><div class="warning">'.$newuser->error."</div><br>";
|
||||
$success = 1;
|
||||
} else {
|
||||
dolibarr_install_syslog('step5: FailedToCreateAdminLogin '.$newuser->error, LOG_ERR);
|
||||
@ -357,48 +357,50 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) {
|
||||
// Create lock file
|
||||
|
||||
// If first install
|
||||
if ($action == "set" && $success) {
|
||||
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) {
|
||||
// Install is finished
|
||||
print $langs->trans("SystemIsInstalled")."<br>";
|
||||
if ($action == "set") {
|
||||
if ($success) {
|
||||
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) {
|
||||
// Install is finished
|
||||
print $langs->trans("SystemIsInstalled")."<br>";
|
||||
|
||||
$createlock = 0;
|
||||
$createlock = 0;
|
||||
|
||||
if (!empty($force_install_lockinstall) || !empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE)) {
|
||||
// Install is finished, we create the lock file
|
||||
$lockfile = DOL_DATA_ROOT.'/install.lock';
|
||||
$fp = @fopen($lockfile, "w");
|
||||
if ($fp) {
|
||||
if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) {
|
||||
$force_install_lockinstall = 444; // For backward compatibility
|
||||
if (!empty($force_install_lockinstall) || !empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE)) {
|
||||
// Install is finished, we create the lock file
|
||||
$lockfile = DOL_DATA_ROOT.'/install.lock';
|
||||
$fp = @fopen($lockfile, "w");
|
||||
if ($fp) {
|
||||
if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) {
|
||||
$force_install_lockinstall = 444; // For backward compatibility
|
||||
}
|
||||
fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")");
|
||||
fclose($fp);
|
||||
@chmod($lockfile, octdec($force_install_lockinstall));
|
||||
$createlock = 1;
|
||||
}
|
||||
fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")");
|
||||
fclose($fp);
|
||||
@chmod($lockfile, octdec($force_install_lockinstall));
|
||||
$createlock = 1;
|
||||
}
|
||||
if (empty($createlock)) {
|
||||
print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
|
||||
}
|
||||
|
||||
print "<br>";
|
||||
|
||||
print $langs->trans("YouNeedToPersonalizeSetup")."<br><br><br>";
|
||||
|
||||
print '<div class="center"><a href="../admin/index.php?mainmenu=home&leftmenu=setup'.(isset($login) ? '&username='.urlencode($login) : '').'">';
|
||||
print '<span class="fas fa-external-link-alt"></span> '.$langs->trans("GoToSetupArea");
|
||||
print '</a></div>';
|
||||
} else {
|
||||
// If here MAIN_VERSION_LAST_UPGRADE is not empty
|
||||
print $langs->trans("VersionLastUpgrade").': <b><span class="ok">'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</span></b><br>';
|
||||
print $langs->trans("VersionProgram").': <b><span class="ok">'.DOL_VERSION.'</span></b><br>';
|
||||
print $langs->trans("MigrationNotFinished").'<br>';
|
||||
print "<br>";
|
||||
|
||||
print '<div class="center"><a href="'.$dolibarr_main_url_root.'/install/index.php">';
|
||||
print '<span class="fas fa-link-alt"></span> '.$langs->trans("GoToUpgradePage");
|
||||
print '</a></div>';
|
||||
}
|
||||
if (empty($createlock)) {
|
||||
print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
|
||||
}
|
||||
|
||||
print "<br>";
|
||||
|
||||
print $langs->trans("YouNeedToPersonalizeSetup")."<br><br><br>";
|
||||
|
||||
print '<div class="center"><a href="../admin/index.php?mainmenu=home&leftmenu=setup'.(isset($login) ? '&username='.urlencode($login) : '').'">';
|
||||
print '<span class="fas fa-external-link-alt"></span> '.$langs->trans("GoToSetupArea");
|
||||
print '</a></div>';
|
||||
} else {
|
||||
// If here MAIN_VERSION_LAST_UPGRADE is not empty
|
||||
print $langs->trans("VersionLastUpgrade").': <b><span class="ok">'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</span></b><br>';
|
||||
print $langs->trans("VersionProgram").': <b><span class="ok">'.DOL_VERSION.'</span></b><br>';
|
||||
print $langs->trans("MigrationNotFinished").'<br>';
|
||||
print "<br>";
|
||||
|
||||
print '<div class="center"><a href="'.$dolibarr_main_url_root.'/install/index.php">';
|
||||
print '<span class="fas fa-link-alt"></span> '.$langs->trans("GoToUpgradePage");
|
||||
print '</a></div>';
|
||||
}
|
||||
} elseif (empty($action) || preg_match('/upgrade/i', $action)) {
|
||||
// If upgrade
|
||||
@ -443,7 +445,7 @@ if ($action == "set" && $success) {
|
||||
$morehtml .= '</a></div>';
|
||||
}
|
||||
} else {
|
||||
dol_print_error('', 'step5.php: unknown choice of action');
|
||||
dol_print_error('', 'step5.php: unknown choice of action='.$action.' in create lock file seaction');
|
||||
}
|
||||
|
||||
// Clear cache files
|
||||
|
||||
@ -250,7 +250,9 @@ CountryMF=Saint Martin
|
||||
|
||||
##### Civilities #####
|
||||
CivilityMME=Mrs.
|
||||
CivilityMMEShort=Mrs.
|
||||
CivilityMR=Mr.
|
||||
CivilityMRShort=Mr.
|
||||
CivilityMLE=Ms.
|
||||
CivilityMTRE=Master
|
||||
CivilityDR=Doctor
|
||||
|
||||
@ -27,6 +27,7 @@ Permission56003=Delete tickets
|
||||
Permission56004=Manage tickets
|
||||
Permission56005=See tickets of all third parties (not effective for external users, always be limited to the third party they depend on)
|
||||
|
||||
Tickets=Tickets
|
||||
TicketDictType=Ticket - Types
|
||||
TicketDictCategory=Ticket - Groupes
|
||||
TicketDictSeverity=Ticket - Severities
|
||||
|
||||
@ -435,7 +435,19 @@ class Products extends DolibarrApi
|
||||
global $user;
|
||||
$user = DolibarrApiAccess::$user;
|
||||
|
||||
return $this->product->delete(DolibarrApiAccess::$user);
|
||||
$res = $this->product->delete(DolibarrApiAccess::$user);
|
||||
if ($res < 0) {
|
||||
throw new RestException(500, "Can't delete, error occurs");
|
||||
} elseif ($res == 0) {
|
||||
throw new RestException(409, "Can't delete, that product is probably used");
|
||||
}
|
||||
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'Object deleted'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -640,6 +640,7 @@ if ($object->id > 0) {
|
||||
$sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id';
|
||||
$sql .= ' WHERE id.fk_inventory = '.((int) $object->id);
|
||||
$sql .= ' ORDER BY id.rowid';
|
||||
|
||||
$cacheOfProducts = array();
|
||||
$cacheOfWarehouses = array();
|
||||
|
||||
@ -141,7 +141,6 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot as e ON s.fk_entrepot = e.rowid AND e.entity IN ('.getEntity('entrepot').')';
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_units as u on p.fk_unit = u.rowid';
|
||||
}
|
||||
@ -150,6 +149,7 @@ if ($search_categ > 0) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp";
|
||||
}
|
||||
$sql .= " WHERE p.entity IN (".getEntity('product').")";
|
||||
$sql .= " AND EXISTS (SELECT e.rowid FROM ".MAIN_DB_PREFIX."entrepot as e WHERE e.rowid = s.fk_entrepot AND e.entity IN (".getEntity('stock')."))";
|
||||
if ($search_categ > 0) {
|
||||
$sql .= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ
|
||||
}
|
||||
|
||||
@ -418,7 +418,7 @@ if (! empty($conf->categorie->enabled))
|
||||
// If the user can view user other than himself
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= '<div class="inline-block hideonsmartphone"></div>';
|
||||
$includeonly = 'hierachyme';
|
||||
$includeonly = 'hierarchyme';
|
||||
if (empty($user->rights->user->user->lire)) {
|
||||
$includeonly = array($user->id);
|
||||
}
|
||||
|
||||
@ -838,7 +838,7 @@ class Project extends CommonObject
|
||||
}
|
||||
|
||||
// Fetch tasks
|
||||
$this->getLinesArray($user);
|
||||
$this->getLinesArray($user, 0);
|
||||
|
||||
// Delete tasks
|
||||
$ret = $this->deleteTasks($user);
|
||||
@ -2204,14 +2204,15 @@ class Project extends CommonObject
|
||||
/**
|
||||
* Create an array of tasks of current project
|
||||
*
|
||||
* @param User $user Object user we want project allowed to
|
||||
* @return int >0 if OK, <0 if KO
|
||||
* @param User $user Object user we want project allowed to
|
||||
* @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
public function getLinesArray($user)
|
||||
public function getLinesArray($user, $loadRoleMode = 1)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||
$taskstatic = new Task($this->db);
|
||||
|
||||
$this->lines = $taskstatic->getTasksArray(0, $user, $this->id, 0, 0);
|
||||
$this->lines = $taskstatic->getTasksArray(0, $user, $this->id, 0, 0, '', '-1', '', 0, 0, array(), 0, array(), 0, $loadRoleMode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -772,9 +772,10 @@ class Task extends CommonObject
|
||||
* @param array $extrafields Show additional column from project or task
|
||||
* @param int $includebilltime Calculate also the time to bill and billed
|
||||
* @param array $search_array_options Array of search
|
||||
* @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action
|
||||
* @return array Array of tasks
|
||||
*/
|
||||
public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array())
|
||||
public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array(), $loadRoleMode = 1)
|
||||
{
|
||||
global $conf, $hookmanager;
|
||||
|
||||
@ -925,18 +926,18 @@ class Task extends CommonObject
|
||||
$error = 0;
|
||||
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
if ((!$obj->public) && (is_object($userp))) { // If not public project and we ask a filter on project owned by a user
|
||||
if (!$this->getUserRolesForProjectsOrTasks($userp, 0, $obj->projectid, 0)) {
|
||||
$error++;
|
||||
if ($loadRoleMode) {
|
||||
if ((!$obj->public) && (is_object($userp))) { // If not public project and we ask a filter on project owned by a user
|
||||
if (!$this->getUserRolesForProjectsOrTasks($userp, 0, $obj->projectid, 0)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
if (is_object($usert)) { // If we ask a filter on a user affected to a task
|
||||
if (!$this->getUserRolesForProjectsOrTasks(0, $usert, $obj->projectid, $obj->taskid)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_object($usert)) { // If we ask a filter on a user affected to a task
|
||||
if (!$this->getUserRolesForProjectsOrTasks(0, $usert, $obj->projectid, $obj->taskid)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$tasks[$i] = new Task($this->db);
|
||||
$tasks[$i]->id = $obj->taskid;
|
||||
|
||||
@ -132,26 +132,18 @@ if ($result < 0) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$qualifiedjobs = array();
|
||||
foreach ($object->lines as $val) {
|
||||
if (!verifCond($val->test)) {
|
||||
continue;
|
||||
}
|
||||
$qualifiedjobs[] = $val;
|
||||
}
|
||||
|
||||
// TODO Duplicate code. This sequence of code must be shared with code into cron_run_jobs.php script.
|
||||
|
||||
// current date
|
||||
$nbofjobs = count($qualifiedjobs);
|
||||
$nbofjobs = count($object->lines);
|
||||
$nbofjobslaunchedok = 0;
|
||||
$nbofjobslaunchedko = 0;
|
||||
|
||||
if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0)) {
|
||||
if (is_array($object->lines) && (count($object->lines) > 0)) {
|
||||
$savconf = dol_clone($conf);
|
||||
|
||||
// Loop over job
|
||||
foreach ($qualifiedjobs as $line) {
|
||||
foreach ($object->lines as $line) {
|
||||
dol_syslog("cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label, LOG_DEBUG);
|
||||
echo "cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label;
|
||||
|
||||
@ -181,6 +173,10 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0)) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!verifCond($line->test)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//If date_next_jobs is less of current date, execute the program, and store the execution time of the next execution in database
|
||||
if (($line->datenextrun < $now) && (empty($line->datestart) || $line->datestart <= $now) && (empty($line->dateend) || $line->dateend >= $now)) {
|
||||
echo " - qualified";
|
||||
|
||||
@ -287,177 +287,179 @@ if (empty($reshook) && $action == 'add') {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$result = $adh->create($user);
|
||||
if ($result > 0) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
$object = $adh;
|
||||
if (!$error) {
|
||||
$result = $adh->create($user);
|
||||
if ($result > 0) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
$object = $adh;
|
||||
|
||||
$adht = new AdherentType($db);
|
||||
$adht->fetch($object->typeid);
|
||||
$adht = new AdherentType($db);
|
||||
$adht->fetch($object->typeid);
|
||||
|
||||
if ($object->email) {
|
||||
$subject = '';
|
||||
$msg = '';
|
||||
if ($object->email) {
|
||||
$subject = '';
|
||||
$msg = '';
|
||||
|
||||
// Send subscription email
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
// Set output language
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
|
||||
// Load traductions files required by page
|
||||
$outputlangs->loadLangs(array("main", "members"));
|
||||
// Get email content from template
|
||||
$arraydefaultmessage = null;
|
||||
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER;
|
||||
// Send subscription email
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
// Set output language
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
|
||||
// Load traductions files required by page
|
||||
$outputlangs->loadLangs(array("main", "members"));
|
||||
// Get email content from template
|
||||
$arraydefaultmessage = null;
|
||||
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER;
|
||||
|
||||
if (!empty($labeltouse)) {
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
if (!empty($labeltouse)) {
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
}
|
||||
|
||||
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
|
||||
$subject = $arraydefaultmessage->topic;
|
||||
$msg = $arraydefaultmessage->content;
|
||||
}
|
||||
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
complete_substitutions_array($substitutionarray, $outputlangs, $object);
|
||||
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
|
||||
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs);
|
||||
|
||||
if ($subjecttosend && $texttosend) {
|
||||
$moreinheader = 'X-Dolibarr-Info: send_an_email by public/members/new.php'."\r\n";
|
||||
|
||||
$result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
|
||||
}
|
||||
/*if ($result < 0) {
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}*/
|
||||
}
|
||||
|
||||
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
|
||||
$subject = $arraydefaultmessage->topic;
|
||||
$msg = $arraydefaultmessage->content;
|
||||
}
|
||||
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
complete_substitutions_array($substitutionarray, $outputlangs, $object);
|
||||
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
|
||||
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs);
|
||||
|
||||
if ($subjecttosend && $texttosend) {
|
||||
$moreinheader = 'X-Dolibarr-Info: send_an_email by public/members/new.php'."\r\n";
|
||||
|
||||
$result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
|
||||
}
|
||||
/*if ($result < 0) {
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}*/
|
||||
}
|
||||
|
||||
// Send email to the foundation to say a new member subscribed with autosubscribe form
|
||||
if (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL) && !empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT) &&
|
||||
!empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL)) {
|
||||
// Define link to login card
|
||||
$appli = constant('DOL_APPLICATION_TITLE');
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
|
||||
$appli = $conf->global->MAIN_APPLICATION_TITLE;
|
||||
if (preg_match('/\d\.\d/', $appli)) {
|
||||
if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) {
|
||||
$appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
|
||||
// Send email to the foundation to say a new member subscribed with autosubscribe form
|
||||
if (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL) && !empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT) &&
|
||||
!empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL)) {
|
||||
// Define link to login card
|
||||
$appli = constant('DOL_APPLICATION_TITLE');
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
|
||||
$appli = $conf->global->MAIN_APPLICATION_TITLE;
|
||||
if (preg_match('/\d\.\d/', $appli)) {
|
||||
if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) {
|
||||
$appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
|
||||
}
|
||||
} else {
|
||||
$appli .= " ".DOL_VERSION;
|
||||
}
|
||||
} else {
|
||||
$appli .= " ".DOL_VERSION;
|
||||
}
|
||||
|
||||
$to = $adh->makeSubstitution($conf->global->MAIN_INFO_SOCIETE_MAIL);
|
||||
$from = $conf->global->ADHERENT_MAIL_FROM;
|
||||
$mailfile = new CMailFile(
|
||||
'['.$appli.'] '.$conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT,
|
||||
$to,
|
||||
$from,
|
||||
$adh->makeSubstitution($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL),
|
||||
array(),
|
||||
array(),
|
||||
array(),
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
-1
|
||||
);
|
||||
|
||||
if (!$mailfile->sendfile()) {
|
||||
dol_syslog($langs->trans("ErrorFailedToSendMail", $from, $to), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($backtopage)) {
|
||||
$urlback = $backtopage;
|
||||
} elseif (!empty($conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION)) {
|
||||
$urlback = $conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION;
|
||||
// TODO Make replacement of __AMOUNT__, etc...
|
||||
} else {
|
||||
$appli .= " ".DOL_VERSION;
|
||||
$urlback = $_SERVER["PHP_SELF"]."?action=added";
|
||||
}
|
||||
|
||||
$to = $adh->makeSubstitution($conf->global->MAIN_INFO_SOCIETE_MAIL);
|
||||
$from = $conf->global->ADHERENT_MAIL_FROM;
|
||||
$mailfile = new CMailFile(
|
||||
'['.$appli.'] '.$conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT,
|
||||
$to,
|
||||
$from,
|
||||
$adh->makeSubstitution($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL),
|
||||
array(),
|
||||
array(),
|
||||
array(),
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
-1
|
||||
);
|
||||
|
||||
if (!$mailfile->sendfile()) {
|
||||
dol_syslog($langs->trans("ErrorFailedToSendMail", $from, $to), LOG_ERR);
|
||||
if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) && $conf->global->MEMBER_NEWFORM_PAYONLINE != '-1') {
|
||||
if ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'all') {
|
||||
$urlback = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref);
|
||||
if (price2num(GETPOST('amount', 'alpha'))) {
|
||||
$urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
||||
}
|
||||
if (GETPOST('email')) {
|
||||
$urlback .= '&email='.urlencode(GETPOST('email'));
|
||||
}
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||
$urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2));
|
||||
} else {
|
||||
$urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
|
||||
}
|
||||
}
|
||||
} elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paybox') {
|
||||
$urlback = DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref);
|
||||
if (price2num(GETPOST('amount', 'alpha'))) {
|
||||
$urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
||||
}
|
||||
if (GETPOST('email')) {
|
||||
$urlback .= '&email='.urlencode(GETPOST('email'));
|
||||
}
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||
$urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2));
|
||||
} else {
|
||||
$urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
|
||||
}
|
||||
}
|
||||
} elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paypal') {
|
||||
$urlback = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref);
|
||||
if (price2num(GETPOST('amount', 'alpha'))) {
|
||||
$urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
||||
}
|
||||
if (GETPOST('email')) {
|
||||
$urlback .= '&email='.urlencode(GETPOST('email'));
|
||||
}
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||
$urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2));
|
||||
} else {
|
||||
$urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
|
||||
}
|
||||
}
|
||||
} elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'stripe') {
|
||||
$urlback = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?from=membernewform&source=membersubscription&ref='.$adh->ref;
|
||||
if (price2num(GETPOST('amount', 'alpha'))) {
|
||||
$urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
||||
}
|
||||
if (GETPOST('email')) {
|
||||
$urlback .= '&email='.urlencode(GETPOST('email'));
|
||||
}
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||
$urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2));
|
||||
} else {
|
||||
$urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dol_print_error('', "Autosubscribe form is setup to ask an online payment for a not managed online payment");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($backtopage)) {
|
||||
$urlback = $backtopage;
|
||||
} elseif (!empty($conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION)) {
|
||||
$urlback = $conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION;
|
||||
// TODO Make replacement of __AMOUNT__, etc...
|
||||
if (!empty($entity)) {
|
||||
$urlback .= '&entity='.$entity;
|
||||
}
|
||||
dol_syslog("member ".$adh->ref." was created, we redirect to ".$urlback);
|
||||
} else {
|
||||
$urlback = $_SERVER["PHP_SELF"]."?action=added";
|
||||
$error++;
|
||||
$errmsg .= join('<br>', $adh->errors);
|
||||
}
|
||||
|
||||
if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) && $conf->global->MEMBER_NEWFORM_PAYONLINE != '-1') {
|
||||
if ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'all') {
|
||||
$urlback = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref);
|
||||
if (price2num(GETPOST('amount', 'alpha'))) {
|
||||
$urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
||||
}
|
||||
if (GETPOST('email')) {
|
||||
$urlback .= '&email='.urlencode(GETPOST('email'));
|
||||
}
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||
$urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2));
|
||||
} else {
|
||||
$urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
|
||||
}
|
||||
}
|
||||
} elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paybox') {
|
||||
$urlback = DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref);
|
||||
if (price2num(GETPOST('amount', 'alpha'))) {
|
||||
$urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
||||
}
|
||||
if (GETPOST('email')) {
|
||||
$urlback .= '&email='.urlencode(GETPOST('email'));
|
||||
}
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||
$urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2));
|
||||
} else {
|
||||
$urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
|
||||
}
|
||||
}
|
||||
} elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paypal') {
|
||||
$urlback = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref);
|
||||
if (price2num(GETPOST('amount', 'alpha'))) {
|
||||
$urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
||||
}
|
||||
if (GETPOST('email')) {
|
||||
$urlback .= '&email='.urlencode(GETPOST('email'));
|
||||
}
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||
$urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2));
|
||||
} else {
|
||||
$urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
|
||||
}
|
||||
}
|
||||
} elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'stripe') {
|
||||
$urlback = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?from=membernewform&source=membersubscription&ref='.$adh->ref;
|
||||
if (price2num(GETPOST('amount', 'alpha'))) {
|
||||
$urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
||||
}
|
||||
if (GETPOST('email')) {
|
||||
$urlback .= '&email='.urlencode(GETPOST('email'));
|
||||
}
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||
$urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2));
|
||||
} else {
|
||||
$urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dol_print_error('', "Autosubscribe form is setup to ask an online payment for a not managed online payment");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($entity)) {
|
||||
$urlback .= '&entity='.$entity;
|
||||
}
|
||||
dol_syslog("member ".$adh->ref." was created, we redirect to ".$urlback);
|
||||
} else {
|
||||
$error++;
|
||||
$errmsg .= join('<br>', $adh->errors);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -525,7 +525,20 @@ class Thirdparties extends DolibarrApi
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$this->company->oldcopy = clone $this->company;
|
||||
return $this->company->delete($id);
|
||||
|
||||
$res = $this->company->delete($id);
|
||||
if ($res < 0) {
|
||||
throw new RestException(500, "Can't delete, error occurs");
|
||||
} elseif ($res == 0) {
|
||||
throw new RestException(409, "Can't delete, that product is probably used");
|
||||
}
|
||||
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'Object deleted'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1141,7 +1154,7 @@ class Thirdparties extends DolibarrApi
|
||||
*/
|
||||
public function getCompanyBankAccount($id)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->facture->lire) {
|
||||
if (!DolibarrApiAccess::$user->rights->societe->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
if (empty($id)) {
|
||||
|
||||
@ -216,8 +216,7 @@ class CompanyBankAccount extends Account
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe_rib";
|
||||
if ($id) {
|
||||
$sql .= " WHERE rowid = ".((int) $id);
|
||||
}
|
||||
if ($socid) {
|
||||
} elseif ($socid > 0) {
|
||||
$sql .= " WHERE fk_soc = ".((int) $socid);
|
||||
if ($default > -1) {
|
||||
$sql .= " AND default_rib = ".((int) $default);
|
||||
|
||||
@ -3035,7 +3035,7 @@ class SupplierProposalLine extends CommonObjectLine
|
||||
$sql .= " ".price2num($this->localtax2_tx).",";
|
||||
$sql .= " '".$this->db->escape($this->localtax1_type)."',";
|
||||
$sql .= " '".$this->db->escape($this->localtax2_type)."',";
|
||||
$sql .= " ".(!empty($this->subprice) ?price2num($this->subprice) : "null").",";
|
||||
$sql .= " ".(!empty($this->subprice) ?price2num($this->subprice) : 0).",";
|
||||
$sql .= " ".price2num($this->remise_percent).",";
|
||||
$sql .= " ".(isset($this->info_bits) ? "'".$this->db->escape($this->info_bits)."'" : "null").",";
|
||||
$sql .= " ".price2num($this->total_ht).",";
|
||||
|
||||
@ -700,7 +700,7 @@ if ($action == 'create' || $action == 'presend') {
|
||||
$formticket->withextrafields = 1;
|
||||
$formticket->param = array('origin' => GETPOST('origin'), 'originid' => GETPOST('originid'));
|
||||
|
||||
$formticket->showForm(1, 'create', 0);
|
||||
$formticket->showForm(1, 'create', 0, null, $action);
|
||||
/*} elseif ($action == 'edit' && $user->rights->ticket->write && $object->fk_statut < Ticket::STATUS_CLOSED) {
|
||||
$formticket = new FormTicket($db);
|
||||
|
||||
|
||||
@ -628,7 +628,17 @@ class Users extends DolibarrApi
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$this->useraccount->oldcopy = clone $this->useraccount;
|
||||
return $this->useraccount->delete(DolibarrApiAccess::$user);
|
||||
|
||||
if (!$this->useraccount->delete(DolibarrApiAccess::$user)) {
|
||||
throw new RestException(500);
|
||||
}
|
||||
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'Ticket deleted'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
|
||||
@ -3490,7 +3490,7 @@ class User extends CommonObject
|
||||
} else {
|
||||
$sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||
$sql .= " WHERE ((ug.fk_user = t.rowid";
|
||||
$sql .= " AND ug.entity IN (".getEntity('user')."))";
|
||||
$sql .= " AND ug.entity IN (".getEntity('usergroup')."))";
|
||||
$sql .= " OR t.entity = 0)"; // Show always superadmin
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -75,7 +75,7 @@ if ($prodattr->fetch($id) < 0) {
|
||||
|
||||
$prodattrval = new ProductAttributeValue($db);
|
||||
|
||||
$res = $prodattrval->fetchAllByProductAttribute($id);
|
||||
$res = $prodattrval->fetchAllByProductAttribute($id, false, 1);
|
||||
|
||||
if ($res == -1) {
|
||||
print json_encode(array(
|
||||
|
||||
@ -107,9 +107,10 @@ class ProductAttribute extends CommonObject
|
||||
/**
|
||||
* Returns an array of all product variants
|
||||
*
|
||||
* @return ProductAttribute[]
|
||||
* @param int $returnonlydata 0: return object, 1: return only data
|
||||
* @return ProductAttribute[]
|
||||
*/
|
||||
public function fetchAll()
|
||||
public function fetchAll($returnonlydata = 0)
|
||||
{
|
||||
$return = array();
|
||||
|
||||
@ -118,7 +119,12 @@ class ProductAttribute extends CommonObject
|
||||
$query = $this->db->query($sql);
|
||||
if ($query) {
|
||||
while ($result = $this->db->fetch_object($query)) {
|
||||
$tmp = new ProductAttribute($this->db);
|
||||
if (empty($returnonlydata)) {
|
||||
$tmp = new ProductAttribute($this->db);
|
||||
} else {
|
||||
$tmp = new stdClass();
|
||||
}
|
||||
|
||||
$tmp->id = $result->rowid;
|
||||
$tmp->ref = $result->ref;
|
||||
$tmp->ref_ext = $result->ref_ext;
|
||||
|
||||
@ -99,11 +99,12 @@ class ProductAttributeValue extends CommonObject
|
||||
/**
|
||||
* Returns all product attribute values of a product attribute
|
||||
*
|
||||
* @param int $prodattr_id Product attribute id
|
||||
* @param bool $only_used Fetch only used attribute values
|
||||
* @return ProductAttributeValue[]
|
||||
* @param int $prodattr_id Product attribute id
|
||||
* @param bool $only_used Fetch only used attribute values
|
||||
* @param int $returnonlydata 0: return object, 1: return only data
|
||||
* @return ProductAttributeValue[]
|
||||
*/
|
||||
public function fetchAllByProductAttribute($prodattr_id, $only_used = false)
|
||||
public function fetchAllByProductAttribute($prodattr_id, $only_used = false, $returnonlydata = 0)
|
||||
{
|
||||
$return = array();
|
||||
|
||||
@ -130,7 +131,12 @@ class ProductAttributeValue extends CommonObject
|
||||
$query = $this->db->query($sql);
|
||||
|
||||
while ($result = $this->db->fetch_object($query)) {
|
||||
$tmp = new ProductAttributeValue($this->db);
|
||||
if (empty($returnonlydata)) {
|
||||
$tmp = new ProductAttributeValue($this->db);
|
||||
} else {
|
||||
$tmp = new stdClass();
|
||||
}
|
||||
|
||||
$tmp->fk_product_attribute = $result->fk_product_attribute;
|
||||
$tmp->id = $result->rowid;
|
||||
$tmp->ref = $result->ref;
|
||||
|
||||
@ -467,7 +467,7 @@ if (!empty($id) || !empty($ref)) {
|
||||
}
|
||||
|
||||
if ($action == 'add') {
|
||||
$prodattr_all = $prodattr->fetchAll();
|
||||
$prodattr_all = $prodattr->fetchAll(1);
|
||||
|
||||
if (!$selected) {
|
||||
$selected = $prodattr_all[key($prodattr_all)]->id;
|
||||
@ -478,7 +478,6 @@ if (!empty($id) || !empty($ref)) {
|
||||
foreach ($prodattr_all as $each) {
|
||||
$prodattr_alljson[$each->id] = $each;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
@ -173,25 +173,17 @@ if ($result < 0) {
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
$qualifiedjobs = array();
|
||||
foreach ($object->lines as $val) {
|
||||
if (!verifCond($val->test)) {
|
||||
continue;
|
||||
}
|
||||
$qualifiedjobs[] = $val;
|
||||
}
|
||||
|
||||
// TODO Duplicate code. This sequence of code must be shared with code into public/cron/cron_run_jobs.php php page.
|
||||
|
||||
$nbofjobs = count($qualifiedjobs);
|
||||
$nbofjobs = count($object->lines);
|
||||
$nbofjobslaunchedok = 0;
|
||||
$nbofjobslaunchedko = 0;
|
||||
|
||||
if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0)) {
|
||||
if (is_array($object->lines) && (count($object->lines) > 0)) {
|
||||
$savconf = dol_clone($conf);
|
||||
|
||||
// Loop over job
|
||||
foreach ($qualifiedjobs as $line) {
|
||||
foreach ($object->lines as $line) {
|
||||
dol_syslog("cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label, LOG_DEBUG);
|
||||
echo "cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label;
|
||||
|
||||
@ -233,6 +225,10 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0)) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!verifCond($line->test)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//If date_next_jobs is less of current date, execute the program, and store the execution time of the next execution in database
|
||||
if (($line->datenextrun < $now) && (empty($line->datestart) || $line->datestart <= $now) && (empty($line->dateend) || $line->dateend >= $now)) {
|
||||
echo " - qualified";
|
||||
|
||||
@ -71,6 +71,8 @@ if (empty($conf->global->MAILING_LIMIT_SENDBYCLI)) {
|
||||
$conf->global->MAILING_LIMIT_SENDBYCLI = 0;
|
||||
}
|
||||
|
||||
$langs->loadLangs(array("main", "mails"));
|
||||
|
||||
|
||||
/*
|
||||
* Main
|
||||
|
||||
Loading…
Reference in New Issue
Block a user