diff --git a/build/doxygen/doxygen_footer.html b/build/doxygen/doxygen_footer.html index 8ffdc5341fe..1426885a565 100644 --- a/build/doxygen/doxygen_footer.html +++ b/build/doxygen/doxygen_footer.html @@ -10,7 +10,6 @@ File added into doxygen generated documentation
- @@ -24,13 +23,30 @@ File added into doxygen generated documentation + + + + + + - + + \ No newline at end of file diff --git a/build/doxygen/doxygen_header.html b/build/doxygen/doxygen_header.html index c83191268d7..5810182050f 100644 --- a/build/doxygen/doxygen_header.html +++ b/build/doxygen/doxygen_header.html @@ -30,7 +30,6 @@ src="https://www.facebook.com/tr?id=1998533953704960&ev=PageView&noscript=1" -
diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 44a12b76f36..52cb1370cfc 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -1,7 +1,7 @@ * Copyright (C) 2016 Florian Henry - * Copyright (C) 2016-2018 Alexandre Spangaro + * Copyright (C) 2016-2019 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -164,7 +164,7 @@ if ($action == 'export_csv') print $object->get_compte_desc($line->numero_compte) . $sep; print price($line->debit) . $sep; print price($line->credit) . $sep; - print price($line->credit - $line->debit) . $sep; + print price($line->debit - $line->credit) . $sep; print "\n"; } @@ -293,9 +293,9 @@ if ($action != 'export_csv') print '' . length_accountg($line->numero_compte) . ''; print '' . $description . ''; - print '' . price($line->debit) . ''; - print '' . price($line->credit) . ''; - print '' . price($line->credit - $line->debit) . ''; + print '' . price($line->debit) . ''; + print '' . price($line->credit) . ''; + print '' . price($line->debit - $line->credit) . ''; print '' . $link; print ''; print "\n"; @@ -305,11 +305,11 @@ if ($action != 'export_csv') $sous_total_credit += $line->credit; } - print '' . $langs->trans("SubTotal") . ':' . price($sous_total_debit) . '' . price($sous_total_credit) . '' . price(price2num($sous_total_credit - $sous_total_debit)) . ''; + print '' . $langs->trans("SubTotal") . ':' . price($sous_total_debit) . '' . price($sous_total_credit) . '' . price(price2num($sous_total_debit - $sous_total_credit)) . ''; print " \n"; print ''; - print '' . $langs->trans("AccountBalance") . ':' . price($total_debit) . '' . price($total_credit) . '' . price(price2num($total_credit - $total_debit)) . ''; + print '' . $langs->trans("AccountBalance") . ':' . price($total_debit) . '' . price($total_credit) . '' . price(price2num($total_debit - $total_credit)) . ''; print " \n"; print ''; diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 0d3980318a4..9591a24fa78 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -424,7 +424,7 @@ class AdherentType extends CommonObject global $langs; if ($morphy == 'phy') { return $langs->trans("Physical"); } elseif ($morphy == 'mor') { return $langs->trans("Moral"); } - else return $langs->trans("Physical & Morale"); + else return $langs->trans("MorPhy"); //return $morphy; } diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 233d2601871..849d787c220 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -283,7 +283,7 @@ if (! $rowid && $action != 'create' && $action != 'edit') print ''; if ($objp->morphy == 'phy') { print $langs->trans("Physical"); } elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); } - else print $langs->trans("Physical & Morale"); + else print $langs->trans("MorPhy"); print ''; print ''.yn($objp->subscription).''; print ''.yn($objp->vote).''; diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index b9a92f85d5e..60fb76293ea 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -746,13 +746,19 @@ class Categorie extends CommonObject /** * Return list of fetched instance of elements having this category * - * @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') - * @param int $onlyids Return only ids of objects (consume less memory) - * @return array|int -1 if KO, array of instance of object if OK + * @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') + * @param int $onlyids Return only ids of objects (consume less memory) + * @param int $limit Limit + * @param int $offset Offset + * @param string $sortfield Sort fields + * @param string $sortorder Sort order ('ASC' or 'DESC'); + * @return array|int -1 if KO, array of instance of object if OK * @see containsObject() */ - public function getObjectsInCateg($type, $onlyids = 0) + public function getObjectsInCateg($type, $onlyids = 0, $limit = 0, $offset = 0, $sortfield = '', $sortorder = 'ASC') { + global $user; + $objs = array(); $obj = new $this->MAP_OBJ_CLASS[$type]( $this->db ); @@ -761,8 +767,15 @@ class Categorie extends CommonObject $sql .= " FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type] . " as c"; $sql .= ", " . MAIN_DB_PREFIX . $this->MAP_OBJ_TABLE[$type] . " as o"; $sql .= " WHERE o.entity IN (" . getEntity($obj->element).")"; - $sql.= " AND c.fk_categorie = ".$this->id; + $sql .= " AND c.fk_categorie = ".$this->id; $sql .= " AND c.fk_" . $this->MAP_CAT_FK[$type] . " = o.rowid"; + // Protection for external users + if (($type == 'customer' || $type == 'supplier') && $user->societe_id > 0) + { + $sql.= " AND o.rowid = ".$user->societe_id; + } + if ($limit > 0 || $offset > 0) $sql .= $this->db->plimit($limit + 1, $offset); + $sql .= $this->db->order($sortfield, $sortorder); dol_syslog(get_class($this)."::getObjectsInCateg", LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index a7170b799a2..67ef7905235 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -34,13 +34,32 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; // Load translation files required by the page $langs->load("categories"); -$id = GETPOST('id', 'int'); -$label= GETPOST('label', 'alpha'); -$type = GETPOST('type', 'az09'); -$action=GETPOST('action', 'aZ09'); -$confirm = GETPOST('confirm', 'alpha'); +$id = GETPOST('id', 'int'); +$label = GETPOST('label', 'alpha'); +$type = GETPOST('type', 'az09'); $removeelem = GETPOST('removeelem', 'int'); -$elemid = GETPOST('elemid', 'alpha'); +$elemid = GETPOST('elemid', 'int'); + +$action = GETPOST('action', 'aZ09')?GETPOST('action', 'aZ09'):'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... +$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) +$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? +$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation +$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list +$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'myobjectlist'; // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') + + +// Load variable for pagination +$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; +$sortfield = GETPOST('sortfield', 'alpha'); +$sortorder = GETPOST('sortorder', 'alpha'); +$page = GETPOST('page', 'int'); +if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; if ($id == "" && $label == "") { @@ -319,10 +338,20 @@ else } +// List of mass actions available +$arrayofmassactions = array( + //'validate'=>$langs->trans("Validate"), + //'generate_doc'=>$langs->trans("ReGeneratePDF"), + //'builddoc'=>$langs->trans("PDFMerge"), + //'presend'=>$langs->trans("SendByMail"), +); +$massactionbutton=$form->selectMassAction('', $arrayofmassactions); + + // List of products or services (type is type of category) if ($type == Categorie::TYPE_PRODUCT) { - $prods = $object->getObjectsInCateg("product"); + $prods = $object->getObjectsInCateg("product", 0, $limit, $offset); if ($prods < 0) { dol_print_error($db, $prods->error, $prods->errors); @@ -351,14 +380,28 @@ if ($type == Categorie::TYPE_PRODUCT) print ''; } - print "
"; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($prods); $nbtotalofrecords = ''; $newcardbutton = ''; + print_barre_liste($langs->trans("ProductsAndServices"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit); + print "\n"; - print ''."\n"; + print ''."\n"; if (count($prods) > 0) { + $i = 0; foreach ($prods as $prod) { + $i++; + if ($i > $limit) break; + print "\t".''."\n"; print ''; } print "
'.$langs->trans("ProductsAndServices").' '.count($prods).'
'.$langs->trans("Ref").'
'; print $prod->getNomUrl(1); @@ -388,26 +431,42 @@ if ($type == Categorie::TYPE_PRODUCT) print '
'.$langs->trans("ThisCategoryHasNoProduct").'
\n"; + + print '
'."\n"; } } if ($type == Categorie::TYPE_SUPPLIER) { - $socs = $object->getObjectsInCateg("supplier"); + $socs = $object->getObjectsInCateg("supplier", 0, $limit, $offset); if ($socs < 0) { dol_print_error($db, $socs->error, $socs->errors); } else { - print "
"; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($socs); $nbtotalofrecords = ''; $newcardbutton = ''; + print_barre_liste($langs->trans("Suppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit); + print ''."\n"; - print '\n"; + print '\n"; if (count($socs) > 0) { + $i = 0; foreach ($socs as $soc) { + $i++; + if ($i > $limit) break; + print "\t".''."\n"; print ''; } print "
'.$langs->trans("Suppliers").' '.count($socs)."
'.$langs->trans("Name")."
'; print $soc->getNomUrl(1); @@ -437,30 +496,41 @@ if ($type == Categorie::TYPE_SUPPLIER) print '
'.$langs->trans("ThisCategoryHasNoSupplier").'
\n"; + + print '
'."\n"; } } if($type == Categorie::TYPE_CUSTOMER) { - $socs = $object->getObjectsInCateg("customer"); + $socs = $object->getObjectsInCateg("customer", 0, $limit, $offset); if ($socs < 0) { dol_print_error($db, $socs->error, $socs->errors); } else { - print "
"; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($socs); $nbtotalofrecords = ''; $newcardbutton = ''; + print_barre_liste($langs->trans("Customers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit); + print ''."\n"; - print ''."\n"; + print ''."\n"; if (count($socs) > 0) { $i = 0; foreach ($socs as $key => $soc) { - if ($user->societe_id > 0 && $soc->id != $user->societe_id) continue; // External user always see only themself - $i++; + if ($i > $limit) break; print "\t".''."\n"; print ''; } print "
'.$langs->trans("Customers").' '.count($socs).'
'.$langs->trans("Name").'
'; @@ -490,6 +560,8 @@ if($type == Categorie::TYPE_CUSTOMER) print '
'.$langs->trans("ThisCategoryHasNoCustomer").'
\n"; + + print '
'."\n"; } } @@ -498,21 +570,35 @@ if ($type == Categorie::TYPE_MEMBER) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; - $prods = $object->getObjectsInCateg("member"); + $prods = $object->getObjectsInCateg("member", 0, $limit, $offset); if ($prods < 0) { dol_print_error($db, $prods->error, $prods->errors); } else { - print "
"; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($prods); $nbtotalofrecords = ''; $newcardbutton = ''; + print_barre_liste($langs->trans("Member"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit); + print "\n"; - print ''."\n"; + print ''."\n"; if (count($prods) > 0) { + $i = 0; foreach ($prods as $key => $member) { + $i++; + if ($i > $limit) break; + print "\t".''."\n"; print ''; } print "
'.$langs->trans("Member").' '.count($prods).'
'.$langs->trans("Name").'
'; $member->ref=$member->login; @@ -543,22 +629,35 @@ if ($type == Categorie::TYPE_MEMBER) print '
'.$langs->trans("ThisCategoryHasNoMember").'
\n"; + + print '
'."\n"; } } // Categorie contact if ($type == Categorie::TYPE_CONTACT) { - $contacts = $object->getObjectsInCateg("contact"); + $contacts = $object->getObjectsInCateg("contact", 0, $limit, $offset); if ($contacts < 0) { dol_print_error($db, $contacts->error, $contacts->errors); } else { - print "
"; + + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($contacts); $nbtotalofrecords = ''; $newcardbutton = ''; + print_barre_liste($langs->trans("Contact"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit); + print ''."\n"; - print ''."\n"; + print ''."\n"; if (count($contacts) > 0) { @@ -566,6 +665,7 @@ if ($type == Categorie::TYPE_CONTACT) foreach ($contacts as $key => $contact) { $i++; + if ($i > $limit) break; print "\t".''."\n"; print ''; } print "
'.$langs->trans("Contact").' '.count($contacts).'
'.$langs->trans("Ref").'
'; @@ -595,6 +695,8 @@ if ($type == Categorie::TYPE_CONTACT) print '
'.$langs->trans("ThisCategoryHasNoContact").'
\n"; + + print '
'."\n"; } } @@ -603,21 +705,35 @@ if ($type == Categorie::TYPE_ACCOUNT) { require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - $accounts = $object->getObjectsInCateg("account"); + $accounts = $object->getObjectsInCateg("account", 0, $limit, $offset); if ($accounts < 0) { dol_print_error($db, $accounts->error, $accounts->errors); } else { - print "
"; - print "\n"; - print ''."\n"; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($accounts); $nbtotalofrecords = ''; $newcardbutton = ''; + print_barre_liste($langs->trans("Account"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit); + + print "
'.$langs->trans("Account").' '.count($accounts).'
\n"; + print ''."\n"; if (count($accounts) > 0) { + $i = 0; foreach ($accounts as $key => $account) { + $i++; + if ($i > $limit) break; + print "\t".''."\n"; print ''; } print "
'.$langs->trans("Ref").'
'; print $account->getNomUrl(1, 0); @@ -647,6 +763,8 @@ if ($type == Categorie::TYPE_ACCOUNT) print '
'.$langs->trans("ThisCategoryHasNoAccount").'
\n"; + + print ''."\n"; } } @@ -655,21 +773,35 @@ if ($type == Categorie::TYPE_PROJECT) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - $projects = $object->getObjectsInCateg("project"); + $projects = $object->getObjectsInCateg("project", 0, $limit, $offset); if ($projects < 0) { dol_print_error($db, $object->error, $object->errors); } else { - print "
"; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($projects); $nbtotalofrecords = ''; $newcardbutton = ''; + print_barre_liste($langs->trans("Project"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit); + print "\n"; - print ''."\n"; + print ''."\n"; if (count($projects) > 0) { + $i = 0; foreach ($projects as $key => $project) { + $i++; + if ($i > $limit) break; + print "\t".''."\n"; print ''; } print "
'.$langs->trans("Project").' '.count($projects).'
'.$langs->trans("Ref").'
'; print $project->getNomUrl(1); @@ -699,6 +831,8 @@ if ($type == Categorie::TYPE_PROJECT) print '
'.$langs->trans("ThisCategoryHasNoProject").'
\n"; + + print '
'."\n"; } } diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index b6f5d9328f8..88dfcef7d7f 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -835,7 +835,7 @@ else { // EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent. // You ensure that every user is using its own SMTP server when using the mass emailing module. - $linktoadminemailbefore=''; + $linktoadminemailbefore=''; $linktoadminemailend=''; setEventMessages($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), null, 'warnings'); setEventMessages($langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']), null, 'warnings'); diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index adb817f418f..a454ac80488 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -335,15 +335,15 @@ class Mailing extends CommonObject $target_array=array(); - $sql = "SELECT fk_contact, "; - $sql.=" lastname, "; - $sql.=" firstname,"; - $sql.=" email,"; - $sql.=" other,"; - $sql.=" source_url,"; - $sql.=" source_id ,"; - $sql.=" source_type "; - $sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles "; + $sql = "SELECT fk_contact,"; + $sql.= " lastname,"; + $sql.= " firstname,"; + $sql.= " email,"; + $sql.= " other,"; + $sql.= " source_url,"; + $sql.= " source_id ,"; + $sql.= " source_type"; + $sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles"; $sql.= " WHERE fk_mailing = ".$fromid; $result=$this->db->query($sql); @@ -353,14 +353,16 @@ class Mailing extends CommonObject { while ($obj = $this->db->fetch_object($result)) { - $target_array[]=array('fk_contact'=>$obj->fk_contact, - 'lastname'=>$obj->lastname, - 'firstname'=>$obj->firstname, - 'email'=>$obj->email, - 'other'=>$obj->other, - 'source_url'=>$obj->source_url, - 'source_id'=>$obj->source_id, - 'source_type'=>$obj->source_type); + $target_array[]=array( + 'fk_contact'=>$obj->fk_contact, + 'lastname'=>$obj->lastname, + 'firstname'=>$obj->firstname, + 'email'=>$obj->email, + 'other'=>$obj->other, + 'source_url'=>$obj->source_url, + 'source_id'=>$obj->source_id, + 'source_type'=>$obj->source_type + ); } } } diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 92ba7f621cb..9f9435a986c 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -739,8 +739,11 @@ class BonPrelevement extends CommonObject $sql = "SELECT count(f.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; - $sql.= " WHERE f.fk_statut = ".Facture::STATUS_VALIDATED; - $sql.= " AND f.entity IN (".getEntity('invoice').")"; + $sql.= " WHERE f.entity IN (".getEntity('invoice').")"; + if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) + { + $sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; + } $sql.= " AND f.rowid = pfd.fk_facture"; $sql.= " AND pfd.traite = 0"; $sql.= " AND f.total_ttc > 0"; diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index dce08c5c66b..7d9e22c45e7 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -208,7 +208,10 @@ $sql.= " ".MAIN_DB_PREFIX."societe as s,"; $sql.= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql.= " WHERE s.rowid = f.fk_soc"; $sql.= " AND f.entity IN (".getEntity('invoice').")"; -$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; +if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) +{ + $sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; +} $sql.= " AND f.total_ttc > 0"; $sql.= " AND pfd.traite = 0"; $sql.= " AND pfd.fk_facture = f.rowid"; diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index a34fde042e5..6c1ea278430 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -93,7 +93,10 @@ if ($socid) $sql.= " AND f.fk_soc = ".$socid; if (!$status) $sql.= " AND pfd.traite = 0"; if ($status) $sql.= " AND pfd.traite = ".$status; $sql.= " AND f.total_ttc > 0"; -$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; +if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) +{ + $sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; +} $sql.= " AND pfd.fk_facture = f.rowid"; if (dol_strlen(trim(GETPOST('search_societe', 'alpha')))) { diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index 44db7dd2625..468d4807c65 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -102,7 +102,10 @@ $sql.= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql.= " WHERE s.rowid = f.fk_soc"; $sql.= " AND f.entity IN (".getEntity('invoice').")"; $sql.= " AND f.total_ttc > 0"; -$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; +if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) +{ + $sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; +} $sql.= " AND pfd.traite = 0 AND pfd.fk_facture = f.rowid"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND f.fk_soc = ".$socid; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 430aad5e7e7..629fe589e56 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -433,7 +433,7 @@ if (empty($reshook)) } $qty = GETPOST('qty'.$predef); - $remise_percent = GETPOST('remise_percent'.$predef); + $remise_percent = ((GETPOST('remise_percent'.$predef) != '') ? GETPOST('remise_percent'.$predef) : 0); if ($qty == '') { @@ -566,7 +566,8 @@ if (empty($reshook)) $info_bits=0; if ($tva_npr) $info_bits |= 0x01; - if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS) )&& ($price_min && (price2num($pu_ht)*(1-price2num($remise_percent)/100) < price2num($price_min)))) + if (((! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) + || empty($conf->global->MAIN_USE_ADVANCED_PERMS) ) && ($price_min && (price2num($pu_ht)*(1-price2num($remise_percent)/100) < price2num($price_min)))) { $object->error = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); $result = -1 ; diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 416a0b46144..72116993505 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -173,7 +173,7 @@ class box_activity extends ModeleBoxes $totalnb += $data[$j]->nb; $this->info_box_contents[$line][3] = array( - 'td' => 'class="right"', + 'td' => 'class="nowrap right"', 'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency), ); $this->info_box_contents[$line][4] = array( @@ -256,7 +256,7 @@ class box_activity extends ModeleBoxes $totalnb += $data[$j]->nb; $this->info_box_contents[$line][3] = array( - 'td' => 'class="right"', + 'td' => 'class="nowrap right"', 'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency), ); $this->info_box_contents[$line][4] = array( @@ -340,7 +340,7 @@ class box_activity extends ModeleBoxes ); $this->info_box_contents[$line][3] = array( - 'td' => 'class="right"', + 'td' => 'class="nowrap right"', 'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency) ); diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 525562d308d..1928ac7cc94 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -134,7 +134,7 @@ class box_comptes extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'class="right"', + 'td' => 'class="right nowraponall"', 'text' => price($solde, 0, $langs, 0, -1, -1, $objp->currency_code) ); diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index bdecbde39de..095709c2ea8 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -179,12 +179,12 @@ class box_produits_alerte_stock extends ModeleBoxes } $this->info_box_contents[$line][] = array( - 'td' => 'class="right"', + 'td' => 'class="right nowraponall"', 'text' => $price, ); $this->info_box_contents[$line][] = array( - 'td' => 'class="nowrap"', + 'td' => 'class="right"', 'text' => $price_base_type, ); diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 59a3a8afec6..1ae1172de1d 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -135,7 +135,7 @@ class box_supplier_orders extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'class="right"', + 'td' => 'class="right nowrap"', 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency), ); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 25a557a47bd..a72046e8473 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4237,7 +4237,7 @@ class Form $formconfirm.= ''; $formconfirm.= $this->selectyesno("confirm", $newselectedchoice); $formconfirm.= ''; - $formconfirm.= 'trans("Validate").'">'; + $formconfirm.= ''; $formconfirm.= ''."\n"; $formconfirm.= ''."\n"; diff --git a/htdocs/core/modules/mailings/advthirdparties.modules.php b/htdocs/core/modules/mailings/advthirdparties.modules.php index a27863cf055..581fca03f8b 100644 --- a/htdocs/core/modules/mailings/advthirdparties.modules.php +++ b/htdocs/core/modules/mailings/advthirdparties.modules.php @@ -88,7 +88,6 @@ class mailing_advthirdparties extends MailingTargets dol_syslog(get_class($this)."::add_to_target_spec mailing ".$num." targets found", LOG_DEBUG); - $old = ''; while ($i < $num) { $obj = $this->db->fetch_object($result); @@ -144,7 +143,6 @@ class mailing_advthirdparties extends MailingTargets dol_syslog(get_class($this)."::add_to_target_spec mailing ".$num." targets found"); - $old = ''; while ($i < $num) { $obj = $this->db->fetch_object($result); diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index fc9c63e4a40..472e77e1974 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -78,6 +78,7 @@ print 'Option rebuild_product_thumbs (\'test\' or \'confirmed\') is '.(GETPOST(' print 'Option force_disable_of_modules_not_found (\'test\' or \'confirmed\') is '.(GETPOST('force_disable_of_modules_not_found', 'alpha')?GETPOST('force_disable_of_modules_not_found', 'alpha'):'undefined').'
'."\n"; print 'Option clean_perm_table (\'test\' or \'confirmed\') is '.(GETPOST('clean_perm_table', 'alpha')?GETPOST('clean_perm_table', 'alpha'):'undefined').'
'."\n"; print 'Option force_utf8_on_tables, for mysql/mariadb only (\'test\' or \'confirmed\') is '.(GETPOST('force_utf8_on_tables', 'alpha')?GETPOST('force_utf8_on_tables', 'alpha'):'undefined').'
'."\n"; +print 'Option repair_link_dispatch_lines_supplier_order_lines, (\'test\' or \'confirmed\') is '.(GETPOST('repair_link_dispatch_lines_supplier_order_lines', 'alpha')?GETPOST('repair_link_dispatch_lines_supplier_order_lines', 'alpha'):'undefined').'
'."\n"; print '
'; print ''; @@ -1275,6 +1276,144 @@ if ($ok && GETPOST('force_utf8_on_tables', 'alpha')) } } +// +if ($ok && GETPOST('repair_link_dispatch_lines_supplier_order_lines')) { + /* + * This script is meant to be run when upgrading from a dolibarr version < 3.8 + * to a newer version. + * + * Version 3.8 introduces a new column in llx_commande_fournisseur_dispatch, which + * matches the dispatch to a specific supplier order line (so that if there are + * several with the same product, the user can specifically tell which products of + * which line were dispatched where). + * + * However when migrating, the new column has a default value of 0, which means that + * old supplier orders whose lines were dispatched using the old dolibarr version + * have unspecific dispatch lines, which are not taken into account by the new version, + * thus making the order look like it was never dispatched at all. + * + * This scripts sets this foreign key to the first matching supplier order line whose + * product (and supplier order of course) are the same as the dispatch’s. + * + * If the dispatched quantity is more than indicated on the order line (this happens if + * there are several order lines for the same product), it creates new dispatch lines + * pointing to the other order lines accordingly, until all the dispatched quantity is + * accounted for. + */ + + $repair_link_dispatch_lines_supplier_order_lines = GETPOST('repair_link_dispatch_lines_supplier_order_lines', 'alpha'); + + + echo ''; + echo ''; + + $sql_dispatch = 'SELECT * FROM ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch WHERE COALESCE(fk_commandefourndet, 0) = 0'; + $db->begin(); + $resql_dispatch = $db->query($sql_dispatch); + $n_processed_rows = 0; + $errors = array(); + if ($resql_dispatch) { + if ($db->num_rows($resql_dispatch) == 0) { + echo ''; + exit; + } + while ($obj_dispatch = $db->fetch_object($resql_dispatch)) { + $sql_line = 'SELECT line.rowid, line.qty FROM ' . MAIN_DB_PREFIX . 'commande_fournisseurdet AS line' + . ' WHERE line.fk_commande = ' . $obj_dispatch->fk_commande + . ' AND line.fk_product = ' . $obj_dispatch->fk_product; + $resql_line = $db->query($sql_line); + + // s’il y a plusieurs lignes avec le même produit sur cette commande fournisseur, + // on divise la ligne de dispatch en autant de lignes qu’on en a sur la commande pour le produit + // et on met la quantité de la ligne dans la limite du "budget" indiqué par dispatch.qty + + $remaining_qty = $obj_dispatch->qty; + $first_iteration = true; + if (!$resql_line) { + echo ''; + $errors[] = $sql_line; + $n_processed_rows++; + continue; + } + if ($db->num_rows($resql_line) == 0) continue; + while ($obj_line = $db->fetch_object($resql_line)) { + if (!$remaining_qty) break; + if (!$obj_line->rowid) { + continue; + } + $qty_for_line = min($remaining_qty, $obj_line->qty); + if ($first_iteration) { + $sql_attach = 'UPDATE ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch' + . ' SET fk_commandefourndet = ' . $obj_line->rowid . ', qty = ' . $qty_for_line + . ' WHERE rowid = ' . $obj_dispatch->rowid; + $first_iteration = false; + } else { + $sql_attach_values = array( + $obj_dispatch->fk_commande, + $obj_dispatch->fk_product, + $obj_line->rowid, + $qty_for_line, + $obj_dispatch->fk_entrepot, + $obj_dispatch->fk_user, + $obj_dispatch->datec ? '"' . $db->escape($obj_dispatch->datec) . '"' : 'NULL', + $obj_dispatch->comment ? '"' . $db->escape($obj_dispatch->comment) . '"' : 'NULL', + $obj_dispatch->status ?: 'NULL', + $obj_dispatch->tms ? '"' . $db->escape($obj_dispatch->tms) . '"': 'NULL', + $obj_dispatch->batch ?: 'NULL', + $obj_dispatch->eatby ? '"' . $db->escape($obj_dispatch->eatby) . '"': 'NULL', + $obj_dispatch->sellby ? '"' . $db->escape($obj_dispatch->sellby) . '"': 'NULL' + ); + $sql_attach_values = join(', ', $sql_attach_values); + + $sql_attach = 'INSERT INTO ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch' + . ' (fk_commande, fk_product, fk_commandefourndet, qty, fk_entrepot, fk_user, datec, comment, status, tms, batch, eatby, sellby)' + . ' VALUES (' . $sql_attach_values . ')'; + } + + if ($repair_link_dispatch_lines_supplier_order_lines == 'confirmed') + { + $resql_attach = $db->query($sql_attach); + } + else + { + $resql_attach = true; // Force success in test mode + } + + if ($resql_attach) { + $remaining_qty -= $qty_for_line; + } else { + $errors[] = $sql_attach; + } + + $first_iteration = false; + } + $n_processed_rows++; + + // report progress every 256th row + if (!($n_processed_rows & 0xff)) { + echo '\n"; + flush(); + ob_flush(); + } + } + } else { + echo '\n"; + echo $sql_dispatch . "\n"; + } + echo '\n"; + echo '\n"; + + if (count($errors)) { + $db->rollback(); + echo ''; + } else { + $db->commit(); + } + $db->close(); + + echo ''; + echo ''; +} print '
Repair llx_commande_fournisseur_dispatch.fk_commandefourndet
Repair in progress. This may take a while.
Nothing to do.
Unable to find a matching supplier order line for dispatch #' . $obj_dispatch->rowid . '
Processed ' . $n_processed_rows . ' rows with ' . count($errors) . ' errors…' . "
Unable to find any dispatch without an fk_commandefourndet.' . "
Fixed ' . $n_processed_rows . ' rows with ' . count($errors) . ' errors…' . "
DONE.' . "
The transaction was rolled back due to errors: nothing was changed by the script.

SQL queries with errors:

' . join('
', $errors) . '
'; diff --git a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php index 41974ca8b79..854e7f37bd5 100644 --- a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php @@ -97,16 +97,14 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets * This is the main function that returns the array of emails * * @param int $mailing_id Id of emailing - * @param array $cibles Array with targets * @return int <0 if error, number of emails added if ok */ - public function add_to_target($mailing_id, $cibles) + public function add_to_target($mailing_id) { // phpcs:enable $target = array(); $j = 0; - $sql = " select rowid as id, email, firstname, lastname, plan, partner"; $sql.= " from ".MAIN_DB_PREFIX."myobject"; $sql.= " where email IS NOT NULL AND email != ''"; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 8d65a88acad..dd88c3dfa8a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -284,14 +284,14 @@ class Product extends CommonObject * @var int */ public $barcode_type; - + /** * Main Barcode type code * * @var string */ public $barcode_type_code; - + /** * Additional barcodes (Some products have different barcodes according to the country of origin of manufacture) * @@ -447,7 +447,7 @@ class Product extends CommonObject $error=0; // Clean parameters - $this->ref = dol_string_nospecial(trim($this->ref)); + $this->ref = dol_sanitizeFileName(dol_string_nospecial(trim($this->ref))); $this->label = trim($this->label); $this->price_ttc=price2num($this->price_ttc); $this->price=price2num($this->price); @@ -2052,7 +2052,7 @@ class Product extends CommonObject $sql.= " fk_price_expression, price_autogen"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; if ($id) { - $sql.= " WHERE rowid = ".$this->db->escape($id); + $sql.= " WHERE rowid = ".(int) $id; } else { $sql.= " WHERE entity IN (".getEntity($this->element).")"; if ($ref) { diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 9a97f49135d..6246fec5a4f 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -515,7 +515,7 @@ $moreforfilter=''; // If the user can view user other than himself $moreforfilter.='
'; $moreforfilter.='
'.$langs->trans('User'). '
'; -$includeonly='hierachyme'; +$includeonly='hierarchyme'; if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); $moreforfilter.=$form->select_dolusers($search_usertoprocessid?$search_usertoprocessid:$usertoprocess->id, 'search_usertoprocessid', $user->rights->user->user->lire?0:0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200 marginleftonly'); $moreforfilter.='
'; diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 6343d40cbf7..1bacbab465c 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -564,7 +564,7 @@ if (! empty($conf->categorie->enabled)) // If the user can view user other than himself $moreforfilter.='
'; $moreforfilter.='
'.$langs->trans('User'). '
'; -$includeonly='hierachyme'; +$includeonly='hierarchyme'; if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); $moreforfilter.=$form->select_dolusers($search_usertoprocessid?$search_usertoprocessid:$usertoprocess->id, 'search_usertoprocessid', $user->rights->user->user->lire?0:0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200'); $moreforfilter.='
'; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 03c814d65bf..40bebc5ce6a 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -515,7 +515,7 @@ if (! empty($conf->categorie->enabled)) // If the user can view user other than himself $moreforfilter.='
'; $moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': '; -$includeonly='hierachyme'; +$includeonly='hierarchyme'; if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); $moreforfilter.=$form->select_dolusers($search_project_user?$search_project_user:'', 'search_project_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth200'); $moreforfilter.='
'; diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index cf683671c5d..9defab81a73 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -393,6 +393,7 @@ class Stripe extends CommonObject { $metadata['dol_type'] = $object->element; $metadata['dol_id'] = $object->id; + if (is_object($object->thirdparty) && $object->thirdparty->id > 0) $metadata['dol_thirdparty_id'] = $object->thirdparty->id; } $dataforintent = array( diff --git a/htdocs/theme/md/img/title_ticket.png b/htdocs/theme/md/img/title_ticket.png new file mode 100644 index 00000000000..b1cf5df0e75 Binary files /dev/null and b/htdocs/theme/md/img/title_ticket.png differ diff --git a/htdocs/theme/md/img/title_ticketsup.png b/htdocs/theme/md/img/title_ticketsup.png deleted file mode 100644 index 3ec332075e6..00000000000 Binary files a/htdocs/theme/md/img/title_ticketsup.png and /dev/null differ