diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index be45a2101f5..b91a9df0941 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -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 ''; +print ''.$langs->trans("PDF_USE_A").''; +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 ''; + print ''; print ''; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index a7a42ca7350..a23a620359e 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -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; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 37083cdf5f8..c9740951fc9 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -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(); diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 193c4c3acb7..573f27c1eee 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -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'), diff --git a/htdocs/hrm/class/job.class.php b/htdocs/hrm/class/job.class.php index 969b5246419..fc94f4ba6ae 100644 --- a/htdocs/hrm/class/job.class.php +++ b/htdocs/hrm/class/job.class.php @@ -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 diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index def603e653e..0cf17545b5f 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -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