diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index c94084358bd..d20bd784ced 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -100,7 +100,7 @@ if ($action == 'set_default') { } else { dol_print_error($db); } -} elseif ($action == 'updateall') { +} elseif ($action == 'updatemainoptions') { $db->begin(); $res1 = $res2 = $res3 = $res4 = $res5 = $res6 = $res7 = 0; $res1 = dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha') ? 0 : 1, 'chaine', 0, '', $conf->entity); @@ -123,6 +123,35 @@ if ($action == 'set_default') { setEventMessages('RecordModifiedSuccessfully', null, 'mesgs'); $db->commit(); } +} elseif ($action == 'updatememberscards') { + $db->begin(); + $res1 = $res2 = $res3 = $res4 = 0; + $res1 = dolibarr_set_const($db, 'ADHERENT_CARD_TYPE', GETPOST('ADHERENT_CARD_TYPE'), 'chaine', 0, '', $conf->entity); + $res2 = dolibarr_set_const($db, 'ADHERENT_CARD_HEADER_TEXT', GETPOST('ADHERENT_CARD_HEADER_TEXT', 'alpha'), 'chaine', 0, '', $conf->entity); + $res3 = dolibarr_set_const($db, 'ADHERENT_CARD_TEXT', GETPOST('ADHERENT_CARD_TEXT', 'alpha'), 'chaine', 0, '', $conf->entity); + $res3 = dolibarr_set_const($db, 'ADHERENT_CARD_TEXT_RIGHT', GETPOST('ADHERENT_CARD_TEXT_RIGHT', 'alpha'), 'chaine', 0, '', $conf->entity); + $res4 = dolibarr_set_const($db, 'ADHERENT_CARD_FOOTER_TEXT', GETPOST('ADHERENT_CARD_FOOTER_TEXT', 'alpha'), 'chaine', 0, '', $conf->entity); + + if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0) { + setEventMessages('ErrorFailedToSaveDate', null, 'errors'); + $db->rollback(); + } else { + setEventMessages('RecordModifiedSuccessfully', null, 'mesgs'); + $db->commit(); + } +} elseif ($action == 'updatememberstickets') { + $db->begin(); + $res1 = $res2 = 0; + $res1 = dolibarr_set_const($db, 'ADHERENT_ETIQUETTE_TYPE', GETPOST('ADHERENT_ETIQUETTE_TYPE'), 'chaine', 0, '', $conf->entity); + $res2 = dolibarr_set_const($db, 'ADHERENT_ETIQUETTE_TEXT', GETPOST('ADHERENT_ETIQUETTE_TEXT', 'alpha'), 'chaine', 0, '', $conf->entity); + + if ($res1 < 0 || $res2 < 0) { + setEventMessages('ErrorFailedToSaveDate', null, 'errors'); + $db->rollback(); + } else { + setEventMessages('RecordModifiedSuccessfully', null, 'mesgs'); + $db->commit(); + } } // Action to update or add a constant @@ -130,6 +159,7 @@ if ($action == 'update' || $action == 'add') { $constname = GETPOST('constname', 'alpha'); $constvalue = (GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue')); + if (($constname == 'ADHERENT_CARD_TYPE' || $constname == 'ADHERENT_ETIQUETTE_TYPE' || $constname == 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && $constvalue == -1) { $constvalue = ''; } @@ -195,10 +225,10 @@ print dol_get_fiche_head($head, 'general', $langs->trans("Members"), -1, 'user') print '
'; print ''; -print ''; +print ''; -// Mains options +// Main options print load_fiche_titre($langs->trans("MemberMainOptions"), '', ''); @@ -294,6 +324,8 @@ print '
'; print '
'; +// Document templates for documents generated from member record + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); // Defined model definition table @@ -431,24 +463,12 @@ print ''; -/* -TODO Use a global form instead of embeded form into table + +// Generation of cards for members + print '
'; print ''; -print ''; -*/ - -/* - * Edit info of model document - */ -$constantes = array( - 'ADHERENT_CARD_TYPE', - //'ADHERENT_CARD_BACKGROUND', - 'ADHERENT_CARD_HEADER_TEXT', - 'ADHERENT_CARD_TEXT', - 'ADHERENT_CARD_TEXT_RIGHT', - 'ADHERENT_CARD_FOOTER_TEXT' -); +print ''; print load_fiche_titre($langs->trans("MembersCards"), '', ''); @@ -457,15 +477,65 @@ $helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULL $helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, '; $helptext .= '__YEAR__, __MONTH__, __DAY__'; -form_constantes($constantes, 0, $helptext); +print '
'; +print ''; +print ''; +print ''; +print ''; +print "\n"; + +// Format of cards page +print '\n"; + +// Text printed on top of member cards +print '\n"; + +// Text printed on member cards (align on left) +print '\n"; + +// Text printed on member cards (align on right) +print '\n"; + +// Text printed on bottom of member cards +print '\n"; + +print '
'.$langs->trans("Description").''.$form->textwithpicto($langs->trans("Value"), $helptext, 1, 'help', '', 0, 2, 'idhelptext').'
'.$langs->trans("DescADHERENT_CARD_TYPE").''; + +require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php'; // List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php) +$arrayoflabels = array(); +foreach (array_keys($_Avery_Labels) as $codecards) { + $arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name']; +} +print $form->selectarray('ADHERENT_CARD_TYPE', $arrayoflabels, getDolGlobalString('ADHERENT_CARD_TYPE') ? getDolGlobalString('ADHERENT_CARD_TYPE') : 'CARD', 1, 0, 0); + +print "
'.$langs->trans("DescADHERENT_CARD_HEADER_TEXT").''; +print ''; +print "
'.$langs->trans("DescADHERENT_CARD_TEXT").''; +print ''; +print "
'.$langs->trans("DescADHERENT_CARD_TEXT_RIGHT").''; +print ''; +print "
'.$langs->trans("DescADHERENT_CARD_FOOTER_TEXT").''; +print ''; +print "
'; +print '
'; + +print '
'; +print ''; +print '
'; + +print '
'; print '
'; +// Membership address sheet -/* - * Edit info of model document - */ -$constantes = array('ADHERENT_ETIQUETTE_TYPE', 'ADHERENT_ETIQUETTE_TEXT'); +print '
'; +print ''; +print ''; print load_fiche_titre($langs->trans("MembersTickets"), '', ''); @@ -474,9 +544,42 @@ $helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULL $helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, '; $helptext .= '__YEAR__, __MONTH__, __DAY__'; -form_constantes($constantes, 0, $helptext); +print '
'; +print ''; +print ''; +print ''; +print ''; +print "\n"; -//print ''; +// Format of labels page +print '\n"; + +// Text printed on member address sheets +print '\n"; + +print '
'.$langs->trans("Description").''.$form->textwithpicto($langs->trans("Value"), $helptext, 1, 'help', '', 0, 2, 'idhelptext').'
'.$langs->trans("DescADHERENT_ETIQUETTE_TYPE").''; + +require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php'; // List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php) +$arrayoflabels = array(); +foreach (array_keys($_Avery_Labels) as $codecards) { + $arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name']; +} +print $form->selectarray('ADHERENT_ETIQUETTE_TYPE', $arrayoflabels, getDolGlobalString('ADHERENT_ETIQUETTE_TYPE') ? getDolGlobalString('ADHERENT_ETIQUETTE_TYPE') : 'CARD', 1, 0, 0); + +print "
'.$langs->trans("DescADHERENT_ETIQUETTE_TEXT").''; +print ''; +print "
'; +print '
'; + +print '
'; +print ''; +print '
'; + +print ''; + +print '
'; print "
"; diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index 075ece751ce..3be38cca113 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -dol_include_once('/emailcollector/class/emailcollector.class.php'); +require_once DOL_DOCUMENT_ROOT.'/emailcollector/class/emailcollector.class.php'; // Load translation files required by page $langs->loadLangs(array("admin", "other")); @@ -50,7 +50,7 @@ $mode = GETPOST('mode', 'aZ'); $id = GETPOST('id', 'int'); // Load variable for pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); diff --git a/htdocs/admin/stocktransfer.php b/htdocs/admin/stocktransfer.php index 099312ef491..3bcd00c1fe8 100644 --- a/htdocs/admin/stocktransfer.php +++ b/htdocs/admin/stocktransfer.php @@ -24,19 +24,7 @@ */ // Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; -// Try main.inc.php using relative path -if (!$res && file_exists("../main.inc.php")) $res = @include "../main.inc.php"; -if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if (!$res) die("Include of main fails"); +require '../main.inc.php'; global $langs, $user; @@ -56,6 +44,8 @@ $action = GETPOST('action', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); $value = GETPOST('value', 'alpha'); +$label = GETPOST('label', 'alpha'); +$scandir = GETPOST('scan_dir', 'alpha'); $arrayofparameters = array( 'STOCKTRANSFER_MYPARAM1'=>array('css'=>'minwidth200', 'enabled'=>1), @@ -70,9 +60,8 @@ $setupnotempty = 0; * Actions */ -if ((float) DOL_VERSION >= 6) { - include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; -} +include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; + if ($action == 'updateMask') { $maskconststocktransfer = GETPOST('maskconststocktransfer', 'alpha'); @@ -131,7 +120,9 @@ if ($action == 'updateMask') { $ret = delDocumentModel($value, 'stocktransfer'); if ($ret > 0) { $constforval = strtoupper($tmpobjectkey).'_ADDON_PDF'; - if ($conf->global->$constforval == "$value") dolibarr_del_const($db, $constforval, $conf->entity); + if (getDolGlobalString($constforval) == "$value") { + dolibarr_del_const($db, $constforval, $conf->entity); + } } } elseif ($action == 'setdoc') { // Set default model $tmpobjectkey = 'StockTransfer'; @@ -294,7 +285,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { print ''; $constforvar = 'STOCKTRANSFER_'.strtoupper($myTmpObjectKey).'_ADDON'; - if ($conf->global->$constforvar == $file) { + if (getDolGlobalString($constforvar) == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { print ''; @@ -428,7 +419,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { // Default print ''; $constforvar = strtoupper($myTmpObjectKey).'_ADDON_PDF'; - if ($conf->global->$constforvar == $name) { + if (getDolGlobalString($constforvar) == $name) { print img_picto($langs->trans("Default"), 'on'); } else { print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index f9fd5d8ac7e..47cd50fa163 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1102,6 +1102,7 @@ class Propal extends CommonObject $sql .= ", fk_mode_reglement"; $sql .= ", fk_account"; $sql .= ", ref_client"; + $sql .= ", ref_ext"; $sql .= ", date_livraison"; $sql .= ", fk_shipping_method"; $sql .= ", fk_warehouse"; @@ -1136,6 +1137,7 @@ class Propal extends CommonObject $sql .= ", ".($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : 'NULL'); $sql .= ", ".($this->fk_account > 0 ? ((int) $this->fk_account) : 'NULL'); $sql .= ", '".$this->db->escape($this->ref_client)."'"; + $sql .= ", '".$this->db->escape($this->ref_ext)."'"; $sql .= ", ".(empty($delivery_date) ? "NULL" : "'".$this->db->idate($delivery_date)."'"); $sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL'); $sql .= ", ".($this->warehouse_id > 0 ? $this->warehouse_id : 'NULL'); @@ -1520,7 +1522,7 @@ class Propal extends CommonObject $sql .= ", p.datep as dp"; $sql .= ", p.fin_validite as dfv"; $sql .= ", p.date_livraison as delivery_date"; - $sql .= ", p.model_pdf, p.last_main_doc, p.ref_client, p.extraparams"; + $sql .= ", p.model_pdf, p.last_main_doc, p.ref_client, ref_ext, p.extraparams"; $sql .= ", p.note_private, p.note_public"; $sql .= ", p.fk_projet as fk_project, p.fk_statut"; $sql .= ", p.fk_user_author, p.fk_user_valid, p.fk_user_cloture"; @@ -1572,6 +1574,7 @@ class Propal extends CommonObject $this->ref = $obj->ref; $this->ref_client = $obj->ref_client; + $this->ref_ext = $obj->ref_ext; $this->remise = $obj->remise; $this->remise_percent = $obj->remise_percent; $this->remise_absolue = $obj->remise_absolue; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 208889ba1a2..31d9ac1667f 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1466,8 +1466,8 @@ if ($resql) { } // Parent company if (!empty($arrayfields['s2.nom']['checked'])) { - print ''; - print ''; + print ''; + print ''; print ''; } // Town @@ -1727,7 +1727,7 @@ if ($resql) { print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"], 's.name_alias', '', $param, '', $sortfield, $sortorder); } if (!empty($arrayfields['s2.nom']['checked'])) { - print_liste_field_titre($arrayfields['s2.nom']['label'], $_SERVER['PHP_SELF'], 's2.nom', '', $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre($arrayfields['s2.nom']['label'], $_SERVER['PHP_SELF'], 's2.nom', '', $param, '', $sortfield, $sortorder); } if (!empty($arrayfields['s.town']['checked'])) { print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); @@ -2032,7 +2032,7 @@ if ($resql) { // Parent company if (!empty($arrayfields['s2.nom']['checked'])) { - print ''; + print ''; if ($obj->fk_parent > 0) { if (!isset($company_url_list[$obj->fk_parent])) { $companyparent = new Societe($db); diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index bccad47e2d8..c53117a6821 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -652,7 +652,7 @@ foreach ($accounts as $key => $type) { print ''.$langs->trans("ConciliationDisabled").''; } else { $result = $objecttmp->load_board($user, $objecttmp->id); - if ($result < 0) { + if (is_numeric($result) && $result < 0) { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); } else { print ''; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 3e3ada6e8cf..2f69a3936c9 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -5667,7 +5667,7 @@ if ($action == 'create') { && $usercancreate && !$objectidnext && $object->is_last_in_cycle() - && $conf->global->INVOICE_USE_SITUATION_CREDIT_NOTE + && getDolGlobalInt('INVOICE_USE_SITUATION_CREDIT_NOTE') ) { if ($usercanunvalidate) { print ''.$langs->trans("CreateCreditNote").''; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 60270f440ba..85fc7569505 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4917,15 +4917,18 @@ abstract class CommonObject // Note: This is deprecated. If you need to overwrite the tpl file, use instead the hook. $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); foreach ($dirtpls as $module => $reldir) { + $res = 0; if (!empty($module)) { $tpl = dol_buildpath($reldir.'/objectline_title.tpl.php'); } else { $tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_title.tpl.php'; } - if (empty($conf->file->strict_mode)) { - $res = @include $tpl; - } else { - $res = include $tpl; // for debug + if (file_exists($tpl)) { + if (empty($conf->file->strict_mode)) { + $res = @include $tpl; + } else { + $res = include $tpl; // for debug + } } if ($res) { break; @@ -5040,16 +5043,18 @@ abstract class CommonObject // Note: This is deprecated. If you need to overwrite the tpl file, use instead the hook printObjectLine and printObjectSubLine. $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); foreach ($dirtpls as $module => $reldir) { + $res = 0; if (!empty($module)) { $tpl = dol_buildpath($reldir.'/objectline_view.tpl.php'); } else { $tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_view.tpl.php'; } - - if (empty($conf->file->strict_mode)) { - $res = @include $tpl; - } else { - $res = include $tpl; // for debug + if (file_exists($tpl)) { + if (empty($conf->file->strict_mode)) { + $res = @include $tpl; + } else { + $res = include $tpl; // for debug + } } if ($res) { break; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6aab933f29b..e098cbf3178 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8914,7 +8914,7 @@ class Form $form = new Form($this->db); print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' '; } - print ''.price($objp->total_ht).''; + print ''.(isset($objp->total_ht) ? price($objp->total_ht) : '').''; print ''; print ''.$objp->name.''; print ''; diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index 61737ab00f3..513d964014a 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -100,7 +100,7 @@ class FormMargin $pv = $line->total_ht; $pa_ht = ($pv < 0 ? -$line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign if (($object->element == 'facture' && $object->type == $object::TYPE_SITUATION) - || ($object->element == 'facture' && $object->type == $object::TYPE_CREDIT_NOTE && $conf->global->INVOICE_USE_SITUATION_CREDIT_NOTE && $object->situation_counter > 0)) { + || ($object->element == 'facture' && $object->type == $object::TYPE_CREDIT_NOTE && getDolGlobalInt('INVOICE_USE_SITUATION_CREDIT_NOTE') && $object->situation_counter > 0)) { $pa = $line->qty * $pa_ht * ($line->situation_percent / 100); } else { $pa = $line->qty * $pa_ht; diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index aef01514eba..c57ee0c5106 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -1079,7 +1079,7 @@ class FormSetupItem $tmp = explode(':', $this->type); $template = $formmail->getEMailTemplate($this->db, $tmp[1], $user, $this->langs, $this->fieldValue); - if ($template<0) { + if (is_numeric($template) && $template < 0) { $this->setErrors($formmail->errors); } $out.= $this->langs->trans($template->label); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index f1cf8e43269..b5f8ced66a0 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -438,7 +438,11 @@ function societe_prepare_head2($object) */ function societe_admin_prepare_head() { - global $langs, $conf, $user; + global $langs, $conf, $user, $db; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('societe'); + $extrafields->fetch_name_optionals_label('socpeople'); $h = 0; $head = array(); @@ -456,11 +460,19 @@ function societe_admin_prepare_head() $head[$h][0] = DOL_URL_ROOT.'/societe/admin/societe_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsThirdParties"); + $nbExtrafields = $extrafields->attributes['societe']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++; $head[$h][0] = DOL_URL_ROOT.'/societe/admin/contact_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsContacts"); + $nbExtrafields = $extrafields->attributes['socpeople']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes_contacts'; $h++; diff --git a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php index 67d41199594..267ca6803c9 100644 --- a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php @@ -23,7 +23,7 @@ if (!empty($extrafieldsobjectkey) && !empty($extrafields->attributes[$extrafield $tmpkey = 'options_'.$key; - if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$key], array('date', 'datetime', 'timestamp')) && !is_numeric($obj->$tmpkey)) { + if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$key], array('date', 'datetime', 'timestamp')) && isset($obj->$tmpkey) && !is_numeric($obj->$tmpkey)) { $datenotinstring = $obj->$tmpkey; if (!is_numeric($obj->$tmpkey)) { // For backward compatibility $datenotinstring = $db->jdate($datenotinstring); diff --git a/htdocs/install/mysql/data/llx_10_c_regions.sql b/htdocs/install/mysql/data/llx_10_c_regions.sql index ffd02aa9cf9..52a1a3bbbb6 100644 --- a/htdocs/install/mysql/data/llx_10_c_regions.sql +++ b/htdocs/install/mysql/data/llx_10_c_regions.sql @@ -4,12 +4,12 @@ -- Copyright (C) 2004 Benoit Mortier -- Copyright (C) 2004 Guillaume Delecourt -- Copyright (C) 2005-2009 Regis Houssin --- Copyright (C) 2007 Patrick Raguin +-- Copyright (C) 2007 Patrick Raguin -- Copyright (C) 2010-2016 Juanjo Menent -- Copyright (C) 2012 Sebastian Neuwert --- Copyright (C) 2012 Ricardo Schluter --- Copyright (C) 2015 Ferran Marcet --- Copyright (C) 2019~ Lao Tian <281388879@qq.com> +-- Copyright (C) 2012 Ricardo Schluter +-- Copyright (C) 2015 Ferran Marcet +-- Copyright (C) 2019~ Lao Tian <281388879@qq.com> -- Copyright (C) 2020-2021 Udo Tamm -- Copyright (C) 2022 Miro Sertić -- @@ -52,11 +52,12 @@ -- Belgium -- Bolivia -- Brazil -> for Departmements +-- Burundi -- Canada -> for Departmements -- Chile -- China -- Colombie -> for Departmements --- Croatia -> for Departmements +-- Croatia -- Denmark -- France -- Germany -> for Departmements @@ -66,6 +67,7 @@ -- India -> for Departmements -- Indonesia -> for Departmements -- Italy +-- Japan -> only for Departmements -- Luxembourg -- Mauritius -- Mexique -> for Departmements @@ -332,6 +334,10 @@ insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 3 insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 3, 320, NULL, 1, 'Veneto'); +-- Japan Region (id country=123) +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 123, 12301, '', 0,'日本'); + + -- Luxembourg Regions (districts) (id country=140) INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 140, 14001, '', 0, 'Diekirch'); INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 140, 14002, '', 0, 'Grevenmacher'); @@ -533,5 +539,3 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 2 INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 232, 23208, '', 0, 'Nor-Oriental'); INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 232, 23209, '', 0, 'Zuliana'); --- Japan Region (id country=123) -INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 123, 12301, '', 0,'日本'); diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 6ec5c1d0b9b..be7f006d5a0 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -849,8 +849,8 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $desiredstock = $objp->desiredstock; $alertstock = $objp->seuil_stock_alerte; - $desiredstockwarehouse = ($objp->desiredstockpse ? $objp->desiredstockpse : 0); - $alertstockwarehouse = ($objp->seuil_stock_alertepse ? $objp->seuil_stock_alertepse : 0); + $desiredstockwarehouse = (!empty($objp->desiredstockpse) ? $objp->desiredstockpse : 0); + $alertstockwarehouse = (!empty($objp->seuil_stock_alertepse) ? $objp->seuil_stock_alertepse : 0); $warning = ''; if ($alertstock && ($stock < $alertstock)) { diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php index d077c1d0ba8..c3c031b14bd 100644 --- a/htdocs/product/stock/replenishorders.php +++ b/htdocs/product/stock/replenishorders.php @@ -51,6 +51,7 @@ $search_dateyear = GETPOST('search_dateyear', 'int'); $search_datemonth = GETPOST('search_datemonth', 'int'); $search_dateday = GETPOST('search_dateday', 'int'); $search_date = dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear); +$optioncss = GETPOST('optioncss', 'alpha'); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -130,9 +131,9 @@ if (empty($user->rights->societe->client->voir) && !$socid) { } $sql .= ' WHERE cf.fk_soc = s.rowid '; $sql .= ' AND cf.entity = '.$conf->entity; -if ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) { +if (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER)) { $sql .= ' AND cf.fk_statut < 3'; -} elseif ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) { +} elseif (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) { $sql .= ' AND cf.fk_statut < 6'; // We want also status 5, we will keep them visible if dispatching is not yet finished (tested with function dolDispatchToDo). } else { $sql .= ' AND cf.fk_statut < 5'; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 78f7c71ce68..00d45eedea7 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -432,6 +432,9 @@ if ($action == 'confirm_generateinvoice') { $tmpinvoice->socid = $projectstatic->thirdparty->id; $tmpinvoice->date = dol_mktime(GETPOST('rehour', 'int'), GETPOST('remin', 'int'), GETPOST('resec', 'int'), GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $tmpinvoice->fk_project = $projectstatic->id; + $tmpinvoice->cond_reglement_id = $projectstatic->thirdparty->cond_reglement_id; + $tmpinvoice->mode_reglement_id = $projectstatic->thirdparty->mode_reglement_id; + $tmpinvoice->fk_account = $projectstatic->thirdparty->fk_account; if ($invoiceToUse) { $tmpinvoice->fetch($invoiceToUse);