diff --git a/.github/workflows/pr-18-autolabel.yaml b/.github/workflows/pr-18-autolabel.yaml deleted file mode 100644 index feb9ee17c97..00000000000 --- a/.github/workflows/pr-18-autolabel.yaml +++ /dev/null @@ -1,21 +0,0 @@ -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 - continue-on-error: true diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml deleted file mode 100644 index 04c2c21d884..00000000000 --- a/.github/workflows/pr-18.yaml +++ /dev/null @@ -1,64 +0,0 @@ -name: Set reviewer for v18 -on: - pull_request: - types: [opened, synchronize, reopened] - branches: - - "18.0" - push: - branches: - - "18.0" - -jobs: - pr18: - runs-on: ubuntu-latest - - #env: - # GH_TOKEN: ${{ github.token }} - # GH_TOKENS: ${{ secrets.GITHUB_TOKEN }} - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - #- name: Install GitHub CLI - # run: | - # sudo apt update - # sudo apt install gh -y - - - name: Assign reviewer method 1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - url: ${{ github.event.pull_request.html_url }} - run: | - gh pr edit "$url" --add-assignee rycks --add-reviewer rycks - gh pr merge "$url" --merge --auto - continue-on-error: true - - - name: Assign reviewer method 2 - 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 "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 - gh auth setup-git - # shellcheck disable=2086 - gh pr edit $pr_number --add-reviewer "$REVIEWER" - continue-on-error: true diff --git a/dev/build/makepack-dolibarr.pl b/dev/build/makepack-dolibarr.pl index 346e39f860f..e9ee0c8a6cb 100755 --- a/dev/build/makepack-dolibarr.pl +++ b/dev/build/makepack-dolibarr.pl @@ -22,6 +22,8 @@ $PROJECT="dolibarr"; $PUBLISHBETARC="$ENV{'DESTIASSOLOGIN'}\@vmprod1.dolibarr.org:/home/dolibarr/asso.dolibarr.org/dolibarr_documents/website/www.dolibarr.org/files"; $PUBLISHSTABLE="$ENV{'DESTISFLOGIN'}\@frs.sourceforge.net:/home/frs/project/dolibarr"; +# due to implicit origin on git commands, example: implicit origin, lionel upstream, eric dolibarr +$GITREMOTENAME="$ENV{'GITREMOTENAME'}"; #@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","EXEDOLIWAMP","SNAPSHOT"); # Possible packages @LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","EXEDOLIWAMP","SNAPSHOT"); # Possible packages %REQUIREMENTPUBLISH=( @@ -118,6 +120,13 @@ if (! -d $ENV{"DESTIBETARC"} || ! -d $ENV{"DESTISTABLE"}) exit 1; } +if (! $ENV{"GITREMOTENAME"}) { + print "Error: environment variable GITREMOTENAME does not exist. You can set it to 'origin' or any other git remote name.\n"; + print "$PROG.$Extension aborted.\n"; + sleep 2; + exit 1; +} + # Detect OS type # -------------- if ("$^O" =~ /linux/i || (-d "/etc" && -d "/var" && "$^O" !~ /cygwin/i)) { $OS='linux'; $CR=''; } @@ -468,15 +477,15 @@ if ($nboftargetok) { { print 'Run git tag -a -f -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n"; $ret=`git tag -a -f -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD"`; - print 'Run git push -f --tags'."\n"; - $ret=`git push -f --tags`; + print 'Run git push $GITREMOTENAME -f --tags'."\n"; + $ret=`git push $GITREMOTENAME -f --tags`; #$ret=`git push -f origin "$MAJOR.$MINOR.$BUILD"`; } } else { - print 'Run git push --tags'."\n"; - $ret=`git push --tags`; + print 'Run git push $GITREMOTENAME --tags'."\n"; + $ret=`git push $GITREMOTENAME --tags`; #$ret=`git push origin "$MAJOR.$MINOR.$BUILD"`; } chdir("$olddir"); diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php index a05e7eda7c0..79497a6ebb6 100644 --- a/htdocs/accountancy/class/lettering.class.php +++ b/htdocs/accountancy/class/lettering.class.php @@ -649,7 +649,7 @@ class Lettering extends BookKeeping $grouped_lines = array(); foreach (self::$doc_type_infos as $doc_type => $doc_type_info) { - if (!is_array($bookkeeping_lines_by_type[$doc_type])) { + if (empty($bookkeeping_lines_by_type[$doc_type]) || !is_array($bookkeeping_lines_by_type[$doc_type])) { continue; } diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 26579c6e1b8..6c75c77d8c5 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -9,6 +9,7 @@ * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 William Mead * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -579,7 +580,7 @@ print ""; if (!isModEnabled('invoice')) { print ''; - if ((!isset($this->fields[$key]['default'])) || ($this->fields[$key]['notnull'] != 1) || $nbchoice >= 2) { + if ((!isset($this->fields[$key]['default'])) || empty($this->fields[$key]['notnull']) || ($this->fields[$key]['notnull'] != 1) || $nbchoice >= 2) { $out .= ''; } $out .= $tmpselect; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index cbc514f2975..82fc794185a 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -3237,7 +3237,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $original_file = $conf->fckeditor->dir_output.'/'.$original_file; } elseif ($modulepart == 'user' && !empty($conf->user->dir_output)) { // Wrapping for users - $canreaduser = (!empty($fuser->admin) || $fuser->hasRight('user', 'user', 'lire')); + $canreaduser = (!empty($fuser->admin) || $fuser->hasRight('user', 'user', $lire)); if ($fuser->id == (int) $refname) { $canreaduser = 1; } // A user can always read its own card @@ -3632,7 +3632,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, exit; } - // Check fuser->rights->modulepart->myobject->read and fuser->rights->modulepart->read + // Check fuser->hasRight('modulepart', 'myobject', 'read') and fuser->hasRight('modulepart', 'read') $partsofdirinoriginalfile = explode('/', $original_file); if (!empty($partsofdirinoriginalfile[1])) { // If original_file is xxx/filename (xxx is a part we will use) $partofdirinoriginalfile = $partsofdirinoriginalfile[0]; diff --git a/htdocs/document.php b/htdocs/document.php index b1fd01ab77e..1554e3da5dc 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -136,7 +136,7 @@ $original_file = GETPOST('file', 'alphanohtml'); $hashp = GETPOST('hashp', 'aZ09'); $modulepart = GETPOST('modulepart', 'alpha'); $urlsource = GETPOST('urlsource', 'alpha'); -$entity = GETPOSTINT('entity'); +$entity = GETPOSTISSET('entity') ? GETPOSTINT('entity') : $conf->entity; // Security check if (empty($modulepart) && empty($hashp)) { diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 2332e97dac4..a99db15abe6 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -414,9 +414,6 @@ if (empty($reshook)) { $user->fetch($object->fk_user_author); $newlang = $user->lang; } - if (empty($newlang)) { - $newlang = $langs; - } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); @@ -536,9 +533,6 @@ if (empty($reshook)) { $user->fetch($object->fk_user_author); $newlang = $user->lang; } - if (empty($newlang)) { - $newlang = $langs; - } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); @@ -653,9 +647,6 @@ if (empty($reshook)) { $user->fetch($object->fk_user_author); $newlang = $user->lang; } - if (empty($newlang)) { - $newlang = $langs; - } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); @@ -774,9 +765,6 @@ if (empty($reshook)) { $user->fetch($object->fk_user_author); $newlang = $user->lang; } - if (empty($newlang)) { - $newlang = $langs; - } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); @@ -895,9 +883,6 @@ if (empty($reshook)) { $user->fetch($object->fk_user_author); $newlang = $user->lang; } - if (empty($newlang)) { - $newlang = $langs; - } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); @@ -1014,9 +999,6 @@ if (empty($reshook)) { $user->fetch($object->fk_user_author); $newlang = $user->lang; } - if (empty($newlang)) { - $newlang = $langs; - } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); @@ -1058,9 +1040,6 @@ if (empty($reshook)) { $user->fetch($object->fk_user_author); $newlang = $user->lang; } - if (empty($newlang)) { - $newlang = $langs; - } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); @@ -1092,9 +1071,6 @@ if (empty($reshook)) { $user->fetch($object->fk_user_author); $newlang = $user->lang; } - if (empty($newlang)) { - $newlang = $langs; - } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); @@ -1331,12 +1307,6 @@ if (empty($reshook)) { $user->fetch($object->fk_user_author); $newlang = $user->lang; } - if (empty($newlang)) { - $newlang = $langs; - } - if (empty($newlang)) { - $newlang = $langs; - } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); @@ -1436,9 +1406,6 @@ if (empty($reshook)) { $user->fetch($object->fk_user_author); $newlang = $user->lang; } - if (empty($newlang)) { - $newlang = $langs; - } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); diff --git a/htdocs/expensereport/payment/list.php b/htdocs/expensereport/payment/list.php index e2de21d0653..84a36db3513 100644 --- a/htdocs/expensereport/payment/list.php +++ b/htdocs/expensereport/payment/list.php @@ -58,6 +58,7 @@ $massaction = GETPOST('massaction', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'vendorpaymentlist'; $mode = GETPOST('mode', 'alpha'); +$toselect = GETPOSTISSET('toselect') ? GETPOST('toselect', 'array:int') : array(); $socid = GETPOSTINT('socid'); diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index a02f50e76ed..5ef204a9939 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -347,7 +347,7 @@ class Fichinter extends CommonObject $sql .= ", ".((int) $this->fk_project > 0 ? ((int) $this->fk_project) : 0); $sql .= ", ".((int) $this->fk_contrat > 0 ? ((int) $this->fk_contrat) : 0); $sql .= ", ".((int) $this->status); - $sql .= ", ".($this->signed_status); + $sql .= ", ".((int) $this->signed_status); $sql .= ", ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : "null"); $sql .= ", ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : "null"); $sql .= ")"; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 4cd2b8ba815..a7d241193da 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -513,6 +513,7 @@ class CommandeFournisseur extends CommonOrder $sql .= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_label, cr.libelle_facture as cond_reglement_doc,"; $sql .= " p.code as mode_reglement_code, p.libelle as mode_reglement_libelle"; $sql .= ', c.fk_incoterms, c.location_incoterms'; + $sql .= ', c.last_main_doc'; $sql .= ', i.libelle as label_incoterms'; $sql .= " FROM ".$this->db->prefix()."commande_fournisseur as c"; $sql .= " LEFT JOIN ".$this->db->prefix()."c_payment_term as cr ON c.fk_cond_reglement = cr.rowid"; @@ -550,6 +551,7 @@ class CommandeFournisseur extends CommonOrder $this->statut = $obj->status; // deprecated $this->status = $obj->status; $this->billed = $obj->billed; + $this->last_main_doc = $obj->last_main_doc; $this->user_author_id = $obj->user_author_id; $this->user_validation_id = $obj->user_validation_id; $this->user_approve_id = $obj->user_approve_id; diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 0b64111cca1..8521a485ebc 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -320,3 +320,9 @@ TaskStatus=Task status TaskReopened=Task reopened ThisContactHasAUser=Warning, you must assign the associated user of this contact (the user '%s', and not the contact '%s') if you want to give access permission on this object to the respective user contact. TasksToDo=Tasks to do +CloneChanges=Recalculate date of task +CloneAffectation=Clone assignations +CloneProgression=Clone progression +CloneTimes=Clone times +CloneFile=Clone files +ConfirmCloneTask=Do you want to clone this task? diff --git a/htdocs/mrp/mo_agenda.php b/htdocs/mrp/mo_agenda.php index b657aa4b124..9ae27d12263 100644 --- a/htdocs/mrp/mo_agenda.php +++ b/htdocs/mrp/mo_agenda.php @@ -55,6 +55,12 @@ $cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'moagenda'; // To manage different context of search +// Protection +$socid = 0; +if ($user->socid > 0) { + $socid = $user->socid; +} + if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) { @@ -95,7 +101,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || !empty($ref)) { - $upload_dir = $conf->mrp->multidir_output[$object->entity]."/".$object->id; + $upload_dir = (empty($conf->mrp->multidir_output[$object->entity]) ? $conf->mrp->dir_output : $conf->mrp->multidir_output[$object->entity])."/".$object->id; } // Security check - Protection if external user @@ -240,7 +246,10 @@ if ($object->id > 0) { print ''; if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { - $param = '&id='.$object->id.'&socid='.$socid; + $param = '&id='.$object->id; + if (!empty($socid)) { + $param .= '&socid='.$socid; + } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index d2918ad6fee..f0c660f63fc 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -1,8 +1,9 @@ - * Copyright (C) 2018 All-3kcis - * Copyright (C) 2021 Noé Cendrier - * Copyright (C) 2024 Frédéric France +/* Copyright (C) 2007-2018 Laurent Destailleur + * Copyright (C) 2018 All-3kcis + * Copyright (C) 2021 Noé Cendrier + * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 Alexandre Spangaro * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -22,8 +23,7 @@ /** * \file product/stock/productlot_card.php * \ingroup stock - * \brief This file is an example of a php page - * Initially built by build_class_from_table on 2016-05-17 12:22 + * \brief Batch/series card on products */ // Load Dolibarr environment @@ -287,8 +287,10 @@ if (empty($reshook)) { $form = new Form($db); $formfile = new FormFile($db); -$title = $langs->trans("ProductLot"); $help_url = ''; +$shortlabel = dol_trunc($object->batch, 16); +$title = $langs->trans('Batch')." ".$shortlabel." - ".$langs->trans('Card'); +$help_url = 'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-product page-stock_productlot_card'); diff --git a/htdocs/product/stock/productlot_document.php b/htdocs/product/stock/productlot_document.php index a53aafa557f..4122ab756a6 100644 --- a/htdocs/product/stock/productlot_document.php +++ b/htdocs/product/stock/productlot_document.php @@ -1,14 +1,15 @@ - * Copyright (C) 2004-2010 Laurent Destailleur - * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2005 Simon TOSSER - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2018 All-3kcis - * Copyright (C) 2024 Frédéric France +/* Copyright (C) 2003-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2005 Simon TOSSER + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2018 All-3kcis + * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -48,7 +49,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php'; */ // Load translation files required by the page -$langs->loadLangs(array('other', 'products')); +$langs->loadLangs(array('other', 'products', 'productbatch')); $id = GETPOSTINT('id'); $ref = GETPOST('ref', 'alpha'); @@ -153,12 +154,16 @@ if (empty($reshook)) { $form = new Form($db); -llxHeader('', $langs->trans('ProductLot'), '', '', 0, 0, '', '', '', 'mod-product page-stock_productlot_document'); +$help_url = ''; +$shortlabel = dol_trunc($object->batch, 16); +$title = $langs->trans('Batch')." ".$shortlabel." - ".$langs->trans('Documents'); +$help_url = 'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; +llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-product page-stock_productlot_document'); if ($object->id) { $head = productlot_prepare_head($object); - print dol_get_fiche_head($head, 'documents', $langs->trans("Batch"), -1, 'barcode'); + print dol_get_fiche_head($head, 'documents', $langs->trans("Batch"), -1, $object->picto); $parameters = array(); diff --git a/htdocs/product/stock/productlot_note.php b/htdocs/product/stock/productlot_note.php index e90fa8ccfa2..8abd6a7e9e5 100644 --- a/htdocs/product/stock/productlot_note.php +++ b/htdocs/product/stock/productlot_note.php @@ -1,6 +1,7 @@ * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2025 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; */ // Load translation files required by the page -$langs->loadLangs(array('other', 'products')); +$langs->loadLangs(array('other', 'products', 'productbatch')); // Get parameters $id = GETPOSTINT('id'); @@ -86,8 +87,11 @@ if (empty($reshook)) { $form = new Form($db); -$help_url = ''; -llxHeader('', $langs->trans('ProductLot'), $help_url, '', 0, 0, '', '', '', 'mod-product page-stock_productlot_note'); +$shortlabel = dol_trunc($object->batch, 16); +$title = $langs->trans('Batch')." ".$shortlabel." - ".$langs->trans('Notes'); +$help_url = 'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; + +llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-product page-stock_productlot_note'); if ($id > 0 || !empty($ref)) { $object->fetch_thirdparty(); @@ -98,7 +102,7 @@ if ($id > 0 || !empty($ref)) { // Object card // ------------------------------------------------------------ - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'batch'); diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index b98a6b5c5d2..17165bdee10 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -98,7 +98,8 @@ if (empty($reshook)) { if ($action == 'delete' && GETPOST('langtodelete', 'alpha') && $usercancreate) { $object->delMultiLangs(GETPOST('langtodelete', 'alpha'), $user); setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); - $action = ''; + header('Location:'.$_SERVER['PHP_SELF'].'?id='.$id); + exit; } // Add translation @@ -127,7 +128,8 @@ if (empty($reshook)) { } if ($result > 0) { - $action = ''; + header('Location:'.$_SERVER['PHP_SELF'].'?id='.$id); + exit; } else { $action = 'add'; setEventMessages($object->error, $object->errors, 'errors'); @@ -154,7 +156,8 @@ if (empty($reshook)) { $result = $object->setMultiLangs($user); if ($result > 0) { - $action = ''; + header('Location:'.$_SERVER['PHP_SELF'].'?id='.$id); + exit; } else { $action = 'edit'; setEventMessages($object->error, $object->errors, 'errors'); @@ -167,7 +170,8 @@ if (empty($reshook)) { $result = $object->delMultiLangs($langtodelete, $user); if ($result > 0) { - $action = ''; + header('Location:'.$_SERVER['PHP_SELF'].'?id='.$id); + exit; } else { $action = 'edit'; setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 96426c4e79e..d1921285615 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1708,18 +1708,21 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { // Buttons Create if (!getDolGlobalString('PROJECT_HIDE_CREATE_OBJECT_BUTTON')) { + // We check the type of thirdparty + $is_customer_or_prospect = (!empty($object->thirdparty->prospect) || !empty($object->thirdparty->client)); + $is_supplier_only= (!empty($object->thirdparty->fournisseur) && $is_customer_or_prospect == false); + $arrayforbutaction = array( - //1 => array('lang' => 'propal', 'enabled' => 1, 'perm' => 1, 'label' => 'XXX'), - 10 => array('lang' => 'propal', 'enabled' => isModEnabled("propal"), 'perm' => $user->hasRight('propal', 'creer') ? true : false, 'label' => 'AddProp', 'url' => '/comm/propal/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), - 20 => array('lang' => 'orders', 'enabled' => isModEnabled("order"), 'perm' => $user->hasRight('commande', 'creer') ? true : false, 'label' => 'CreateOrder', 'url' => '/commande/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), - 30 => array('lang' => 'bills', 'enabled' => isModEnabled("invoice"), 'perm' => $user->hasRight('facture', 'creer') ? true : false, 'label' => 'CreateBill', 'url' => '/compta/facture/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), - 40 => array('lang' => 'supplier_proposal', 'enabled' => isModEnabled("supplier_proposal"), 'perm' => $user->hasRight('supplier_proposal', 'creer') ? true : false, 'label' => 'AddSupplierProposal', 'url' => '/supplier_proposal/card.php?action=create&projectid='.$object->id), - 50 => array('lang' => 'suppliers', 'enabled' => isModEnabled("supplier_order"), 'perm' => $user->hasRight('fournisseur', 'commande', 'creer') ? true : false, 'label' => 'AddSupplierOrder', 'url' => '/fourn/commande/card.php?action=create&projectid='.$object->id), - 60 => array('lang' => 'suppliers', 'enabled' => isModEnabled("supplier_invoice"), 'perm' => $user->hasRight('fournisseur', 'facture', 'creer') ? true : false, 'label' => 'AddSupplierInvoice', 'url' => '/fourn/facture/card.php?action=create&projectid='.$object->id), - 70 => array('lang' => 'interventions', 'enabled' => isModEnabled("intervention"), 'perm' => $user->hasRight('fichinter', 'creer') ? true : false, 'label' => 'AddIntervention', 'url' => '/fichinter/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), - 80 => array('lang' => 'contracts', 'enabled' => isModEnabled("contract"), 'perm' => $user->hasRight('contrat', 'creer') ? true : false, 'label' => 'AddContract', 'url' => '/contrat/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), - 90 => array('lang' => 'trips', 'enabled' => isModEnabled("expensereport"), 'perm' => $user->hasRight('expensereport', 'creer') ? true : false, 'label' => 'AddTrip', 'url' => '/expensereport/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), - 100 => array('lang' => 'donations', 'enabled' => isModEnabled("don"), 'perm' => $user->hasRight('don', 'creer') ? true : false, 'label' => 'AddDonation', 'url' => '/don/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 10 => array('lang'=>'propal', 'enabled' => (isModEnabled("propal") && $is_customer_or_prospect == true), 'perm' => $user->hasRight('propal', 'creer') ? true : false, 'label' => 'AddProp', 'url'=>'/comm/propal/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 20 => array('lang'=>'orders', 'enabled' => (isModEnabled("order") && $is_customer_or_prospect == true), 'perm' => $user->hasRight('commande', 'creer') ? true : false, 'label' => 'CreateOrder', 'url'=>'/commande/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 30 => array('lang'=>'bills', 'enabled' => (isModEnabled("invoice") && $is_customer_or_prospect == true), 'perm' => $user->hasRight('facture', 'creer') ? true : false, 'label' => 'CreateBill', 'url'=>'/compta/facture/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 40 => array('lang'=>'supplier_proposal', 'enabled' => isModEnabled("supplier_proposal"), 'perm' => $user->hasRight('supplier_proposal', 'creer') ? true : false, 'label' => 'AddSupplierProposal', 'url'=>'/supplier_proposal/card.php?action=create&projectid='.$object->id.($is_supplier_only == true ? '&socid='.$object->socid : '')), + 50 => array('lang'=>'suppliers', 'enabled' => isModEnabled("supplier_order"), 'perm' => $user->hasRight('fournisseur', 'commande', 'creer') ? true : false, 'label' => 'AddSupplierOrder', 'url'=>'/fourn/commande/card.php?action=create&projectid='.$object->id.($is_supplier_only == true ? '&socid='.$object->socid : '')), + 60 => array('lang'=>'suppliers', 'enabled' => isModEnabled("supplier_invoice"), 'perm' => $user->hasRight('fournisseur', 'facture', 'creer') ? true : false, 'label' => 'AddSupplierInvoice', 'url'=>'/fourn/facture/card.php?action=create&projectid='.$object->id.($is_supplier_only == true ? '&socid='.$object->socid : '')), + 70 => array('lang'=>'interventions', 'enabled' => isModEnabled("intervention"), 'perm' => $user->hasRight('fichinter', 'creer') ? true : false, 'label' => 'AddIntervention', 'url'=>'/fichinter/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 80 => array('lang'=>'contracts', 'enabled' => isModEnabled("contract"), 'perm' => $user->hasRight('contrat', 'creer') ? true : false, 'label' => 'AddContract', 'url'=>'/contrat/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 90 => array('lang'=>'trips', 'enabled' => isModEnabled("expensereport"), 'perm' => $user->hasRight('expensereport', 'creer') ? true : false, 'label' => 'AddTrip', 'url'=>'/expensereport/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 100 => array('lang'=>'donations', 'enabled' => isModEnabled("don"), 'perm' => $user->hasRight('don', 'creer') ? true : false, 'label' => 'AddDonation', 'url'=>'/don/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), ); $params = array('backtopage' => $_SERVER["PHP_SELF"].'?id='.$object->id); diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 04f42adee4c..14eaad6fcab 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1691,6 +1691,8 @@ class Reception extends CommonObject if ($resql) { // Set order billed if 100% of order is received (qty in reception lines match qty in order lines) if ($this->origin == 'order_supplier' && $this->origin_id > 0) { + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; + $order = new CommandeFournisseur($this->db); $order->fetch($this->origin_id); @@ -1953,6 +1955,8 @@ class Reception extends CommonObject } if (!$error && $this->origin == 'order_supplier') { + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; + $commande = new CommandeFournisseur($this->db); $commande->fetch($this->origin_id); $result = $commande->setStatus($user, 4); diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index feadcecac41..b833e10c3c6 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1260,6 +1260,7 @@ class SupplierProposal extends CommonObject $sql .= ", p.fk_mode_reglement"; $sql .= ', p.fk_account'; $sql .= ", p.fk_shipping_method"; + $sql .= ", p.last_main_doc"; $sql .= ", p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc"; $sql .= ", c.label as statut_label"; $sql .= ", cr.code as cond_reglement_code, cr.libelle as cond_reglement, cr.libelle_facture as cond_reglement_libelle_doc"; @@ -1306,6 +1307,7 @@ class SupplierProposal extends CommonObject $this->delivery_date = $this->db->jdate($obj->delivery_date); $this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null; + $this->last_main_doc = $obj->last_main_doc; $this->mode_reglement_id = $obj->fk_mode_reglement; $this->mode_reglement_code = $obj->mode_reglement_code; $this->mode_reglement = $obj->mode_reglement;