Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into

develop
This commit is contained in:
Laurent Destailleur 2021-10-16 19:40:01 +02:00
commit 94c48d3573
6 changed files with 56 additions and 15 deletions

View File

@ -165,6 +165,10 @@ if ($action == 'update') {
dolibarr_set_const($db, "PDF_SHOW_LINK_TO_ONLINE_PAYMENT", GETPOST('PDF_SHOW_LINK_TO_ONLINE_PAYMENT', 'alpha'), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('PDF_USE_A')) {
dolibarr_set_const($db, "PDF_USE_A", GETPOST('PDF_USE_A', 'alpha'), 'chaine', 0, '', $conf->entity);
}
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
@ -534,6 +538,14 @@ if ($conf->use_javascript_ajax) {
}
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("PDF_USE_A").'</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('PDF_USE_A');
} else {
print $form->selectyesno('PDF_USE_A', (empty($conf->global->PDF_USE_A) ? 0 : $conf->global->PDF_USE_A), 1);
}
print '</td></tr>';
print '</table>';
print '</div>';

View File

@ -2770,20 +2770,20 @@ class ContratLigne extends CommonObjectLine
$langs->load("contracts");
if ($status == self::STATUS_INITIAL) {
$labelStatus = $langs->trans("ServiceStatusInitial");
$labelStatusShort = $langs->trans("ServiceStatusInitial");
$labelStatus = $langs->transnoentities("ServiceStatusInitial");
$labelStatusShort = $langs->transnoentities("ServiceStatusInitial");
} elseif ($status == self::STATUS_OPEN && $expired == -1) {
$labelStatus = $langs->trans("ServiceStatusRunning");
$labelStatusShort = $langs->trans("ServiceStatusRunning");
$labelStatus = $langs->transnoentities("ServiceStatusRunning");
$labelStatusShort = $langs->transnoentities("ServiceStatusRunning");
} elseif ($status == self::STATUS_OPEN && $expired == 0) {
$labelStatus = $langs->trans("ServiceStatusNotLate");
$labelStatusShort = $langs->trans("ServiceStatusNotLateShort");
$labelStatus = $langs->transnoentities("ServiceStatusNotLate");
$labelStatusShort = $langs->transnoentities("ServiceStatusNotLateShort");
} elseif ($status == self::STATUS_OPEN && $expired == 1) {
$labelStatus = $langs->trans("ServiceStatusLate");
$labelStatusShort = $langs->trans("ServiceStatusLateShort");
$labelStatus = $langs->transnoentities("ServiceStatusLate");
$labelStatusShort = $langs->transnoentities("ServiceStatusLateShort");
} elseif ($status == self::STATUS_CLOSED) {
$labelStatus = $langs->trans("ServiceStatusClosed");
$labelStatusShort = $langs->trans("ServiceStatusClosed");
$labelStatus = $langs->transnoentities("ServiceStatusClosed");
$labelStatusShort = $langs->transnoentities("ServiceStatusClosed");
}
$statusType = 'status'.$status;

View File

@ -9056,10 +9056,15 @@ abstract class CommonObject
$className = str_replace('@', '', $deleteFromObject[0]);
$filePath = $deleteFromObject[1];
$columnName = $deleteFromObject[2];
$TMoreSQL = array();
$more_sql = $deleteFromObject[3];
if (!empty($more_sql)) {
$TMoreSQL['customsql'] = $more_sql;
}
if (dol_include_once($filePath)) {
$childObject = new $className($this->db);
if (method_exists($childObject, 'deleteByParentField')) {
$result = $childObject->deleteByParentField($this->id, $columnName);
$result = $childObject->deleteByParentField($this->id, $columnName, $TMoreSQL);
if ($result < 0) {
$error++;
$this->errors[] = $childObject->error;
@ -9141,10 +9146,12 @@ abstract class CommonObject
*
* @param int $parentId Parent Id
* @param string $parentField Name of Foreign key parent column
* @param array $filter an array filter
* @param string $filtermode AND or OR
* @return int <0 if KO, >0 if OK
* @throws Exception
*/
public function deleteByParentField($parentId = 0, $parentField = '')
public function deleteByParentField($parentId = 0, $parentField = '', $filter = array(), $filtermode = "AND")
{
global $user;
@ -9157,6 +9164,23 @@ abstract class CommonObject
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " WHERE ".$parentField." = ".(int) $parentId;
// Manage filters
$sqlwhere = array();
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
if ($key == 'customsql') {
$sqlwhere[] = $value;
} elseif (strpos($value, '%') === false) {
$sqlwhere[] = $key." IN (".$this->db->sanitize($this->db->escape($value)).")";
} else {
$sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'";
}
}
}
if (count($sqlwhere) > 0) {
$sql .= " AND (".implode(" ".$filtermode." ", $sqlwhere).")";
}
$resql = $this->db->query($sql);
if (!$resql) {
$this->errors[] = $this->db->lasterror();

View File

@ -518,8 +518,12 @@ function getNumberInvoicesPieChart($mode)
$dataseries[$i]=array($langs->trans('NbOfOpenInvoices'), $obj->nblate30, $obj->nblate15 - $obj->nblate30, $obj->nblatenow - $obj->nblate15, $obj->nbnotlatenow - $obj->nbnotlate15, $obj->nbnotlate15 - $obj->nbnotlate30, $obj->nbnotlate30);
$i++;
}
foreach ($dataseries[0] as $key=>$value) {
$total += $value;
if (!empty($dataseries[0])) {
foreach ($dataseries[0] as $key => $value) {
if (is_numeric($value)) {
$total += $value;
}
}
}
$legend = array(
$langs->trans('InvoiceLate30Days'),

View File

@ -154,7 +154,7 @@ class Job extends CommonObject
// * If name matches '@ClassNAme:FilePathClass;ParentFkFieldName' it will
// * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object
// */
// protected $childtablesoncascade = array('hrm_jobdet');
protected $childtablesoncascade = array("@SkillRank:hrm/class/skillrank.class.php:fk_object:objecttype='job'");
// /**
// * @var JobLine[] Array of subtable lines

View File

@ -2194,3 +2194,4 @@ LanguageAndPresentation=Language and presentation
SkinAndColors=Skin and colors
IfYouUseASecondTaxYouMustSetYouUseTheMainTax=If you want to use a second tax, you must enable also the first sales tax
IfYouUseAThirdTaxYouMustSetYouUseTheMainTax=If you want to use a third tax, you must enable also the first sales tax
PDF_USE_1A=Generate PDF with PDF/A-1b format