diff --git a/.github/changed-lines-count-labeler.yml b/.github/changed-lines-count-labeler.yml new file mode 100644 index 00000000000..39e663821fb --- /dev/null +++ b/.github/changed-lines-count-labeler.yml @@ -0,0 +1,3 @@ +# Add this tag for any changes for more than 1 line +"Pending analysis of PR (maintenance team)": + min: 1 diff --git a/.github/workflows/pr-18-autolabel.yaml b/.github/workflows/pr-18-autolabel.yaml new file mode 100644 index 00000000000..4524d02815b --- /dev/null +++ b/.github/workflows/pr-18-autolabel.yaml @@ -0,0 +1,20 @@ +name: "Set label for v18" +on: + pull_request: + types: [opened, synchronize, reopened] + branches: + - "18.0" + push: + branches: + - "18.0" + +jobs: + changed-lines-count-labeler: + runs-on: ubuntu-latest + name: An action for automatically labelling pull requests based on the changed lines count + steps: + - name: Set a label + uses: vkirilichev/changed-lines-count-labeler@v0.2 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + configuration-path: .github/changed-lines-count-labeler.yml diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index b8b18169b58..42e2b6cc07a 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -1,3 +1,4 @@ +name: Set reviewer for v18 on: pull_request: types: [opened, synchronize, reopened] @@ -7,15 +8,13 @@ on: branches: - "18.0" -permissions: write-all - jobs: - run: + pr18: runs-on: ubuntu-latest - env: - # GH_TOKEN: ${{ secrets.GH_TOKEN }} - GH_TOKEN: ${{ github.token }} + #env: + # GH_TOKEN: ${{ github.token }} + # GH_TOKENS: ${{ secrets.GITHUB_TOKEN }} steps: - name: Checkout repository @@ -26,20 +25,31 @@ jobs: sudo apt update sudo apt install gh -y - #- name: Authenticate GitHub CLI - # run: | - # echo "GH_TOKEN=$GH_TOKEN" - # gh auth login --with-token <<< "$GH_TOKEN" - - name: Assign reviewer env: #REVIEWER: "eldy,lvessiller-opendsi,rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer REVIEWER: "rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer run: | # shellcheck disable=2086 - echo "GH_TOKEN=$GH_TOKEN" + echo "Run action by ${{ github.actor }}" + # shellcheck disable=2086 + echo "github.token=${{ github.token }}" + # shellcheck disable=2086 + echo "secrets.GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" + # shellcheck disable=2086 + echo "GITHUB_EVENT_PATH=$GITHUB_EVENT_PATH" + # shellcheck disable=2086 + echo Get the pr_number # shellcheck disable=2086 pr_number=$(jq --raw-output .number < $GITHUB_EVENT_PATH) # shellcheck disable=2086 + echo "pr_number=$pr_number" + # shellcheck disable=2086 + echo Authenticate login gh + # shellcheck disable=2086 + gh auth login --with-token <<< "${{ secrets.GITHUB_TOKEN }}" + # shellcheck disable=2086 + echo Set the reviewere + # shellcheck disable=2086 gh pr edit $pr_number --add-reviewer "$REVIEWER" continue-on-error: true diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e0f55166a46..78c29dd9388 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,4 +1,4 @@ -name: Test +name: Test github actions on: workflow_dispatch: pull_request: @@ -6,8 +6,13 @@ on: branches: - "18.0" -#permissions: write-all -#permissions: {} # none +env: + ENVGHT: ${{ secrets.GITHUB_TOKEN }} + ENVGHU: ${{ github.token }} + VARAAA: ${{ vars.AAA }} + SECBBB: ${{ secrets.BBB }} + VARREPORGCCC: ${{ vars.CCC }} + ENVFIX: "abc" jobs: testjob: @@ -15,8 +20,15 @@ jobs: steps: - name: Log run: | - echo "repo-token: ${{ secrets.GITHUB_TOKEN }}" + echo "repo-token: ${{secrets.GITHUB_TOKEN}}" echo "variable org: ${{vars.AAA}}" echo "env prg: ${{env.AAA}}" + echo "env prg: ${{env.VARAAA}}" echo "secret org: ${{secrets.BBB}}" echo "variable repository of orga: ${{vars.CCC}}" + echo "ENVGHT: ${{env.ENVGHT}}" + echo "ENVGHU: ${{env.ENVGHU}}" + echo "VARAAA: ${{env.VARAAA}}" + echo "ENVAAA: ${{env.VARAAA}}" + echo "VARREPORGCCC: ${{env.VARREPORGCCC}}" + echo "ENVFIX: ${{env.abc}}" diff --git a/.gitignore b/.gitignore index 830429de679..0a6e4cf6655 100644 --- a/.gitignore +++ b/.gitignore @@ -90,3 +90,6 @@ phpstan_custom.neon /.php-cs-fixer.cache /.php_cs.cache /.cache + +# ignore .htaccess files +.htaccess diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 72373a88c5f..ffabe10d68d 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1381,7 +1381,26 @@ if ($id > 0) { $tablecode = 't.code'; $tableprefix = ''; - $tableprefixarray = array(DICT_FORME_JURIDIQUE => 'f.code', DICT_DEPARTEMENTS => 'd.code_departement', DICT_REGIONS => 'r.code_region', DICT_COUNTRY => 'c.code', DICT_CIVILITY => 'c.code', DICT_ACTIONCOMM => 'a.code', DICT_CURRENCIES => 'code_iso', DICT_ECOTAXE => 'e.code', DICT_HOLIDAY_TYPES => 'h.code', DICT_CHARGESOCIALES => 'a.code', DICT_HRM_PUBLIC_HOLIDAY => 'a.code', DICT_UNITS => 'r.code', DICT_SOCIALNETWORKS => 's.code', 45 => 'f.code', 46 => 'f.code', 47 => 'f.code', 48 => 'f.code'); + $tableprefixarray = array( + DICT_FORME_JURIDIQUE => 'f.code', + DICT_DEPARTEMENTS => 'd.code_departement', + DICT_REGIONS => 'r.code_region', + DICT_COUNTRY => 'c.code', + DICT_CIVILITY => 'c.code', + DICT_ACTIONCOMM => 'a.code', + DICT_CHARGESOCIALES => 'a.code', + DICT_TYPENT => 't.code', + DICT_CURRENCIES => 'c.code_iso', + DICT_ECOTAXE => 'e.code', + DICT_HOLIDAY_TYPES => 'h.code', + DICT_HRM_PUBLIC_HOLIDAY => 'a.code', + DICT_UNITS => 'r.code', + DICT_SOCIALNETWORKS => 's.code', + 45 => 'f.code', + 46 => 'f.code', + 47 => 'f.code', + 48 => 'f.code', + ); if (!empty($tableprefixarray[$id])) { $tablecode = $tableprefixarray[$id]; $tableprefix = preg_replace('/\..*$/', '.', $tablecode); diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index 017194f70c4..433d7a325fd 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -76,6 +76,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) { $res3 = 1; $res4 = 1; $res5 = 1; + $res6 = 1; if (GETPOSTISSET('MAIN_APPLICATION_TITLE')) { $res1 = dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", GETPOST("MAIN_APPLICATION_TITLE", 'alphanohtml'), 'chaine', 0, '', $conf->entity); } @@ -91,7 +92,10 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) { if (GETPOSTISSET('MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS')) { $res5 = dolibarr_set_const($db, "MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS", GETPOST("MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS", 'alphanohtml'), 'int', 0, '', $conf->entity); } - if ($res1 && $res2 && $res3 && $res4 && $res5) { + if (GETPOSTISSET('MAIN_SECURITY_MAX_NUMBER_FAILED_AUTH')) { + $res6 = dolibarr_set_const($db, "MAIN_SECURITY_MAX_NUMBER_FAILED_AUTH", GETPOST("MAIN_SECURITY_MAX_NUMBER_FAILED_AUTH", 'alphanohtml'), 'int', 0, '', $conf->entity); + } + if ($res1 && $res2 && $res3 && $res4 && $res5 && $res6) { setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); } } diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index 8061c973877..c30b2929ec1 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -323,7 +323,7 @@ class FormAdvTargetEmailing extends Form } } if (!empty($InfoFieldList[1])) { - $sql .= " ORDER BY nom"; + $sql .= $this->db->order($InfoFieldList[1]); } // $sql.= ' WHERE entity = '.$conf->entity; @@ -334,8 +334,10 @@ class FormAdvTargetEmailing extends Form if ($num) { while ($i < $num) { $obj = $this->db->fetch_object($resql); + $fieldtoread = $InfoFieldList[1]; $labeltoshow = dol_trunc($obj->$fieldtoread, 90); + $options_array[$obj->rowid] = $labeltoshow; $i++; } @@ -401,6 +403,20 @@ class FormAdvTargetEmailing extends Form global $conf, $langs; $form = new Form($this->db); + foreach ($options_array as $okey => $val) { + if ((string) $okey == '') { + continue; + } + + $valarray = explode('|', $val); + $val = $valarray[0]; + + if ($val) { + $options_array[$okey] = $langs->trans($val); + } else { + $options_array[$okey] = $val; + } + } $return = $form->multiselectarray($htmlname, $options_array, $selected_array, 0, 0, '', 0, 295); return $return; } diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index f917a201b28..f2ca321604a 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1896,6 +1896,14 @@ if ($action == 'create') { if ($element == 'project') { $projectid = $originid; + + // Fetch project and thirdparty + $project = new Project($db); + $project->fetch($projectid); + if ($project->socid > 0) { + $soc = new Societe($db); + $soc->fetch($project->socid); + } } else { // For compatibility if ($element == 'order' || $element == 'commande') { @@ -1928,9 +1936,9 @@ if ($action == 'create') { $soc = $objectsrc->thirdparty; - $cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0)); - $mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0)); - $warehouse_id = (!empty($objectsrc->warehouse_id) ? $objectsrc->warehouse_id : (!empty($soc->warehouse_id) ? $soc->warehouse_id : 0)); + $cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0)); + $mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0)); + $warehouse_id = (!empty($objectsrc->warehouse_id) ? $objectsrc->warehouse_id : (!empty($soc->warehouse_id) ? $soc->warehouse_id : 0)); // Replicate extrafields $objectsrc->fetch_optionals(); @@ -1945,7 +1953,10 @@ if ($action == 'create') { } } } - } else { + } + + // Load default values from thirdparty + if (!empty($soc)) { $cond_reglement_id = empty($soc->cond_reglement_id) ? $cond_reglement_id : $soc->cond_reglement_id; $deposit_percent = empty($soc->deposit_percent) ? $deposit_percent : $soc->deposit_percent; $mode_reglement_id = empty($soc->mode_reglement_id) ? $mode_reglement_id : $soc->mode_reglement_id; diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index c8f65f77e15..5e67c50fb15 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -105,7 +105,10 @@ $pagenext = $page + 1; $object = new FactureRec($db); if (($id > 0 || $ref) && $action != 'create' && $action != 'add') { $ret = $object->fetch($id, $ref); - if (!$ret) { + if ($ret < 0) { + dol_print_error($db, $object->error, $object->errors); + exit; + } elseif (! $ret) { setEventMessages($langs->trans("ErrorRecordNotFound"), null, 'errors'); } } @@ -1424,14 +1427,10 @@ if ($action == 'create') { } print ''; print ''; - if ($object->type != Facture::TYPE_CREDIT_NOTE) { - if ($action == 'editconditions') { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id'); - } else { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'none'); - } + if ($action == 'editconditions') { + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id'); } else { - print ' '; + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'none'); } print ''; @@ -1799,6 +1798,7 @@ if ($action == 'create') { // List of actions on element include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $formactions = new FormActions($db); + $morehtmlcenter = ''; $somethingshown = $formactions->showactions($object, $object->element, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter); print ''; diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 78615f801ba..1476eb8e764 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -721,11 +721,11 @@ class Invoices extends DolibarrApi } } - if ($this->invoice->update(DolibarrApiAccess::$user)) { + if ($this->invoice->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); + } else { + throw new RestException(500, $this->invoice->error); } - - return false; } /** diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index c8839eef4ea..ef3d96fed53 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1478,6 +1478,7 @@ class FactureRec extends CommonInvoice $nb_create++; $this->output .= $langs->trans("InvoiceGeneratedFromTemplate", $facture->ref, $facturerec->ref)."\n"; } else { + $this->output .= $langs->trans("InvoiceGeneratedFromTemplateError", $facture->ref, $facturerec->ref, $this->error)."\n"; $this->db->rollback("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref); } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 883b9484d37..fd25e728574 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -486,7 +486,8 @@ class Facture extends CommonInvoice $this->type = self::TYPE_STANDARD; } - $this->ref_client = trim($this->ref_client); + $this->ref_client = trim($this->ref_client); // deprecated + $this->ref_customer = trim($this->ref_customer); $this->note_private = (isset($this->note_private) ? trim($this->note_private) : ''); $this->note = (isset($this->note) ? trim($this->note) : $this->note_private); // deprecated @@ -906,17 +907,18 @@ class Facture extends CommonInvoice 1 ); + if ($result < 0) { + $this->error = $newinvoiceline->error; + $this->errors = array_merge($this->errors, $newinvoiceline->errors); + $error++; + break; + } + // Defined the new fk_parent_line if ($result > 0 && $newinvoiceline->product_type == 9) { $fk_parent_line = $result; } } - if ($result < 0) { - $this->error = $newinvoiceline->error; - $this->errors = $newinvoiceline->errors; - $error++; - break; - } } } elseif (!$error && empty($this->fac_rec)) { // If this->lines is an array of invoice line arrays $fk_parent_line = 0; @@ -2514,9 +2516,13 @@ class Facture extends CommonInvoice if (isset($this->ref_ext)) { $this->ref_ext = trim($this->ref_ext); } + // deprecated if (isset($this->ref_client)) { $this->ref_client = trim($this->ref_client); } + if (isset($this->ref_customer)) { + $this->ref_customer = trim($this->ref_customer); + } if (isset($this->increment)) { $this->increment = trim($this->increment); } @@ -2555,7 +2561,7 @@ class Facture extends CommonInvoice $sql .= " ref_ext=".(isset($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null").","; $sql .= " type=".(isset($this->type) ? $this->db->escape($this->type) : "null").","; $sql .= " subtype=".(isset($this->subtype) ? $this->db->escape($this->subtype) : "null").","; - $sql .= " ref_client=".(isset($this->ref_client) ? "'".$this->db->escape($this->ref_client)."'" : "null").","; + $sql .= " ref_client=".(isset($this->ref_customer) ? "'".$this->db->escape($this->ref_customer)."'" : (isset($this->ref_client) ? "'".$this->db->escape($this->ref_client)."'" : "null")).","; $sql .= " increment=".(isset($this->increment) ? "'".$this->db->escape($this->increment)."'" : "null").","; $sql .= " fk_soc=".(isset($this->socid) ? $this->db->escape($this->socid) : "null").","; $sql .= " datec=".(strval($this->date_creation) != '' ? "'".$this->db->idate($this->date_creation)."'" : 'null').","; @@ -2760,7 +2766,8 @@ class Facture extends CommonInvoice } if (!$error) { - $this->ref_client = $ref_client; + $this->ref_client = $ref_client; //deprecated + $this->ref_customer = $ref_client; } if (!$notrigger && empty($error)) { @@ -2773,7 +2780,8 @@ class Facture extends CommonInvoice } if (!$error) { - $this->ref_client = $ref_client; + $this->ref_client = $ref_client; //deprecated + $this->ref_customer = $ref_client; $this->db->commit(); return 1; diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index e6371094690..3a609b2a118 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -498,22 +498,29 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) { //var_dump($annee.' '.$year_end.' '.$mois.' '.$month_end); if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) { if ($annee_decalage > $minyear && $case <= $casenow) { - if (!empty($cumulative[$caseprev]) && !empty($cumulative[$case])) { - $percent = (round(($cumulative[$case] - $cumulative[$caseprev]) / $cumulative[$caseprev], 4) * 100); - //print "X $cumulative[$case] - $cumulative[$caseprev] - $cumulative[$caseprev] - $percent X"; + if ($modecompta=='CREANCES-DETTES') { + $cumulative_previous_year = (!empty($cumulative_ht[$caseprev])?$cumulative_ht[$caseprev]:0); + $cumulative_year = (!empty($cumulative_ht[$case])?$cumulative_ht[$case]:0); + } else { + $cumulative_previous_year = (!empty($cumulative[$caseprev])?$cumulative[$caseprev]:0); + $cumulative_year = (!empty($cumulative[$case])?$cumulative[$case]:0); + } + if (!empty($cumulative_previous_year) && !empty($cumulative_year)) { + $percent = (round(($cumulative_year - $cumulative_previous_year) / $cumulative_previous_year, 4) * 100); + //print "X $cumulative_year - $cumulative_previous_year - $cumulative_previous_year - $percent X"; print($percent >= 0 ? "+$percent" : "$percent").'%'; } - if (!empty($cumulative[$caseprev]) && empty($cumulative[$case])) { + if (!empty($cumulative_previous_year) && empty($cumulative_year)) { print '-100%'; } - if (empty($cumulative[$caseprev]) && !empty($cumulative[$case])) { + if (empty($cumulative_previous_year) && !empty($cumulative_year)) { //print '+Inf%'; print '-'; } - if (isset($cumulative[$caseprev]) && empty($cumulative[$caseprev]) && empty($cumulative[$case])) { + if (isset($cumulative_previous_year) && empty($cumulative_previous_year) && empty($cumulative_year)) { print '+0%'; } - if (!isset($cumulative[$caseprev]) && empty($cumulative[$case])) { + if (!isset($cumulative_previous_year) && empty($cumulative_year)) { print '-'; } } else { @@ -618,7 +625,7 @@ print ''.$langs->trans("Total").''; for ($annee = $year_start; $annee <= $year_end; $annee++) { if ($modecompta == 'CREANCES-DETTES') { // Montant total HT - if ($total_ht[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) { + if (isset($total_ht[$annee]) || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) { print ''; print(empty($total_ht[$annee]) ? '0' : price($total_ht[$annee])); print ""; @@ -638,19 +645,26 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) { // Pourcentage total if ($annee > $minyear && $annee <= max($nowyear, $maxyear)) { - if (!empty($total[$annee - 1]) && !empty($total[$annee])) { - $percent = (round(($total[$annee] - $total[$annee - 1]) / $total[$annee - 1], 4) * 100); + if ($modecompta == 'CREANCES-DETTES') { + $total_previous_year = (!empty($total_ht[$annee - 1])?$total_ht[$annee - 1]:0); + $total_year = (!empty($total_ht[$annee])?$total_ht[$annee]:0); + } else { + $total_previous_year = (!empty($total[$annee - 1])?$total[$annee - 1]:0); + $total_year = (!empty($total[$annee])?$total[$annee]:0); + } + if (!empty($total_previous_year) && !empty($total_year)) { + $percent = (round(($total_year - $total_previous_year) / $total_previous_year, 4) * 100); print ''; print($percent >= 0 ? "+$percent" : "$percent").'%'; print ''; } - if (!empty($total[$annee - 1]) && empty($total[$annee])) { + if (!empty($total_previous_year) && empty($total_year)) { print '-100%'; } - if (empty($total[$annee - 1]) && !empty($total[$annee])) { + if (empty($total_previous_year) && !empty($total_year)) { print '+'.$langs->trans('Inf').'%'; } - if (empty($total[$annee - 1]) && empty($total[$annee])) { + if (empty($total_previous_year) && empty($total_year)) { print '+0%'; } } else { diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index ca71e0df442..79cff89f228 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -1213,8 +1213,8 @@ class DolGraph $values[$x] = (is_numeric($tmpvalue) ? $tmpvalue : null); $arrayofgroupslegend[$i] = array( 'stacknum' => (int) $tmpykey[1], - 'legend' => $this->Legend[$tmpykey[1]], - 'legendwithgroup' => $this->Legend[$tmpykey[1]] . ' - ' . $tmpykey[2] + 'legend' => $this->Legend[$tmpykey[1]] ?? '', + 'legendwithgroup' => ($this->Legend[$tmpykey[1]] ?? '') . ' - ' . $tmpykey[2] ); } else { $tmpvalue = (array_key_exists('y_' . $i, $valarray) ? $valarray['y_' . $i] : $valarray[$i + 1]); diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index e920f35f098..6b1ab1cb007 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -1331,12 +1331,25 @@ class FormSetupItem public function generateOutputFieldColor() { global $langs; + $out = ''; $this->fieldAttr['disabled'] = null; $color = colorArrayToHex(colorStringToArray($this->fieldValue, array()), ''); - if ($color) { - return ''; + $useDefaultColor = false; + if (!$color && !empty($this->defaultFieldValue)) { + $color = $this->defaultFieldValue; + $useDefaultColor = true; } - return $langs->trans("Default"); + if ($color) { + $out.= ''; + } + + if ($useDefaultColor) { + $out.= ' '.$langs->trans("Default"); + } else { + $out.= ' #'.$color; + } + + return $out; } /** * generateInputFieldColor diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 30664b90218..348fe8a81e0 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -895,7 +895,7 @@ class FormTicket $ticketstat->loadCacheTypesTickets(); print ''; } print ''; + if (!$i) { + $totalarray['nbfield']++; + } } // Ref if (!empty($arrayfields['cf.ref']['checked'])) { @@ -2120,9 +2123,9 @@ if ($resql) { print ''; } print ''; - } - if (!$i) { - $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } } print "\n"; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index c5694200c8a..1a4ec0045d0 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1347,7 +1347,7 @@ if (empty($reshook)) { } $tva_tx = $lines[$i]->tva_tx; - if (!empty($lines[$i]->vat_src_code) && !preg_match('/\(/', $tva_tx)) { + if (!empty($lines[$i]->vat_src_code) && !preg_match('/\(/', (string) $tva_tx)) { $tva_tx .= ' ('.$lines[$i]->vat_src_code.')'; } diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 4e6e1feef22..8e2381466f8 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -421,6 +421,7 @@ InvoiceAutoValidate=Validate invoices automatically GeneratedFromRecurringInvoice=Generated from template recurring invoice %s DateIsNotEnough=Date not reached yet InvoiceGeneratedFromTemplate=Invoice %s generated from recurring template invoice %s +InvoiceGeneratedFromTemplateError=Error Invoice %s generated from recurring template invoice %s : %s GeneratedFromTemplate=Generated from template invoice %s WarningInvoiceDateInFuture=Warning, the invoice date is higher than current date WarningInvoiceDateTooFarInFuture=Warning, the invoice date is too far from current date @@ -666,6 +667,7 @@ MentionCategoryOfOperations0=Delivery of goods MentionCategoryOfOperations1=Provision of services MentionCategoryOfOperations2=Mixed - Delivery of goods & provision of services Salaries=Salaries +InvoiceSubtype=Invoice Subtype SalaryInvoice=Salary BillsAndSalaries=Bills & Salaries CreateCreditNoteWhenClientInvoiceExists=This option is enabled only when validated invoice(s) exist for a customer or when constant INVOICE_CREDIT_NOTE_STANDALONE is used(useful for some countries) diff --git a/htdocs/product/stats/supplier_proposal.php b/htdocs/product/stats/supplier_proposal.php index ba632ea3a59..df00f9381a6 100644 --- a/htdocs/product/stats/supplier_proposal.php +++ b/htdocs/product/stats/supplier_proposal.php @@ -108,7 +108,7 @@ if ($id > 0 || !empty($ref)) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - llxHeader("", "", $langs->trans("CardProduct".$product->type), '', 0, 0, '', '', '', '', 'mod-product page-stats_supplier_proposal'); + llxHeader("", $langs->trans("CardProduct".$product->type), '', '', 0, 0, '', '', '', 'mod-product page-stats_supplier_proposal'); if ($result > 0) { $head = product_prepare_head($product); diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index bed97fcfd14..9c23e556c57 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -1261,6 +1261,7 @@ foreach ($listofreferent as $key => $value) { } $num = count($elementarray); + $total_time = 0; for ($i = 0; $i < $num; $i++) { $tmp = explode('_', $elementarray[$i]); $idofelement = $tmp[0]; diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index 30ce84dfe04..2657cece25a 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -103,7 +103,7 @@ class RecruitmentCandidature extends CommonObject 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'comment' => "Id"), 'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => 1, 'visible' => 0, 'position' => 5, 'notnull' => 1, 'default' => '1', 'index' => 1), 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'visible' => 4, 'noteditable' => 1, 'default' => '(PROV)', 'index' => 1, 'searchall' => 1, 'showoncombobox' => 1, 'comment' => "Reference of candidature", 'csslist' => 'nowraponall'), - 'fk_recruitmentjobposition' => array('type' => 'integer:RecruitmentJobPosition:recruitment/class/recruitmentjobposition.class.php:0:(t.status:=:1)', 'label' => 'Job', 'enabled' => 1, 'position' => 15, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'picto' => 'recruitmentjobposition', 'css' => 'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist' => 'minwidth100 nowraponall'), + 'fk_recruitmentjobposition' => array('type' => 'integer:RecruitmentJobPosition:recruitment/class/recruitmentjobposition.class.php:0', 'label' => 'Job', 'enabled' => '1', 'position' => 15, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'picto' => 'recruitmentjobposition', 'css' => 'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist' => 'minwidth100 nowraponall'), 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 61, 'notnull' => 0, 'visible' => 0,), 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 62, 'notnull' => 0, 'visible' => 0,), 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => -1, 'visible' => -2, 'foreignkey' => 'user.rowid', 'csslist' => 'tdoverflowmax100'), @@ -261,6 +261,16 @@ class RecruitmentCandidature extends CommonObject } } } + + if (GETPOST("action", "aZ09") == 'create') { + $reg = array(); + preg_match('/^(integer|link):(.*):(.*):(.*):(.*)/i', $this->fields['fk_recruitmentjobposition']['type'], $reg); + if (!empty($reg)) { + $this->fields['fk_recruitmentjobposition']['type'] .= " AND (t.status:=:1)"; + } else { + $this->fields['fk_recruitmentjobposition']['type'] .= ":(t.status:=:1)"; + } + } } /** diff --git a/htdocs/takepos/public/auto_order.php b/htdocs/takepos/public/auto_order.php index 970044e2773..bb8472f5cab 100644 --- a/htdocs/takepos/public/auto_order.php +++ b/htdocs/takepos/public/auto_order.php @@ -35,7 +35,7 @@ if (!defined('NOBROWSERNOTIF')) { require '../../main.inc.php'; if (!getDolGlobalString('TAKEPOS_AUTO_ORDER')) { - accessforbidden('Auto order is not allwed'); // If Auto Order is disabled never allow access to this page (that is a NO LOGIN access) + accessforbidden('Auto order is not allowed'); // If Auto Order is disabled never allow access to this page (that is a NO LOGIN access) } $_SESSION["basiclayout"] = 1; // For the simple layout for public submission @@ -43,9 +43,9 @@ $_SESSION["takeposterminal"] = getDolGlobalInt('TAKEPOS_TERMINAL_NB_FOR_PUBLIC', define('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE', 1); if (GETPOSTISSET("mobilepage")) { - require DOL_URL_ROOT.'/takepos/invoice.php'; + require DOL_DOCUMENT_ROOT.'/takepos/invoice.php'; } elseif (GETPOSTISSET("genimg")) { require DOL_DOCUMENT_ROOT.'/takepos/genimg/index.php'; } else { - require DOL_URL_ROOT.'/takepos/phone.php'; + require DOL_DOCUMENT_ROOT.'/takepos/phone.php'; } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index da755e4c775..3fbb42ad89f 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1217,7 +1217,7 @@ if ($action == 'create' || $action == 'adduserldap') { } // Other form for user password - $parameters = array('valuetoshow' => $valuetoshow, 'password' => $password); + $parameters = array('valuetoshow' => $valuetoshow, 'password' => $password, 'caneditpasswordandsee' => $caneditpasswordandsee, 'caneditpasswordandsend' => $caneditpasswordandsend); $reshook = $hookmanager->executeHooks('printUserPasswordField', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if ($reshook > 0) { $valuetoshow = $hookmanager->resPrint; // to replace @@ -2041,7 +2041,7 @@ if ($action == 'create' || $action == 'adduserldap') { */ // Other form for user password - $parameters = array('valuetoshow' => $valuetoshow); + $parameters = array('valuetoshow' => $valuetoshow, 'caneditpasswordandsee' => $caneditpasswordandsee, 'caneditpasswordandsend' => $caneditpasswordandsend); $reshook = $hookmanager->executeHooks('printUserPasswordField', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if ($reshook > 0) { $valuetoshow = $hookmanager->resPrint; // to replace diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 1b7816b5bb6..2748f069cae 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -88,7 +88,7 @@ $hookmanager->initHooks(array('groupcard', 'globalcard')); $result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', $feature2); // Users/Groups management only in master entity if transverse mode -if (isModEnabled('multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) { +if (isModEnabled('multicompany') && $conf->entity > 1 && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) { accessforbidden(); }