Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/compta/facture/card.php
This commit is contained in:
commit
63d9f69732
@ -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);
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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'));
|
||||
|
||||
@ -345,7 +345,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 {
|
||||
|
||||
@ -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">';
|
||||
|
||||
@ -607,63 +607,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', 'ACCOUNTANCY_CODE_CUSTOMER');
|
||||
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');
|
||||
}
|
||||
}
|
||||
if ($key == 'ACCOUNTANCY_CODE_CUSTOMER') {
|
||||
// Check for mandatory
|
||||
if (!empty($conf->global->SOCIETE_ACCOUNTANCY_CODE_CUSTOMER_INVOICE_MANDATORY) && empty($object->thirdparty->code_compta)) {
|
||||
$langs->load("errors");
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorAccountancyCodeCustomerIsMandatory", $object->thirdparty->name).' ('.$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) {
|
||||
$keymin = strtolower($key);
|
||||
$vallabel = $object->$keymin;
|
||||
|
||||
// Check for mandatory
|
||||
$keymandatory = 'INVOICE_'.$key.'_MANDATORY_FOR_VALIDATION';
|
||||
if (!$vallabel && !empty($conf->global->$keymandatory)) {
|
||||
$langs->load("errors");
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val)), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Check for warehouse
|
||||
if ($object->type != Facture::TYPE_DEPOSIT && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
|
||||
$qualified_for_stock_change = 0;
|
||||
|
||||
@ -2634,7 +2634,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;
|
||||
@ -2674,6 +2674,59 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check for mandatory fields in $this
|
||||
$array_to_check = array('REF_CLIENT'=>'RefCustomer');
|
||||
foreach ($array_to_check as $key => $val) {
|
||||
$keymin = strtolower($key);
|
||||
$vallabel = $this->$keymin;
|
||||
|
||||
// Check for mandatory
|
||||
$keymandatory = 'INVOICE_'.$key.'_MANDATORY_FOR_VALIDATION';
|
||||
if (!$vallabel && !empty($conf->global->$keymandatory)) {
|
||||
$langs->load("errors");
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val)), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Check parameters
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -378,7 +378,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...')
|
||||
@ -5438,11 +5438,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 = '';
|
||||
|
||||
@ -149,6 +149,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';
|
||||
}
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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>.
|
||||
|
||||
@ -314,8 +314,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)
|
||||
@ -336,3 +338,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
|
||||
|
||||
@ -104,6 +104,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
|
||||
|
||||
@ -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>.
|
||||
|
||||
@ -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
|
||||
|
||||
@ -3299,6 +3299,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 ?>",
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -1769,23 +1769,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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user