Merge branch '15.0up' into 15.0

This commit is contained in:
Ferran Marcet 2022-03-30 09:34:28 +02:00
commit f8b457e61c
41 changed files with 388 additions and 225 deletions

View File

@ -137,9 +137,9 @@ if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->acco
if (!$error) {
$db->begin();
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as l";
$sql1 .= " SET l.fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
$sql1 .= ' WHERE l.rowid IN ('.$db->sanitize(implode(',', $changeaccount)).')';
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet";
$sql1 .= " SET fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
$sql1 .= ' WHERE rowid IN ('.$db->sanitize(implode(',', $changeaccount)).')';
dol_syslog('accountancy/customer/lines.php::changeaccount sql= '.$sql1);
$resql1 = $db->query($sql1);

View File

@ -117,77 +117,79 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
print "<br>\n";
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
print "<br>\n"; print "<br>\n";
if (!empty($user->rights->accounting->chartofaccount)) {
print "<br>\n"; print "<br>\n";
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
print '<hr>';
print "<br>\n";
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
print '<hr>';
print "<br>\n";
// STEPS
$step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'</strong></a>', $s);
print $s;
print "<br>\n";
$step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/accountmodel.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'</strong></a>', $s);
print $s;
print "<br>\n";
$step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'</strong></a>', $s);
print $s;
print "<br>\n";
print "<br>\n";
print $langs->trans("AccountancyAreaDescActionOnceBis");
print "<br>\n";
print "<br>\n";
$step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong></a>', $s);
print $s;
print "<br>\n";
$step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '{s}')."\n";
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong></a>', $s);
print $s;
print "<br>\n";
$step++;
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=10&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong></a>';
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, '{s}');
$s = str_replace('{s}', $textlink, $s);
print $s;
print "<br>\n";
if (!empty($conf->tax->enabled)) {
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
// STEPS
$step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, '{s}');
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'</strong></a>', $s);
print $s;
print "<br>\n";
$step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/accountmodel.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'</strong></a>', $s);
print $s;
print "<br>\n";
$step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'</strong></a>', $s);
print $s;
print "<br>\n";
print "<br>\n";
print $langs->trans("AccountancyAreaDescActionOnceBis");
print "<br>\n";
print "<br>\n";
$step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong></a>', $s);
print $s;
print "<br>\n";
$step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '{s}')."\n";
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong></a>', $s);
print $s;
print "<br>\n";
$step++;
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=10&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong></a>';
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, '{s}');
$s = str_replace('{s}', $textlink, $s);
print $s;
print "<br>\n";
}
if (!empty($conf->expensereport->enabled)) {
if (!empty($conf->tax->enabled)) {
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
$step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, '{s}');
$s = str_replace('{s}', $textlink, $s);
print $s;
print "<br>\n";
}
if (!empty($conf->expensereport->enabled)) { // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
$step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong></a>', $s);
print $s;
print "<br>\n";
}
$step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong></a>', $s);
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/productaccount.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'</strong></a>', $s);
print $s;
print "<br>\n";
print '<br>';
}
$step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/productaccount.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'</strong></a>', $s);
print $s;
print "<br>\n";
print '<br>';
// Step A - E
print "<br>\n";

View File

@ -140,9 +140,9 @@ if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->acco
if (!$error) {
$db->begin();
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det as l";
$sql1 .= " SET l.fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
$sql1 .= ' WHERE l.rowid IN ('.$db->sanitize(implode(',', $changeaccount)).')';
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
$sql1 .= " SET fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
$sql1 .= ' WHERE rowid IN ('.$db->sanitize(implode(',', $changeaccount)).')';
dol_syslog('accountancy/supplier/lines.php::changeaccount sql= '.$sql1);
$resql1 = $db->query($sql1);

View File

@ -177,8 +177,8 @@ if ($conf->use_javascript_ajax) {
$i = 0;
foreach ($AdherentType as $key => $adhtype) {
$dataval['draft'][] = array($i, isset($MembersToValidate[$key]) ? $MembersToValidate[$key] : 0);
$dataval['notuptodate'][] = array($i, isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) : 0);
$dataval['uptodate'][] = array($i, isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0);
$dataval['notuptodate'][] = array($i, isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) : 0);
$dataval['excluded'][] = array($i, isset($MembersExcluded[$key]) ? $MembersExcluded[$key] : 0);
$dataval['resiliated'][] = array($i, isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0);
@ -191,18 +191,18 @@ if ($conf->use_javascript_ajax) {
}
$total = $SumToValidate + $SumValidated + $SumUpToDate + $SumExcluded + $SumResiliated;
$dataseries = array();
$dataseries[] = array($langs->transnoentitiesnoconv("OutOfDate"), round($SumValidated));
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusToValid"), round($SumToValidate)); // Draft, not yet validated
$dataseries[] = array($langs->transnoentitiesnoconv("UpToDate"), round($SumUpToDate));
$dataseries[] = array($langs->transnoentitiesnoconv("OutOfDate"), round($SumValidated));
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusExcluded"), round($SumExcluded));
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusResiliated"), round($SumResiliated));
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusToValid"), round($SumToValidate));
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$dolgraph = new DolGraph();
$dolgraph->SetData($dataseries);
$dolgraph->SetDataColor(array($badgeStatus1, $badgeStatus4, '-'.$badgeStatus8, $badgeStatus6, '-'.$badgeStatus0));
$dolgraph->SetDataColor(array('-'.$badgeStatus0, $badgeStatus4, '-'.$badgeStatus1, '-'.$badgeStatus8, $badgeStatus6));
$dolgraph->setShowLegend(2);
$dolgraph->setShowPercent(1);
$dolgraph->SetType(array('pie'));

View File

@ -116,7 +116,7 @@ $usercandelete = $user->rights->propal->supprimer;
$usercanclose = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->close)));
$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->validate)));
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propal->propal_advance->send);
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->send)));
$usercancreateorder = $user->rights->commande->creer;
$usercancreateinvoice = $user->rights->facture->creer;

View File

@ -349,9 +349,9 @@ if ($action == 'validate' && $permissiontovalidate) {
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked)) {
if ($tmpproposal->statut == 0) {
if ($tmpproposal->valid($user)) {
if ($tmpproposal->fetch($checked) > 0) {
if ($tmpproposal->statut == $tmpproposal::STATUS_DRAFT) {
if ($tmpproposal->valid($user) > 0) {
setEventMessage($langs->trans('hasBeenValidated', $tmpproposal->ref), 'mesgs');
} else {
setEventMessage($langs->trans('CantBeValidated'), 'errors');
@ -363,7 +363,7 @@ if ($action == 'validate' && $permissiontovalidate) {
$error++;
}
} else {
dol_print_error($db);
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
$error++;
}
}
@ -381,13 +381,13 @@ if ($action == "sign" && $permissiontoclose) {
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked)) {
if ($tmpproposal->fetch($checked) > 0) {
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
$tmpproposal->statut = $tmpproposal::STATUS_SIGNED;
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED)) {
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) {
setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs');
} else {
dol_print_error($db);
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
$error++;
}
} else {
@ -395,7 +395,7 @@ if ($action == "sign" && $permissiontoclose) {
$error++;
}
} else {
dol_print_error($db);
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
$error++;
}
}
@ -406,27 +406,28 @@ if ($action == "sign" && $permissiontoclose) {
}
}
}
if ($action == "nosign" && $permissiontoclose) {
if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked)) {
if ($tmpproposal->fetch($checked) > 0) {
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
$tmpproposal->statut = $tmpproposal::STATUS_NOTSIGNED;
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED)) {
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED) > 0) {
setEventMessage($tmpproposal->ref." ".$langs->trans('NoSigned'), 'mesgs');
} else {
dol_print_error($db);
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
$error++;
}
} else {
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeClosed'), 'errors');
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeNoSign'), 'errors');
$error++;
}
} else {
dol_print_error($db);
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
$error++;
}
}

View File

@ -338,7 +338,7 @@ if ($action == 'shipped' && $permissiontoadd) {
$error = 0;
foreach ($toselect as $checked) {
if ($objecttmp->fetch($checked)) {
if ($objecttmp->statut == 1) {
if ($objecttmp->statut == 1 || $objecttmp->statut == 2) {
if ($objecttmp->cloture($user)) {
setEventMessage($langs->trans('PassedInClosedStatus', $objecttmp->ref), 'mesgs');
} else {

View File

@ -179,7 +179,7 @@ if (empty($reshook)) {
$action = 'create';
}
if ($action == 'delete') {
if ($action == 'confirm_delete' && $confirm == 'yes') {
$result = $object->fetch($id);
if ($object->rappro == 0) {
@ -543,6 +543,12 @@ if ($id) {
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 350);
}
// Confirmation of the removal of the Various Payment
if ($action == 'delete') {
$text = $langs->trans('ConfirmDeleteVariousPayment');
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('DeleteVariousPayment'), $text, 'confirm_delete', '', '', 2);
}
print dol_get_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, $object->picto);
$morehtmlref = '<div class="refidno">';

View File

@ -606,40 +606,6 @@ if (empty($reshook)) {
$object->fetch($id);
$object->fetch_thirdparty();
// Check parameters
// Check for mandatory fields in thirdparty (defined into setup)
$array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL');
foreach ($array_to_check as $key) {
$keymin = strtolower($key);
$i = (int) preg_replace('/[^0-9]/', '', $key);
$vallabel = $object->thirdparty->$keymin;
if ($i > 0) {
if ($object->thirdparty->isACompany()) {
// Check for mandatory prof id (but only if country is other than ours)
if ($mysoc->country_id > 0 && $object->thirdparty->country_id == $mysoc->country_id) {
$idprof_mandatory = 'SOCIETE_'.$key.'_INVOICE_MANDATORY';
if (!$vallabel && !empty($conf->global->$idprof_mandatory)) {
$langs->load("errors");
$error++;
setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $object->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").')', null, 'errors');
}
}
}
} else {
//var_dump($conf->global->SOCIETE_EMAIL_MANDATORY);
if ($key == 'EMAIL') {
// Check for mandatory
if (!empty($conf->global->SOCIETE_EMAIL_INVOICE_MANDATORY) && !isValidEMail($object->thirdparty->email)) {
$langs->load("errors");
$error++;
setEventMessages($langs->trans("ErrorBadEMail", $object->thirdparty->email).' ('.$langs->trans("ForbiddenBySetupRules").')', null, 'errors');
}
}
}
}
// Check for mandatory fields in invoice
$array_to_check = array('REF_CLIENT'=>'RefCustomer');
foreach ($array_to_check as $key => $val) {

View File

@ -2630,7 +2630,7 @@ class Facture extends CommonInvoice
*/
public function validate($user, $force_number = '', $idwarehouse = 0, $notrigger = 0, $batch_rule = 0)
{
global $conf, $langs;
global $conf, $langs, $mysoc;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$productStatic = null;
@ -2669,6 +2669,44 @@ class Facture extends CommonInvoice
return -1;
}
// Check for mandatory fields in thirdparty (defined into setup)
if (!empty($this->thirdparty) && is_object($this->thirdparty)) {
$array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL');
foreach ($array_to_check as $key) {
$keymin = strtolower($key);
if (!property_exists($this->thirdparty, $keymin)) {
continue;
}
$vallabel = $this->thirdparty->$keymin;
$i = (int) preg_replace('/[^0-9]/', '', $key);
if ($i > 0) {
if ($this->thirdparty->isACompany()) {
// Check for mandatory prof id (but only if country is other than ours)
if ($mysoc->country_id > 0 && $this->thirdparty->country_id == $mysoc->country_id) {
$idprof_mandatory = 'SOCIETE_'.$key.'_INVOICE_MANDATORY';
if (!$vallabel && !empty($conf->global->$idprof_mandatory)) {
$langs->load("errors");
$this->error = $langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $this->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']';
dol_syslog(__METHOD__.' '.$this->error, LOG_ERR);
return -1;
}
}
}
} else {
if ($key == 'EMAIL') {
// Check for mandatory
if (!empty($conf->global->SOCIETE_EMAIL_INVOICE_MANDATORY) && !isValidEMail($this->thirdparty->email)) {
$langs->load("errors");
$this->error = $langs->trans("ErrorBadEMail", $this->thirdparty->email).' ('.$langs->trans("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']';
dol_syslog(__METHOD__.' '.$this->error, LOG_ERR);
return -1;
}
}
}
}
}
$this->db->begin();
// Check parameters

View File

@ -520,6 +520,29 @@ if (empty($reshook)) {
}
}
// Update extrafields
if ($action == 'update_extras' && ! empty($user->rights->societe->contact->creer)) {
$object->oldcopy = dol_clone($object);
// Fill array 'array_options' with data from update form
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
if ($ret < 0) {
$error++;
}
if (!$error) {
$result = $object->insertExtraFields('CONTACT_MODIFY');
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
if ($error) {
$action = 'edit_extras';
}
}
// Actions to send emails
$triggersendname = 'CONTACT_SENTBYMAIL';
$paramname = 'id';

View File

@ -49,7 +49,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
<td class="nowraponall"><?php echo $objectlink->getNomUrl(1); ?></td>
<td></td>
<td class="center"><?php echo dol_print_date($objectlink->date_contrat, 'day'); ?></td>
<td class="right"><?php
<td class="nowraponall right"><?php
// Price of contract is not shown by default because a contract is a list of service with
// start and end date that change with time andd that may be different that the period of reference for price.
// So price of a contract does often means nothing. Prices is on the different invoices done on same contract.

View File

@ -32,7 +32,7 @@ $addlinkid = GETPOST('idtolinkto', 'int');
$addlinkref = GETPOST('reftolinkto', 'alpha');
$cancellink = GETPOST('cancel', 'alpha');
// Link invoice to order
// Link object to another object
if ($action == 'addlink' && !empty($permissiondellink) && !$cancellink && $id > 0 && $addlinkid > 0) {
$object->fetch($id);
$object->fetch_thirdparty();
@ -61,7 +61,7 @@ if ($action == 'addlinkbyref' && ! empty($permissiondellink) && !$cancellink &&
}
}
// Delete link
// Delete link in table llx_element_element
if ($action == 'dellink' && !empty($permissiondellink) && !$cancellink && $dellinkid > 0) {
$result = $object->deleteObjectLinked(0, '', 0, '', $dellinkid);
if ($result < 0) {

View File

@ -177,16 +177,16 @@ class box_members_by_type extends ModeleBoxes
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => $langs->trans("MembersStatusToValid"),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => $langs->trans("OutOfDate"),
'text' => $langs->trans("MembersStatusToValid"), // Draft
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => $langs->trans("UpToDate"),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => $langs->trans("OutOfDate"),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => $langs->trans("MembersStatusExcluded"),
@ -215,12 +215,12 @@ class box_members_by_type extends ModeleBoxes
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (isset($MembersValidated[$key]) && ($MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) > 0) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 0, 3),
'text' => (isset($MembersUpToDate[$key]) && $MembersUpToDate[$key] > 0 ? $MembersUpToDate[$key] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (isset($MembersUpToDate[$key]) && $MembersUpToDate[$key] > 0 ? $MembersUpToDate[$key] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3),
'text' => (isset($MembersValidated[$key]) && ($MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) > 0) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 1, 3),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
@ -255,12 +255,12 @@ class box_members_by_type extends ModeleBoxes
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $SumValidated.' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 0, 3),
'text' => $SumUpToDate.' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3),
'asis' => 1
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $SumUpToDate.' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3),
'text' => $SumValidated.' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 1, 3),
'asis' => 1
);
$this->info_box_contents[$line][] = array(

View File

@ -375,7 +375,7 @@ function GETPOSTISSET($paramname)
* @param string $paramname Name of parameter to found
* @param string $check Type of check
* ''=no check (deprecated)
* 'none'=no check (only for param that should have very rich content)
* 'none'=no check (only for param that should have very rich content like passwords)
* 'array', 'array:restricthtml' or 'array:aZ09' to check it's an array
* 'int'=check it's numeric (integer or float)
* 'intcomma'=check it's integer+comma ('1,2,3,4...')
@ -5351,11 +5351,16 @@ function price2num($amount, $rounding = '', $option = 0)
// Decimal delimiter for PHP and database SQL requests must be '.'
$dec = ',';
$thousand = ' ';
if ($langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") {
$dec = $langs->transnoentitiesnoconv("SeparatorDecimal");
}
if ($langs->transnoentitiesnoconv("SeparatorThousand") != "SeparatorThousand") {
$thousand = $langs->transnoentitiesnoconv("SeparatorThousand");
if (is_null($langs)) { // $langs is not defined, we use english values.
$dec = '.';
$thousand = ',';
} else {
if ($langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") {
$dec = $langs->transnoentitiesnoconv("SeparatorDecimal");
}
if ($langs->transnoentitiesnoconv("SeparatorThousand") != "SeparatorThousand") {
$thousand = $langs->transnoentitiesnoconv("SeparatorThousand");
}
}
if ($thousand == 'None') {
$thousand = '';

View File

@ -156,6 +156,7 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l
//var_dump($user->rights);
$permok = false;
$keyforperm = $object->element;
if ($object->element == 'fichinter') {
$keyforperm = 'ficheinter';
}

View File

@ -344,7 +344,7 @@ if ($result > 0) {
// Send by mail
if ($user->socid == 0 && $action == '') {
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS));
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->supplier_invoice_advance->send)));
if ($usercansend) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a>';
} else {

View File

@ -88,9 +88,9 @@ create table llx_facture
fk_transport_mode integer, -- for intracomm report
situation_cycle_ref smallint, -- situation cycle reference
situation_counter smallint, -- situation counter
situation_final smallint, -- is the situation final ?
situation_cycle_ref smallint, -- situation cycle reference. A key that is similar for all the serie.
situation_counter smallint, -- situation counter. The number into the serie: 1, 2, ...
situation_final smallint, -- 0 by default, 1 it if is the final invoice.
retained_warranty real DEFAULT NULL, -- % of retained warranty
retained_warranty_date_limit date DEFAULT NULL,

View File

@ -146,9 +146,11 @@ ConfirmPaySalary=Are you sure you want to classify this salary card as paid?
DeleteSocialContribution=Delete a social or fiscal tax payment
DeleteVAT=Delete a VAT declaration
DeleteSalary=Delete a salary card
DeleteVariousPayment=Delete a various payment
ConfirmDeleteSocialContribution=Are you sure you want to delete this social/fiscal tax payment ?
ConfirmDeleteVAT=Are you sure you want to delete this VAT declaration ?
ConfirmDeleteSalary=Are you sure you want to delete this salary?
ConfirmDeleteSalary=Are you sure you want to delete this salary ?
ConfirmDeleteVariousPayment=Are you sure you want to delete this various payment ?
ExportDataset_tax_1=Social and fiscal taxes and payments
CalcModeVATDebt=Mode <b>%sVAT on commitment accounting%s</b>.
CalcModeVATEngagement=Mode <b>%sVAT on incomes-expenses%s</b>.

View File

@ -308,8 +308,10 @@ WarningTheHiddenOptionIsOn=Warning, the hidden option <b>%s</b> is on.
WarningCreateSubAccounts=Warning, you can't create directly a sub account, you must create a third party or an user and assign them an accounting code to find them in this list
WarningAvailableOnlyForHTTPSServers=Available only if using HTTPS secured connection.
WarningModuleXDisabledSoYouMayMissEventHere=Module %s has not been enabled. So you may miss a lot of event here.
<<<<<<< HEAD
WarningPaypalPaymentNotCompatibleWithStrict=The value 'Strict' makes the online payment features not working correctly. Use 'Lax' instead.
<<<<<<< HEAD
# Validate
RequireValidValue = Value not valid
RequireAtLeastXString = Requires at least %s character(s)
@ -330,3 +332,7 @@ BadSetupOfField = Error bad setup of field
BadSetupOfFieldClassNotFoundForValidation = Error bad setup of field : Class not found for validation
BadSetupOfFieldFileNotFound = Error bad setup of field : File not found for inclusion
BadSetupOfFieldFetchNotCallable = Error bad setup of field : Fetch not callable on class
=======
=======
>>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git
>>>>>>> branch '14.0' of git@github.com:Dolibarr/dolibarr.git

View File

@ -102,6 +102,9 @@ ConfirmCancelOrder=Are you sure you want to cancel this order?
ConfirmMakeOrder=Are you sure you want to confirm you made this order on <b>%s</b>?
GenerateBill=Generate invoice
ClassifyShipped=Classify delivered
PassedInShippedStatus=classified delivered
YouCantShipThis=I can't classify this. Please check user permissions
MustBeValidatedBefore=must be Validated or In process in order to be classified as shipped
DraftOrders=Draft orders
DraftSuppliersOrders=Draft purchase orders
OnProcessOrders=In process orders

View File

@ -302,3 +302,4 @@ SelectTheTypeOfObjectToAnalyze=Select an object to view its statistics...
ConfirmBtnCommonContent = Are you sure you want to "%s" ?
ConfirmBtnCommonTitle = Confirm your action
CloseDialog = Close
Autofill = Autofill

View File

@ -285,3 +285,4 @@ SelectLinesOfTimeSpentToInvoice=Select lines of time spent that are unbilled, th
ProjectTasksWithoutTimeSpent=Project tasks without time spent
FormForNewLeadDesc=Thanks to fill the following form to contact us. You can also send us an email directly to <b>%s</b>.
StartDateCannotBeAfterEndDate=End date cannot be before start date
ErrorPROJECTLEADERRoleMissingRestoreIt=The "PROJECTLEADER" role is missing or has been de-activited, please restore in the dictionary of contact types

View File

@ -85,6 +85,22 @@ ProposalCustomerSignature=Written acceptance, company stamp, date and signature
ProposalsStatisticsSuppliers=Vendor proposals statistics
CaseFollowedBy=Case followed by
SignedOnly=Signed only
NoSign=Set not signed
NoSigned=set not signed
CantBeNoSign=cannot be set not signed
ConfirmMassNoSignature=Bulk Not signed confirmation
ConfirmMassNoSignatureQuestion=Are you sure you want to set not signed the selected records ?
IsNotADraft=is not a draft
PassedInOpenStatus=has been validated
CantBeSign=cannot be signed
Sign=Sign
Signed=signed
CantBeSign=cannot be signed
CantBeValidated=cannot be validated
ConfirmMassValidation=Bulk Validate confirmation
ConfirmMassSignature=Bulk Signature confirmation
ConfirmMassValidationQuestion=Are you sure you want to validate the selected records ?
ConfirmMassSignatureQuestion=Are you sure you want to sign the selected records ?
IdProposal=Proposal ID
IdProduct=Product ID
PrParentLine=Proposal Parent Line

View File

@ -146,9 +146,11 @@ ConfirmPaySalary=Voulez-vous vraiment classer ce salaire comme payé ?
DeleteSocialContribution=Effacer une charge fiscale ou sociale
DeleteVAT=Supprimer une déclaration de TVA
DeleteSalary=Supprimer un salaire
DeleteVariousPayment=Supprimer un paiement divers
ConfirmDeleteSocialContribution=Voulez-vous vraiment supprimer ce paiement de taxe sociale / fiscale?
ConfirmDeleteVAT=Voulez-vous vraiment supprimer cette déclaration de TVA ?
ConfirmDeleteSalary=Êtes-vous sûr de vouloir supprimer ce salaire ?
ConfirmDeleteVariousPayment=Voulez-vous vraiment supprimer ce paiement divers ?
ExportDataset_tax_1=Taxes sociales et fiscales et paiements
CalcModeVATDebt=Mode <b>%sTVA sur débit%s</b>.
CalcModeVATEngagement=Mode <b>%sTVA sur encaissement%s</b>.

View File

@ -102,6 +102,9 @@ ConfirmCancelOrder=Êtes-vous sûr de vouloir annuler cette commande ?
ConfirmMakeOrder=Êtes-vous sûr de vouloir confirmer cette commande en date du <b>%s</b> ?
GenerateBill=Facturer
ClassifyShipped=Classer livrée
PassedInShippedStatus=classée livrée
YouCantShipThis=Classement impossible : veuillez vérifier les droits utilisateur
MustBeValidatedBefore=doit être Validée ou En cours de livraison pour pouvoir être classée livrée
DraftOrders=Commandes brouillons
DraftSuppliersOrders=Commandes fournisseurs brouillons
OnProcessOrders=Commandes en cours de traitement

View File

@ -3275,6 +3275,7 @@ if (!function_exists("llxFooter")) {
?>
<script>
jQuery(document).ready(function (tmp) {
console.log("Try Ping with hash_unique_id is md5('dolibarr'+instance_unique_id)");
$.ajax({
method: "POST",
url: "<?php echo $url_for_ping ?>",

View File

@ -735,9 +735,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print $langs->trans("Warehouse");
}
print '</td>';
if ($conf->productbatch->enabled) {
if ($conf->stock->enabled) {
// Available
print '<td>';
print '<td align="right">';
if ($collapse || in_array($action, array('consumeorproduce', 'consumeandproduceall'))) {
print $langs->trans("Stock");
}
@ -958,12 +958,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
// Lot Batch
print '<td>';
if ($line2['batch'] != '') {
$tmpbatch->fetch(0, $line2['fk_product'], $line2['batch']);
print $tmpbatch->getNomUrl(1);
if ($conf->productbatch->enabled) {
print '<td>';
if ($line2['batch'] != '') {
$tmpbatch->fetch(0, $line2['fk_product'], $line2['batch']);
print $tmpbatch->getNomUrl(1);
}
print '</td>';
}
print '</td>';
// Action delete line
if ($permissiontodelete) {

View File

@ -245,10 +245,8 @@ if (empty($reshook)) {
$nbok = 0;
foreach ($toselect as $toselectid) {
$result = $objecttmp->fetch($toselectid);
var_dump($objecttmp->status);
if ($result > 0) {
$result = $objecttmp->cancel($user, 0);
var_dump($result);
if ($result == 0) {
setEventMessages($langs->trans('StatusOfRefMustBe', $objecttmp->ref, $objecttmp->LibStatut($objecttmp::STATUS_APPROVED)), null, 'warnings');
$error++;

View File

@ -2212,7 +2212,8 @@ class Product extends CommonObject
$this->db->commit();
} else {
$this->db->rollback();
dol_print_error($this->db);
$this->error = $this->db->lasterror();
return -1;
}
}

View File

@ -191,12 +191,17 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors');
}
if ($error) {
if (!$error) {
// Force the update of the price of the product to 0 if error
//$localtaxarray=array('0'=>$localtax1_type,'1'=>$localtax1,'2'=>$localtax2_type,'3'=>$localtax2);
$localtaxarray = array(); // We do not store localtaxes into product, we will use instead the "vat code" to retrieve them.
$object->updatePrice(0, $object->price_base_type, $user, $tva_tx, '', 0, $npr, 0, 0, $localtaxarray, $vatratecode);
$ret = $object->updatePrice(0, $object->price_base_type, $user, $tva_tx, '', 0, $npr, 0, 0, $localtaxarray, $vatratecode);
if ($ret < 0) {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
}
if (!$error) {
@ -463,13 +468,21 @@ if (empty($reshook)) {
if ($action == 'activate_price_by_qty') {
// Activating product price by quantity add a new price line with price_by_qty set to 1
$level = GETPOST('level', 'int');
$object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 1);
$ret = $object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 1);
if ($ret < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
// Unset Price by quantity
if ($action == 'disable_price_by_qty') {
// Disabling product price by quantity add a new price line with price_by_qty set to 0
$level = GETPOST('level', 'int');
$object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 0);
$ret = $object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 0);
if ($ret < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
if ($action == 'edit_price_by_qty') { // Edition d'un prix par quantité
@ -1603,13 +1616,17 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul
// On l'ajoute donc pour remettre a niveau (pb vieilles versions)
// We emulate the change of the price from interface with the same value than the one into table llx_product
if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
$object->updatePrice(($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_ttc[1] : $object->multiprices[1]), $object->multiprices_base_type[1], $user, (empty($object->multiprices_tva_tx[1]) ? 0 : $object->multiprices_tva_tx[1]), ($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_min_ttc[1] : $object->multiprices_min[1]), 1);
$ret = $object->updatePrice(($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_ttc[1] : $object->multiprices[1]), $object->multiprices_base_type[1], $user, (empty($object->multiprices_tva_tx[1]) ? 0 : $object->multiprices_tva_tx[1]), ($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_min_ttc[1] : $object->multiprices_min[1]), 1);
} else {
$object->updatePrice(($object->price_base_type == 'TTC' ? $object->price_ttc : $object->price), $object->price_base_type, $user, $object->tva_tx, ($object->price_base_type == 'TTC' ? $object->price_min_ttc : $object->price_min));
$ret = $object->updatePrice(($object->price_base_type == 'TTC' ? $object->price_ttc : $object->price), $object->price_base_type, $user, $object->tva_tx, ($object->price_base_type == 'TTC' ? $object->price_min_ttc : $object->price_min));
}
$result = $db->query($sql);
$num = $db->num_rows($result);
if ($ret < 0) {
dol_print_error($db, $object->error, $object->errors);
} else {
$result = $db->query($sql);
$num = $db->num_rows($result);
}
}
if ($num > 0) {

View File

@ -225,18 +225,32 @@ if ($object->ismultientitymanaged == 1) {
$sql .= " WHERE 1 = 1";
}
foreach ($search as $key => $val) {
if ($key == 'status' && $search[$key] == -1) {
continue;
}
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
if ($search[$key] == '-1') {
$search[$key] = '';
if (array_key_exists($key, $object->fields)) {
if ($key == 'status' && $search[$key] == -1) {
continue;
}
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
$search[$key] = '';
}
$mode_search = 2;
}
if ($search[$key] != '') {
$sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
}
} else {
if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
$columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
if (preg_match('/_dtstart$/', $key)) {
$sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'";
}
if (preg_match('/_dtend$/', $key)) {
$sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'";
}
}
}
$mode_search = 2;
}
if ($search[$key] != '') {
$sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
}
}
if ($search_all) {
@ -267,35 +281,45 @@ $sql .= $hookmanager->resPrint;
$sql=preg_replace('/,\s*$/','', $sql);
*/
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($resql);
/* This old and fast method to get and count full list returns all record so use a high amount of memory.
$resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($resql);
*/
/* The slow method does not consume memory on mysql (not tested on pgsql) */
/*$resql = $db->query($sql, 0, 'auto', 1);
while ($db->fetch_object($resql)) {
$nbtotalofrecords++;
}*/
/* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
$resql = $db->query($sqlforcount);
$objforcount = $db->fetch_object($resql);
$nbtotalofrecords = $objforcount->nbtotalofrecords;
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
$page = 0;
$offset = 0;
}
$db->free($resql);
}
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
$num = $nbtotalofrecords;
} else {
if ($limit) {
$sql .= $db->plimit($limit + 1, $offset);
}
$resql = $db->query($sql);
if (!$resql) {
dol_print_error($db);
exit;
}
$num = $db->num_rows($resql);
// Complete request and execute it with limit
$sql .= $db->order($sortfield, $sortorder);
if ($limit) {
$sql .= $db->plimit($limit + 1, $offset);
}
$resql = $db->query($sql);
if (!$resql) {
dol_print_error($db);
exit;
}
$num = $db->num_rows($resql);
// Direct jump if only one record found
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
$obj = $db->fetch_object($resql);

View File

@ -197,9 +197,14 @@ if (empty($reshook)) {
$result = $object->create($user);
if (!$error && $result > 0) {
// Add myself as project leader
$typeofcontact = 'PROJECTLEADER'; // TODO If use rename this code in dictionary, the add_contact will generate an error.
$typeofcontact = 'PROJECTLEADER';
$result = $object->add_contact($user->id, $typeofcontact, 'internal');
if ($result < 0) {
// -3 means type not found (PROJECTLEADER renamed, de-activated or deleted), so don't prevent creation if it has been the case
if ($result == -3) {
setEventMessage('ErrorPROJECTLEADERRoleMissingRestoreIt', 'errors');
$error++;
} elseif ($result < 0) {
$langs->load("errors");
setEventMessages($object->error, $object->errors, 'errors');
$error++;

View File

@ -1676,23 +1676,23 @@ class Task extends CommonObjectLine
$this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task_time";
$sql .= " WHERE rowid = ".((int) $this->timespent_id);
dol_syslog(get_class($this)."::delTimeSpent", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
if (!$notrigger) {
// Call trigger
$result = $this->call_trigger('TASK_TIMESPENT_DELETE', $user);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (!$error) {
if (!$notrigger) {
// Call trigger
$result = $this->call_trigger('TASK_TIMESPENT_DELETE', $user);
if ($result < 0) {
$error++;
}
// End call triggers
$sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task_time";
$sql .= " WHERE rowid = ".((int) $this->timespent_id);
dol_syslog(get_class($this)."::delTimeSpent", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
}
}

View File

@ -1050,7 +1050,8 @@ foreach ($listofreferent as $key => $value) {
}
$addform .= '<div>';
}
if (is_array($elementarray) && !count($elementarray) > 0 && $key == "order_supplier") {
if (is_array($elementarray) && count($elementarray) > 0 && $key == "order_supplier") {
$addform = '<div class="inline-block valignmiddle"><a id="btnShow" class="buttonxxx marginleftonly" href="#" onClick="return false;">
<span id="textBtnShow" class="valignmiddle text-plus-circle hideonsmartphone">'.$langs->trans("CanceledShown").'</span><span id="minus-circle" class="fa fa-eye valignmiddle paddingleft"></span>
</a>
@ -1061,13 +1062,13 @@ foreach ($listofreferent as $key => $value) {
if (typeof attr !== "undefined" && attr !== false) {
console.log("Show canceled");
$(".tr_canceled").show();
$("#textBtnShow").text("'.dol_escape_js($langs->trans("CanceledShown")).'");
$("#textBtnShow").text("'.dol_escape_js($langs->transnoentitiesnoconv("CanceledShown")).'");
$("#btnShow").removeAttr("data-canceledarehidden");
$("#minus-circle").removeClass("fa-eye-slash").addClass("fa-eye");
} else {
console.log("Hide canceled");
$(".tr_canceled").hide();
$("#textBtnShow").text("'.dol_escape_js($langs->trans("CanceledHidden")).'");
$("#textBtnShow").text("'.dol_escape_js($langs->transnoentitiesnoconv("CanceledHidden")).'");
$("#btnShow").attr("data-canceledarehidden", 1);
$("#minus-circle").removeClass("fa-eye").addClass("fa-eye-slash");
}

View File

@ -565,7 +565,7 @@ class Reception extends CommonObject
// Loop on each product line to add a stock movement
// TODO in future, reception lines may not be linked to order line
$sql = "SELECT cd.fk_product, cd.subprice,";
$sql = "SELECT cd.fk_product, cd.subprice, cd.remise_percent,";
$sql .= " ed.rowid, ed.qty, ed.fk_entrepot,";
$sql .= " ed.eatby, ed.sellby, ed.batch,";
$sql .= " ed.cost_price";
@ -593,6 +593,12 @@ class Reception extends CommonObject
$mouvS->origin = &$this;
$mouvS->setOrigin($this->element, $this->id);
// get unit price with discount
$up_ht_disc = $obj->subprice;
if (!empty($obj->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) {
$up_ht_disc = price2num($up_ht_disc * (100 - $obj->remise_percent) / 100, 'MU');
}
if (empty($obj->batch)) {
// line without batch detail
@ -601,8 +607,9 @@ class Reception extends CommonObject
if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION || $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionValidatedInDolibarr", $numref), '', '', '', '', 0, $inventorycode);
} else {
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref), '', '', '', '', 0, $inventorycode);
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $up_ht_disc, $langs->trans("ReceptionValidatedInDolibarr", $numref), '', '', '', '', 0, $inventorycode);
}
if ($result < 0) {
$error++;
$this->errors[] = $mouvS->error;
@ -618,8 +625,9 @@ class Reception extends CommonObject
if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION || $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode);
} else {
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode);
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $up_ht_disc, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode);
}
if ($result < 0) {
$error++;
$this->errors[] = $mouvS->error;

View File

@ -3,7 +3,7 @@
* Copyright (C) 2014-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Charlie BENKE <charlie@patas-monkey.com>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -270,7 +270,7 @@ if ($action == 'add' && empty($cancel)) {
$ret = $object->create($user);
if ($ret < 0) {
var_dump($ret);
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
if (!empty($auto_create_paiement) && !$error) {

View File

@ -260,12 +260,19 @@ if ($search_user) {
if ($search_label) {
$sql .= natural_search(array('s.label'), $search_label);
}
if (!empty($search_date_start_from) && !empty($search_date_start_to)) {
$sql .= " AND s.datesp BETWEEN '".$db->idate($search_date_start_from)."' AND '".$db->idate($search_date_start_to)."'";
if (!empty($search_date_start_from)) {
$sql .= " AND s.datesp >= '".$db->idate($search_date_start_from)."'";
}
if (!empty($search_date_end_from) && !empty($search_date_end_to)) {
$sql .= " AND s.dateep BETWEEN '".$db->idate($search_date_end_from)."' AND '".$db->idate($search_date_end_to)."'";
if (!empty($search_date_end_from)) {
$sql .= " AND s.dateep >= '".$db->idate($search_date_end_from)."'";
}
if (!empty($search_date_start_to)) {
$sql .= " AND s.datesp <= '".$db->idate($search_date_start_to)."'";
}
if (!empty($search_date_end_to)) {
$sql .= " AND s.dateep <= '".$db->idate($search_date_end_to)."'";
}
if ($search_amount) {
$sql .= natural_search("s.amount", $search_amount, 1);
}

View File

@ -206,8 +206,8 @@ if (empty($reshook)) {
$object->oldcopy = clone $object;
$object->name = GETPOST("nom", 'nohtml');
$object->note = dol_htmlcleanlastbr(trim(GETPOST("note", 'restricthtml')));
$object->name = GETPOST("nom", 'nohtml');
$object->note = dol_htmlcleanlastbr(trim(GETPOST("note", 'restricthtml')));
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
@ -217,8 +217,8 @@ if (empty($reshook)) {
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
$object->entity = 0;
} else {
$object->entity = GETPOST("entity");
} elseif (GETPOSTISSET("entity")) {
$object->entity = GETPOST("entity", "int");
}
$ret = $object->update();

View File

@ -542,7 +542,14 @@ class ProductCombination
$new_price += $variation_price;
}
$child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq, 0, array(), $parent->default_vat_code);
$ret = $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq, 0, array(), $parent->default_vat_code);
if ($ret < 0) {
$this->db->rollback();
$this->error = $child->error;
$this->errors = $child->errors;
return $ret;
}
}
}
} else {
@ -564,7 +571,14 @@ class ProductCombination
$new_price += $this->variation_price;
}
$child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, 1, $new_npr, $new_psq);
$ret = $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, 1, $new_npr, $new_psq);
if ($ret < 0) {
$this->db->rollback();
$this->error = $child->error;
$this->errors = $child->errors;
return $ret;
}
}
$this->db->commit();
@ -573,6 +587,8 @@ class ProductCombination
}
$this->db->rollback();
$this->error = $child->error;
$this->errors = $child->errors;
return -1;
}

View File

@ -239,6 +239,13 @@ if (empty($modulepart)) {
accessforbidden('Bad value for parameter modulepart', 0, 0, 1);
}
// When logged in a different entity, medias cannot be accessed because $conf->$module->multidir_output
// is not set on the requested entity, but they are public documents, so reset entity
if ($modulepart === 'medias' && $entity != $conf->entity) {
$conf->entity = $entity;
$conf->setValues($db);
}
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $user, $refname);
$accessallowed = $check_access['accessallowed'];
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];