diff --git a/.travis.yml b/.travis.yml index bda2a9e9634..af37fe08a8d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -268,7 +268,7 @@ script: # Ensure we catch errors set -e #parallel-lint --exclude htdocs/includes --blame . - parallel-lint --exclude dev/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \ + parallel-lint --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \ --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \ --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \ --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/maximebf \ diff --git a/dev/initdemo/README b/dev/initdemo/README index 89e21b9337a..5e0f610d82e 100644 --- a/dev/initdemo/README +++ b/dev/initdemo/README @@ -12,6 +12,11 @@ The script initdemo.sh will erase current database with data into mysqldump_doli Do a chmod 700 initdemo.sh then run ./initdemo.sh to launch Graphic User Interface. +After loading the demo files, admin login may be: +- admin / admin +or +- admin / adminadmin + *** Save demo diff --git a/dev/initdemo/initdemopassword.sh b/dev/initdemo/initdemopassword.sh index d5aa9c1ef0e..84d50f0dcc3 100755 --- a/dev/initdemo/initdemopassword.sh +++ b/dev/initdemo/initdemopassword.sh @@ -53,7 +53,7 @@ then DIALOG="$DIALOG --ascii-lines" fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$ trap "rm -f $fichtemp" 0 1 2 5 15 - $DIALOG --title "Init Dolibarr with demo values" --clear \ + $DIALOG --title "Reset login password" --clear \ --inputbox "Mysql database name :" 16 55 dolibarrdemo 2> $fichtemp valret=$? case $valret in @@ -70,7 +70,7 @@ then DIALOG=${DIALOG=dialog} fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$ trap "rm -f $fichtemp" 0 1 2 5 15 - $DIALOG --title "Init Dolibarr with demo values" --clear \ + $DIALOG --title "Reset login password" --clear \ --inputbox "Mysql port (ex: 3306):" 16 55 3306 2> $fichtemp valret=$? @@ -128,7 +128,7 @@ then # ---------------------------- confirmation DIALOG=${DIALOG=dialog} - $DIALOG --title "Init demo login with demo values" --clear \ + $DIALOG --title "Reset login password" --clear \ --yesno "Do you confirm ? \n Mysql database : '$base' \n Mysql port : '$port' \n Demo login: '$demologin' \n Demo password : '$demopass'" 15 55 case $? in diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index bf283993628..db4945a654c 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -6,7 +6,7 @@ build/html build/aps - dev/namespacemig + dev/tools/test/namespacemig dev/initdata/dbf/includes documents htdocs/core/class/lessc.class.php diff --git a/htdocs/admin/system/database.php b/htdocs/admin/system/database.php index 8681efa08ef..3b712b489f5 100644 --- a/htdocs/admin/system/database.php +++ b/htdocs/admin/system/database.php @@ -45,15 +45,15 @@ print load_fiche_titre($langs->trans("InfoDatabase"), '', 'title_setup'); print '
'; print ''; print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; print '
'.$langs->trans("Database").'
'.$langs->trans("Version").''.$db::LABEL.' '.$db->getVersion().'
'.$langs->trans("DatabaseServer").''.$conf->db->host.'
'.$langs->trans("DatabasePort").''.(empty($conf->db->port) ? $langs->trans("Default") : $conf->db->port).'
'.$langs->trans("DatabaseName").''.$conf->db->name.'
'.$langs->trans("DriverType").''.$conf->db->type.($db->getDriverInfo() ? ' ('.$db->getDriverInfo().')' : '').'
'.$langs->trans("User").''.$conf->db->user.'
'.$langs->trans("Password").''.preg_replace('/./i', '*', $dolibarr_main_db_pass).'
'.$langs->trans("DBStoringCharset").''.$db->getDefaultCharacterSetDatabase().'
'.$langs->trans("DBSortingCharset").''.$db->getDefaultCollationDatabase().'
'.$langs->trans("Version").''.$db::LABEL.' '.$db->getVersion().'
'.$langs->trans("DatabaseServer").''.$conf->db->host.'
'.$langs->trans("DatabasePort").''.(empty($conf->db->port) ? $langs->trans("Default") : $conf->db->port).'
'.$langs->trans("DatabaseName").''.$conf->db->name.'
'.$langs->trans("DriverType").''.$conf->db->type.($db->getDriverInfo() ? ' ('.$db->getDriverInfo().')' : '').'
'.$langs->trans("User").''.$conf->db->user.'
'.$langs->trans("Password").''.preg_replace('/./i', '*', $dolibarr_main_db_pass).'
'.$langs->trans("DBStoringCharset").''.$db->getDefaultCharacterSetDatabase().'
'.$langs->trans("DBSortingCharset").''.$db->getDefaultCollationDatabase().'
'; print '
'; @@ -62,7 +62,7 @@ print '
'; print '
'; print ''; print ''."\n"; -print ''."\n"; +print ''."\n"; print '
'.$langs->trans("Tables").'
'.$langs->trans("List").'
'.$langs->trans("List").'
'; print '
'; @@ -104,7 +104,7 @@ if (!count($listofvars) && !count($listofstatus)) print ''; print $param; print ''; - print ''; + print ''; $show = 0; $text = ''; foreach ($arraytest as $key => $val) { diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index fe41203e946..93316384c2a 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -286,7 +286,10 @@ if ($object->id > 0) print ''; print $langs->trans('CustomerCode').''; print $object->code_client; - if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongCustomerCode").')'; + } print ''; print ''; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index bd5b39f717b..ca8ccb9bd7d 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -208,7 +208,7 @@ $contracttmp = new Contrat($db); $sql = 'SELECT'; $sql .= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_update, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public,"; -$sql .= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,'; +$sql .= ' s.rowid as socid, s.nom as name, s.name_alias, s.email, s.town, s.zip, s.fk_pays as country_id, s.client, s.code_client, s.status as company_status, s.logo as company_logo,'; $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; $sql .= " MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") as lower_planned_end_date,"; @@ -263,7 +263,7 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public,"; -$sql .= ' s.rowid, s.nom, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,'; +$sql .= ' s.rowid, s.nom, s.name_alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, s.status, s.logo,'; $sql .= " typent.code,"; $sql .= " state.code_departement, state.nom"; // Add fields from extrafields @@ -341,7 +341,7 @@ if ($socid > 0) $param = ''; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); -if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; +if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($sall != '') $param .= '&sall='.urlencode($sall); if ($search_contract != '') $param .= '&search_contract='.urlencode($search_contract); if ($search_name != '') $param .= '&search_name='.urlencode($search_name); @@ -596,6 +596,10 @@ if (!empty($arrayfields['status']['checked'])) { print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; +$totalarray = array(); +$typenArray = array(); +$cacheCountryIDCode = array(); + while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); @@ -608,6 +612,24 @@ while ($i < min($num, $limit)) if ($obj->socid > 0) { $result = $socstatic->fetch($obj->socid); } + /*$socstatic->id = $obj->socid; + $socstatic->name = $obj->name; + $socstatic->name_alias = $obj->name_alias; + $socstatic->email = $obj->email; + $socstatic->status = $obj->company_status; + $socstatic->logo = $obj->logo; + $socstatic->country_id = $obj->country_id; + $socstatic->country_code = ''; + $socstatic->country_label = '';*/ + if ($obj->country_id > 0) { + if (!isset($cacheCountryIDCode[$obj->country_id]['code'])) { + $tmparray = getCountry($obj->country_id, 'all'); + $cacheCountryIDCode[$obj->country_id] = array('code'=> empty($tmparray['code']) ? '' : $tmparray['code'], 'label' => empty($tmparray['label']) ? '' : $tmparray['label']); + } + $socstatic->country_code = $cacheCountryIDCode[$obj->country_id]['code']; + $socstatic->country_label = $cacheCountryIDCode[$obj->country_id]['label']; + } + print ''; @@ -643,9 +665,8 @@ while ($i < min($num, $limit)) if (!empty($arrayfields['s.nom']['checked'])) { print ''; - //print ''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.''; - if ($obj->socid > 0) - { + if ($obj->socid > 0) { + // TODO Use a cache for this string print $socstatic->getNomUrl(1, ''); } print ''; @@ -680,8 +701,7 @@ while ($i < min($num, $limit)) if (!empty($arrayfields['country.code_iso']['checked'])) { print ''; - $tmparray = getCountry($obj->fk_pays, 'all'); - print $tmparray['label']; + print $socstatic->country_label; print ''; if (!$i) $totalarray['nbfield']++; } diff --git a/htdocs/core/boxes/box_scheduled_jobs.php b/htdocs/core/boxes/box_scheduled_jobs.php index 23d520e9a8a..01dd86a999d 100644 --- a/htdocs/core/boxes/box_scheduled_jobs.php +++ b/htdocs/core/boxes/box_scheduled_jobs.php @@ -117,7 +117,7 @@ class box_scheduled_jobs extends ModeleBoxes $cronstatic->getNomUrl(1), $cronstatic->datelastrun, $cronstatic->status, - $cronstatic->getLibStatut(2) + $cronstatic->getLibStatut(3) ); $line++; } @@ -135,18 +135,18 @@ class box_scheduled_jobs extends ModeleBoxes $cronstatic->getNomUrl(1), $cronstatic->datenextrun, $cronstatic->status, - $cronstatic->getLibStatut(2) + $cronstatic->getLibStatut(3) ); } foreach ($resultarray as $line => $value) { $this->info_box_contents[$line][] = array( - 'td' => 'class="left"', + 'td' => 'class="tdoverflowmax200"', 'text' => $resultarray[$line][0] ); $this->info_box_contents[$line][] = array( - 'td' => 'class="left"', + 'td' => 'class="nowraponall"', 'textnoformat' => $resultarray[$line][1] ); $this->info_box_contents[$line][] = array( @@ -154,18 +154,18 @@ class box_scheduled_jobs extends ModeleBoxes 'textnoformat' => (empty($resultarray[$line][2]) ? '' : $form->textwithpicto(dol_print_date($resultarray[$line][2], "dayhoursec"), $langs->trans("CurrentTimeZone"))) ); $this->info_box_contents[$line][] = array( - 'td' => 'class="right" ', + 'td' => 'class="center" ', 'textnoformat' => $resultarray[$line][4] ); $line++; } $this->info_box_contents[$line][] = array( - 'td' => 'class="left" colspan="2"', + 'td' => 'class="tdoverflowmax300" colspan="3"', 'text' => $langs->trans("NumberScheduledJobError") ); $this->info_box_contents[$line][] = array( - 'td' => 'class="right" colspan="2"', - 'textnoformat' => ($nbjobsinerror ? ''.$nbjobsinerror.''.img_error() : ''.$langs->trans("None").'') + 'td' => 'class="center"', + 'textnoformat' => ($nbjobsinerror ? ''.$nbjobsinerror.img_error() : '
0
') ); } else { $this->info_box_contents[0][0] = array( diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 760b9632cb6..bfdea016ea6 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3292,7 +3292,7 @@ abstract class CommonObject /** * Fetch array of objects linked to current object (object of enabled modules only). Links are loaded into - * this->linkedObjectsIds array and + * this->linkedObjectsIds array + * this->linkedObjects array if $loadalsoobjects = 1 * Possible usage for parameters: * - all parameters empty -> we look all link to current object (current object can be source or target) @@ -3405,6 +3405,7 @@ abstract class CommonObject { // Parse element/subelement (ex: project_task, cabinetmed_consultation, ...) $module = $element = $subelement = $objecttype; + $regs = array(); if ($objecttype != 'supplier_proposal' && $objecttype != 'order_supplier' && $objecttype != 'invoice_supplier' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) { diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 4495c5ae50d..5fcc7b00c91 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -891,7 +891,6 @@ class DolGraph $color1 = sprintf("%02x%02x%02x", $this->bgcolorgrid[0], $this->bgcolorgrid[0], $this->bgcolorgrid[2]); $color2 = sprintf("%02x%02x%02x", $this->bgcolorgrid[0], $this->bgcolorgrid[1], $this->bgcolorgrid[2]); $this->stringtoshow .= ', grid: { hoverable: true, backgroundColor: { colors: ["#' . $color1 . '", "#' . $color2 . '"] }, borderWidth: 1, borderColor: \'#e6e6e6\', tickColor : \'#e6e6e6\' }' . "\n"; - //$this->stringtoshow.=', shadowSize: 20'."\n"; TODO Uncommet this $this->stringtoshow .= '});' . "\n"; $this->stringtoshow .= '}' . "\n"; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 00fa4b8f0b7..713da28996e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4230,7 +4230,7 @@ function print_liste_field_titre($name, $file = "", $field = "", $begin = "", $m /** * Get title line of an array * - * @param string $name Translation key of field + * @param string $name Translation key of field to show or complete HTML string to show * @param int $thead 0=To use with standard table format, 1=To use inside , 2=To use with
* @param string $file Url used when we click on sort picto * @param string $field Field to use for new sorting. Empty if this field is not sortable. Example "t.abc" or "t.abc,t.def" @@ -4277,7 +4277,7 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin } $out .= '<'.$tag.' class="'.$prefix.$liste_titre.'" '.$moreattrib; //$out .= (($field && empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE) && preg_match('/^[a-zA-Z_0-9\s\.\-:&;]*$/', $name)) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : ''); - $out .= ($name && empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE)) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : ''; + $out .= ($name && empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE) && empty($forcenowrapcolumntitle) && !dol_textishtml($name)) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : ''; $out .= '>'; if (empty($thead) && $field && empty($disablesortlink)) // If this is a sort field diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 7d00fee0773..8391c6aab06 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -759,7 +759,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ if (dol_strlen($maskcounter) < 3 && empty($conf->global->MAIN_COUNTER_WITH_LESS_3_DIGITS)) return 'ErrorCounterMustHaveMoreThan3Digits'; // Extract value for third party mask counter - $regClient = array(); + $regClientRef = array(); if (preg_match('/\{(c+)(0*)\}/i', $mask, $regClientRef)) { $maskrefclient = $regClientRef[1].$regClientRef[2]; @@ -791,8 +791,8 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ } // Extract value for user - if (preg_match('/\{(u+)\}/i', $mask, $regType)) - { + $regType = array(); + if (preg_match('/\{(u+)\}/i', $mask, $regType)) { $lastname = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; if (is_object($objuser)) $lastname = $objuser->lastname; @@ -931,12 +931,10 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ $sqlwhere .= " (SUBSTRING(".$field.", ".$yearpos.", ".$yearlen.") = '".$db->escape($yearcomp1)."'"; $sqlwhere .= " AND SUBSTRING(".$field.", ".$monthpos.", ".$monthlen.") < '".str_pad($monthcomp, $monthlen, '0', STR_PAD_LEFT)."') "; $sqlwhere .= ')'; - } elseif ($resetEveryMonth) - { + } elseif ($resetEveryMonth) { $sqlwhere .= "(SUBSTRING(".$field.", ".$yearpos.", ".$yearlen.") = '".$db->escape($yearcomp)."'"; $sqlwhere .= " AND SUBSTRING(".$field.", ".$monthpos.", ".$monthlen.") = '".str_pad($monthcomp, $monthlen, '0', STR_PAD_LEFT)."')"; - } else // reset is done on january - { + } else { // reset is done on january $sqlwhere .= '(SUBSTRING('.$field.', '.$yearpos.', '.$yearlen.") = '".$db->escape($yearcomp)."')"; } } @@ -1040,8 +1038,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ } else dol_print_error($db); $numFinal = $ref; - } elseif ($mode == 'next') - { + } elseif ($mode == 'next') { $counter++; // If value for $counter has a length higher than $maskcounter chars @@ -1184,8 +1181,7 @@ function check_value($mask, $value) $hasglobalcounter = false; // Extract value for mask counter, mask raz and mask offset $reg = array(); - if (preg_match('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i', $mask, $reg)) - { + if (preg_match('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i', $mask, $reg)) { $masktri = $reg[1].(isset($reg[2]) ? $reg[2] : '').(isset($reg[3]) ? $reg[3] : ''); $maskcounter = $reg[1]; $hasglobalcounter = true; @@ -1253,31 +1249,25 @@ function check_value($mask, $value) if ($maskraz <= 1 && !preg_match('/^(.*)\{(y+)\}/i', $maskwithonlyymcode, $reg)) return 'ErrorCantUseRazIfNoYearInMask'; //print "x".$maskwithonlyymcode." ".$maskraz; } - //print "masktri=".$masktri." maskcounter=".$maskcounter." maskraz=".$maskraz." maskoffset=".$maskoffset."
\n"; + //print "masktri=".$masktri." maskcounter=".$maskcounter." maskwithonlyymcode=".$maskwithonlyymcode." maskwithnocode=".$maskwithnocode." maskraz=".$maskraz." maskoffset=".$maskoffset."
\n"; - // Check we have a number in ($posnumstart+1).', '.dol_strlen($maskcounter) - // + if (function_exists('mb_strrpos')) { + $posnumstart = mb_strrpos($maskwithnocode, $maskcounter, 'UTF-8'); + } + else { + $posnumstart = strrpos($maskwithnocode, $maskcounter); + } // Pos of counter in final string (from 0 to ...) + if ($posnumstart < 0) return 'ErrorBadMaskFailedToLocatePosOfSequence'; - // Check length - $len = dol_strlen($maskwithnocode); - if (dol_strlen($value) != $len) $result = -1; + // Check we have a number in $value at position ($posnumstart+1).', '.dol_strlen($maskcounter) + // TODO - // Define $maskLike - /* seems not used - $maskLike = dol_string_nospecial($mask); - $maskLike = str_replace("%","_",$maskLike); - // Replace protected special codes with matching number of _ as wild card caracter - $maskLike = str_replace(dol_string_nospecial('{yyyy}'),'____',$maskLike); - $maskLike = str_replace(dol_string_nospecial('{yy}'),'__',$maskLike); - $maskLike = str_replace(dol_string_nospecial('{y}'),'_',$maskLike); - $maskLike = str_replace(dol_string_nospecial('{mm}'),'__',$maskLike); - $maskLike = str_replace(dol_string_nospecial('{dd}'),'__',$maskLike); - $maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",dol_strlen($maskcounter),"_"),$maskLike); - if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",strlen($maskrefclient),"_"),$maskLike); - */ + // Check length + $len = dol_strlen($maskwithnocode); + if (dol_strlen($value) != $len) $result = -1; - dol_syslog("functions2::check_value result=".$result, LOG_DEBUG); - return $result; + dol_syslog("functions2::check_value result=".$result, LOG_DEBUG); + return $result; } /** diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index a7d9c99f401..9b870bd5dd2 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -272,7 +272,8 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode * -2 ErrorCustomerCodeRequired * -3 ErrorCustomerCodeAlreadyUsed * -4 ErrorPrefixRequired - * -5 Other (see this->error) + * -5 NotConfigured - Setup empty so any value may be ok or not + * -6 Other (see this->error) */ public function verif($db, &$code, $soc, $type) { @@ -299,12 +300,11 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode $this->error = 'NotConfigured'; return -5; } - $result = check_value($mask, $code); if (is_string($result)) { $this->error = $result; - return -5; + return -6; } } diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index f6162f1d9f8..807996ddd1c 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -187,11 +187,14 @@ if ($object->id > 0) if ($object->fournisseur) { print ''; - print ''.$langs->trans("SupplierCode").''; - print $object->code_fournisseur; - if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; - print ''; - print ''; + print ''.$langs->trans("SupplierCode").''; + print $object->code_fournisseur; + $tmpcheck = $object->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongSupplierCode").')'; + } + print ''; + print ''; $langs->load('compta'); print ''; diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index e391787479d..309d4d4b170 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -552,3 +552,6 @@ INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES -- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_scheduled_jobs.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_scheduled_jobs.php' AND entity = 1); ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging varchar(64); + +ALTER TABLE llx_projet ADD COLUMN fk_opp_status_end integer DEFAULT NULL; + diff --git a/htdocs/install/mysql/tables/llx_projet.sql b/htdocs/install/mysql/tables/llx_projet.sql index a36adb3a672..1b95444b3a1 100644 --- a/htdocs/install/mysql/tables/llx_projet.sql +++ b/htdocs/install/mysql/tables/llx_projet.sql @@ -35,6 +35,7 @@ create table llx_projet fk_statut integer DEFAULT 0 NOT NULL, -- open or close fk_opp_status integer DEFAULT NULL, -- if project is used to manage opportunities opp_percent double(5,2), + fk_opp_status_end integer DEFAULT NULL, -- if project is used to manage opportunities (the opportunity status the project has when set to lose) date_close datetime DEFAULT NULL, fk_user_close integer DEFAULT NULL, note_private text, diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index 683bc433c29..bfa5ac15811 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -96,21 +96,27 @@ if ($socid > 0) print '
'; print ''; - if ($object->client) - { - print ''; - } + if ($object->client) + { + print ''; + } if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $object->fournisseur && !empty($user->rights->fournisseur->lire)) { print ''; } diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 26477900be2..b8a0ba69ef7 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -154,9 +154,7 @@ if (empty($reshook)) // Mass actions $objectclass = 'PaymentSalary'; $objectlabel = 'SalariesPayments'; - $permissiontoread = $user->rights->salaries->read; - $permissiontodelete = $user->rights->salaries->delete; - $uploaddir = $conf->bom->dir_output; + $uploaddir = $conf->salaries->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; // Validate records @@ -308,7 +306,7 @@ print ''; -// Date +// Date payment print ''; +// Date value +print ''; // Type print ''; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "s.rowid", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.rowid", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "s.label", "", $param, 'class="left"', $sortfield, $sortorder); -print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "s.datep,s.rowid", "", $param, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "s.datep,s.rowid", "", $param, '', $sortfield, $sortorder, 'center '); +print_liste_field_titre("DateValue", $_SERVER["PHP_SELF"], "s.datev,s.rowid", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder); if (!empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "s.amount", "", $param, 'class="right"', $sortfield, $sortorder); @@ -421,6 +423,10 @@ while ($i < ($limit ? min($num, $limit) : $num)) print '\n"; if (!$i) $totalarray['nbfield']++; + // Date value + print '\n"; + if (!$i) $totalarray['nbfield']++; + // Type print ''; if (!$i) $totalarray['nbfield']++; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index fc3d0879691..0fc33232c5d 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2281,7 +2281,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; print ''; } @@ -2292,7 +2295,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; print ''; } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index f8796739701..0aeb64aa427 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2969,6 +2969,8 @@ class Societe extends CommonObject * -2 ErrorCustomerCodeRequired * -3 ErrorCustomerCodeAlreadyUsed * -4 ErrorPrefixRequired + * -5 NotConfigured - Setup empty so any value may be ok or not + * -6 Other (see this->error) */ public function check_codeclient() { diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 7c66a8a148f..779bf573341 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -130,7 +130,10 @@ if ($object->client) print ''; $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid; $resql = $db->query($sql); @@ -153,7 +156,10 @@ if ($object->fournisseur) print ''; $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."commande_fournisseur where fk_soc = ".$socid; $resql = $db->query($sql); diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index 66ace3650a9..1d7ba3d2925 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -136,7 +136,10 @@ if ($object->id) print ''; } @@ -145,7 +148,10 @@ if ($object->id) print ''; } diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php index 0632fde21c2..516fb95e464 100644 --- a/htdocs/societe/note.php +++ b/htdocs/societe/note.php @@ -94,23 +94,27 @@ if ($object->id > 0) print ''; } - if ($object->client) - { - print ''; - } + if ($object->client) { + print ''; + } - if ($object->fournisseur) - { - print ''; - } + if ($object->fournisseur) { + print ''; + } print "
'; - print $langs->trans('CustomerCode').''; - print $object->code_client; - if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; - print '
'; + print $langs->trans('CustomerCode').''; + print $object->code_client; + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongCustomerCode").')'; + } + print '
'; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; - if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; + $tmpcheck = $object->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongSupplierCode").')'; + } print '
'; print '
'; print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); @@ -317,6 +315,9 @@ print '
'; print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); print '
'; print '
'; +print ''; $form->select_types_paiements($search_type_id, 'search_type_id', '', 0, 1, 1, 16); @@ -352,7 +353,8 @@ print '
'.dol_print_date($db->jdate($obj->datep), 'day')."'.dol_print_date($db->jdate($obj->datev), 'day')."'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'
'; print $langs->trans('CustomerCode').''; print $object->code_client; - if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongCustomerCode").')'; + } print '
'; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; - if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; + $tmpcheck = $object->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongSupplierCode").')'; + } print '
'; print $langs->trans('CustomerCode').''; print $object->code_client; - if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongCustomerCode").')'; + } print '
'; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; - if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; + $tmpcheck = $object->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongSupplierCode").')'; + } print '
'; print $langs->trans('CustomerCode').''; print $object->code_client; - if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongCustomerCode").')'; + } print '
'; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; - if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; + $tmpcheck = $object->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongSupplierCode").')'; + } print '
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'; - print $langs->trans('CustomerCode').''; - print $object->code_client; - if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; - print '
'; + print $langs->trans('CustomerCode').''; + print $object->code_client; + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongCustomerCode").')'; + } + print '
'; - print $langs->trans('SupplierCode').''; - print $object->code_fournisseur; - if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; - print '
'; + print $langs->trans('SupplierCode').''; + print $object->code_fournisseur; + $tmpcheck = $object->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongSupplierCode").')'; + } + print '
"; diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index 9a16c1aa1be..5730d8f1ff4 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -165,23 +165,27 @@ if ($result > 0) print ''.$langs->trans('Prefix').''.$object->prefix_comm.''; } - if ($object->client) - { - print ''; - print $langs->trans('CustomerCode').''; - print $object->code_client; - if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; - print ''; - } + if ($object->client) { + print ''; + print $langs->trans('CustomerCode').''; + print $object->code_client; + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongCustomerCode").')'; + } + print ''; + } - if (!empty($conf->fournisseur->enabled) && $object->fournisseur && !empty($user->rights->fournisseur->lire)) - { - print ''; - print $langs->trans('SupplierCode').''; - print $object->code_fournisseur; - if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; - print ''; - } + if (!empty($conf->fournisseur->enabled) && $object->fournisseur && !empty($user->rights->fournisseur->lire)) { + print ''; + print $langs->trans('SupplierCode').''; + print $object->code_fournisseur; + $tmpcheck = $object->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongSupplierCode").')'; + } + print ''; + } /*print ''.$langs->trans("NbOfActiveNotifications").''; // Notification for this thirdparty print ''; diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index fa06ea5eae1..ee4ca01e7ee 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -808,7 +808,10 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''; print $langs->trans('CustomerCode').''; print $object->code_client; - if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongCustomerCode").')'; + } print ''; $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid; $resql = $db->query($sql); @@ -860,7 +863,10 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; - if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; + $tmpcheck = $object->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongSupplierCode").')'; + } print ''; $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid; $resql = $db->query($sql); diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index a06b1f0940e..0afe58ece05 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -215,8 +215,10 @@ if ($object->client) { print ''; print $langs->trans('CustomerCode').''; print $object->code_client; - if ($object->check_codeclient() != 0) + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { print ' ('.$langs->trans("WrongCustomerCode").')'; + } print ''; } @@ -224,8 +226,10 @@ if ($object->fournisseur) { print ''; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; - if ($object->check_codefournisseur() != 0) + $tmpcheck = $object->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { print ' ('.$langs->trans("WrongSupplierCode").')'; + } print ''; } diff --git a/htdocs/societe/project.php b/htdocs/societe/project.php index aae44983401..54be485d6cd 100644 --- a/htdocs/societe/project.php +++ b/htdocs/societe/project.php @@ -99,7 +99,10 @@ if ($socid) print ''; print $langs->trans('CustomerCode').''; print $object->code_client; - if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongCustomerCode").')'; + } print ''; } @@ -108,7 +111,10 @@ if ($socid) print ''; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; - if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; + $tmpcheck = $object->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongSupplierCode").')'; + } print ''; } diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php index 0d1ae48e9e3..3547c5a1e9b 100644 --- a/htdocs/societe/societecontact.php +++ b/htdocs/societe/societecontact.php @@ -184,20 +184,26 @@ if ($id > 0 || !empty($ref)) if ($object->client) { - print ''; - print $langs->trans('CustomerCode').''; - print $object->code_client; - if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; - print ''; + print ''; + print $langs->trans('CustomerCode').''; + print $object->code_client; + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongCustomerCode").')'; + } + print ''; } if ($object->fournisseur) { - print ''; - print $langs->trans('SupplierCode').''; - print $object->code_fournisseur; - if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; - print ''; + print ''; + print $langs->trans('SupplierCode').''; + print $object->code_fournisseur; + $tmpcheck = $object->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongSupplierCode").')'; + } + print ''; } print ''; diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 24c4ede34b3..69e8efd02e1 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -213,8 +213,10 @@ if ($object->client) { print ''; print $langs->trans('CustomerCode').''; print $object->code_client; - if ($object->check_codeclient() != 0) + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { print ' ('.$langs->trans("WrongCustomerCode").')'; + } print ''; } @@ -222,8 +224,10 @@ if ($object->fournisseur) { print ''; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; - if ($object->check_codefournisseur() != 0) + $tmpcheck = $object->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { print ' ('.$langs->trans("WrongSupplierCode").')'; + } print ''; } diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index fc1cca1aa0f..53973de6c59 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -426,30 +426,30 @@ if ($socid && !$projectid && !$project_ref && $user->rights->societe->lire) { print '
'; print ''; - // Customer code - if ($socstat->client && !empty($socstat->code_client)) { - print ''; - print ''; - } - // Supplier code - if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) { - print ''; - print ''; - } + // Customer code + if ($socstat->client && !empty($socstat->code_client)) { + print ''; + print ''; + } + // Supplier code + if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) { + print ''; + print ''; + } print '
'; - print $langs->trans('CustomerCode').''; - print $socstat->code_client; - if ($socstat->check_codeclient() != 0) { - print ' ('.$langs->trans("WrongCustomerCode").')'; - } - - print '
'; - print $langs->trans('SupplierCode').''; - print $socstat->code_fournisseur; - if ($socstat->check_codefournisseur() != 0) { - print ' ('.$langs->trans("WrongSupplierCode").')'; - } - - print '
'; + print $langs->trans('CustomerCode').''; + print $socstat->code_client; + $tmpcheck = $socstat->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongCustomerCode").')'; + } + print '
'; + print $langs->trans('SupplierCode').''; + print $socstat->code_fournisseur; + $tmpcheck = $socstat->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongSupplierCode").')'; + } + print '
'; print '
';