Merge branch 'develop' of github.com:Dolibarr/dolibarr into develop

This commit is contained in:
florian HENRY 2020-04-02 10:45:46 +02:00
commit 10391a5769
19 changed files with 1655 additions and 103 deletions

View File

@ -71,7 +71,9 @@ $tables=array(
'paiement'=>array(0=>'datep'),
'bank'=>array(0=>'datev', 1=>'dateo'),
'commande_fournisseur'=>array(0=>'date_commande', 1=>'date_valid', 3=>'date_creation', 4=>'date_approve', 5=>'date_approve2', 6=>'date_livraison'),
'supplier_proposal'=>array(0=>'datec', 1=>'date_valid', 2=>'date_cloture')
'supplier_proposal'=>array(0=>'datec', 1=>'date_valid', 2=>'date_cloture'),
'expense_report'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 4=>'date_approve', 5=>'date_refuse', 6=>'date_cancel'),
'leave'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 5=>'date_refuse', 6=>'date_cancel')
);
$year=2010;

View File

@ -113,7 +113,7 @@ if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines' )
$coldisplay++;
if (($line->info_bits & 2) == 2 || ! empty($disableedit)) {
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=editline&amp;lineid='.$line->id.'#line_'.$line->id.'">'.img_edit().'</a>';
print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=editline&amp;lineid='.$line->id.'#line_'.$line->id.'">'.img_edit().'</a>';
}
print '</td>';
@ -121,7 +121,7 @@ if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines' )
$coldisplay++;
if (($line->fk_prev_id == null) && empty($disableremove)) {
//La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=deleteline&amp;lineid='.$line->id.'">';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=deleteline&amp;lineid='.$line->id.'">';
print img_delete();
print '</a>';
}

View File

@ -191,7 +191,7 @@ print "</tr>\n";
</table>
<br>
<div align="center"><span class="bouton_login"><input class="button" name="sbmtConnexion" type="submit" value="<?php echo dol_escape_htmltag($langs->trans("Connection")); ?>" /></span></div>
<div align="center"><span class="bouton_login"><input class="button" type="submit" value="<?php echo dol_escape_htmltag($langs->trans("Connection")); ?>" /></span></div>
</form>
</fieldset>

View File

@ -593,9 +593,10 @@ abstract class CommonObject
* @param int $withcountry 1=Add country into address string
* @param string $sep Separator to use to build string
* @param int $withregion 1=Add region into address string
* @param string $extralangcode User extralanguages as value
* @return string Full address string
*/
public function getFullAddress($withcountry = 0, $sep = "\n", $withregion = 0)
public function getFullAddress($withcountry = 0, $sep = "\n", $withregion = 0, $extralangcode = '')
{
if ($withcountry && $this->country_id && (empty($this->country_code) || empty($this->country)))
{
@ -615,7 +616,7 @@ abstract class CommonObject
$this->region = $tmparray['region'];
}
return dol_format_address($this, $withcountry, $sep);
return dol_format_address($this, $withcountry, $sep, '', 0, $extralangcode);
}
@ -628,7 +629,7 @@ abstract class CommonObject
*/
public function getBannerAddress($htmlkey, $object)
{
global $conf, $langs;
global $conf, $langs, $form, $extralanguages;
$countriesusingstate = array('AU', 'US', 'IN', 'GB', 'ES', 'UK', 'TR'); // See also option MAIN_FORCE_STATE_INTO_ADDRESS
@ -657,6 +658,7 @@ abstract class CommonObject
{
if (!empty($conf->use_javascript_ajax))
{
// Add picto with tooltip on map
$namecoords = '';
if ($this->element == 'contact' && !empty($conf->global->MAIN_SHOW_COMPANY_NAME_IN_BANNER_ADDRESS))
{
@ -670,6 +672,32 @@ abstract class CommonObject
}
$out .= dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', '); $outdone++;
$outdone++;
// List of extra languages
$arrayoflangcode = array();
if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE)) $arrayoflangcode[] = $conf->global->PDF_USE_ALSO_LANGUAGE_CODE;
if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
if (! is_object($extralanguages)) {
include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
$extralanguages = new ExtraLanguages($this->db);
}
$extralanguages->fetch_name_extralanguages('societe');
if (! empty($extralanguages->attributes['societe']['address']) || ! empty($extralanguages->attributes['societe']['town']))
{
$this->fetchValuesForExtraLanguages();
if (! is_object($form)) $form = new Form($this->db);
$htmltext = '';
// If there is extra languages
foreach($arrayoflangcode as $extralangcode) {
$s=picto_from_langcode($extralangcode, 'class="pictoforlang paddingright"');
$coords = $this->getFullAddress(1, ', ', $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT, $extralangcode);
$htmltext .= $s.dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', ');
}
$out .= $form->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft');
}
}
}
if (!in_array($this->country_code, $countriesusingstate) && empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS) // If MAIN_FORCE_STATE_INTO_ADDRESS is on, state is already returned previously with getFullAddress
@ -5054,8 +5082,9 @@ abstract class CommonObject
* This method is NOT called by method fetch of objects but must be called separately.
*
* @return int <0 if error, 0 if no values of alternative languages to find nor found, 1 if a value was found and loaded
* @see fetch_optionnals()
*/
public function fetchValueForAlternateLanguages()
public function fetchValuesForExtraLanguages()
{
// To avoid SQL errors. Probably not the better solution though
if (!$this->element) {
@ -5126,7 +5155,7 @@ abstract class CommonObject
* @param string $onlykey Only the following key is filled. When we make update of only one language field ($action = 'update_languages'), calling page must set this to avoid to have other languages being reset.
* @return int 1 if array_options set, 0 if no value, -1 if error (field required missing for example)
*/
public function setValuesForAlternateLanguages($onlykey = '')
public function setValuesForExtraLanguages($onlykey = '')
{
global $_POST, $langs;
@ -5214,6 +5243,7 @@ abstract class CommonObject
* @param int $rowid Id of line. Use the id of object if not defined. Deprecated. Function must be called without parameters.
* @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label(). Deprecated. Function must be called without parameters.
* @return int <0 if error, 0 if no values of extrafield to find nor found, 1 if an attribute is found and value loaded
* @see fetchValuesForExtraLanguages()
*/
public function fetch_optionals($rowid = null, $optionsArray = null)
{
@ -5357,7 +5387,7 @@ abstract class CommonObject
* @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY)
* @param User $userused Object user
* @return int -1=error, O=did nothing, 1=OK
* @see updateExtraField(), setValueFrom()
* @see insertExtraLanguages(), updateExtraField(), setValueFrom()
*/
public function insertExtraFields($trigger = '', $userused = null)
{
@ -5635,6 +5665,129 @@ abstract class CommonObject
else return 0;
}
/**
* Add/Update all extra fields values for the current object.
* Data to describe values to insert/update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
* This function delete record with all extrafields and insert them again from the array $this->array_options.
*
* @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY)
* @param User $userused Object user
* @return int -1=error, O=did nothing, 1=OK
* @see insertExtraFields(), updateExtraField(), setValueFrom()
*/
public function insertExtraLanguages($trigger = '', $userused = null)
{
global $conf, $langs, $user;
if (empty($userused)) $userused = $user;
$error = 0;
if (!empty($conf->global->MAIN_EXTRALANGUAGES_DISABLED)) return 0; // For avoid conflicts if trigger used
if (is_array($this->array_languages))
{
$new_array_languages = $this->array_languages;
foreach ($new_array_languages as $key => $value)
{
$attributeKey = $key;
$attributeType = $this->fields[$attributeKey]['type'];
$attributeLabel = $this->fields[$attributeKey]['label'];
//dol_syslog("attributeLabel=".$attributeLabel, LOG_DEBUG);
//dol_syslog("attributeType=".$attributeType, LOG_DEBUG);
switch ($attributeType)
{
case 'int':
if (!is_numeric($value) && $value != '')
{
$this->errors[] = $langs->trans("ExtraLanguageHasWrongValue", $attributeLabel);
return -1;
}
elseif ($value == '')
{
$new_array_languages[$key] = null;
}
break;
case 'double':
$value = price2num($value);
if (!is_numeric($value) && $value != '')
{
dol_syslog($langs->trans("ExtraLanguageHasWrongValue")." sur ".$attributeLabel."(".$value."is not '".$attributeType."')", LOG_DEBUG);
$this->errors[] = $langs->trans("ExtraLanguageHasWrongValue", $attributeLabel);
return -1;
}
elseif ($value == '')
{
$new_array_languages[$key] = null;
}
//dol_syslog("double value"." sur ".$attributeLabel."(".$value." is '".$attributeType."')", LOG_DEBUG);
$new_array_languages[$key] = $value;
break;
/*case 'select': // Not required, we chosed value='0' for undefined values
if ($value=='-1')
{
$this->array_options[$key] = null;
}
break;*/
}
}
$this->db->begin();
$table_element = $this->table_element;
if ($table_element == 'categorie') $table_element = 'categories'; // For compatibility
dol_syslog(get_class($this)."::insertExtraLanguages delete then insert", LOG_DEBUG);
foreach($new_array_languages as $key => $langcodearray) { // $key = 'name', 'town', ...
foreach($langcodearray as $langcode => $value) {
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."object_lang";
$sql_del .= " WHERE fk_object = ".$this->id." AND property = '".$this->db->escape($key)."' AND type_object = '".$this->db->escape($table_element)."'";
$sql_del .= " AND lang = '".$this->db->escape($langcode)."'";
$this->db->query($sql_del);
if ($value !== '') {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."object_lang (fk_object, property, type_object, lang, value";
$sql .= ") VALUES (".$this->id.", '".$this->db->escape($key)."', '".$this->db->escape($table_element)."', '".$this->db->escape($langcode)."', '".$this->db->escape($value)."'";
$sql .= ")";
$resql = $this->db->query($sql);
if (!$resql)
{
$this->error = $this->db->lasterror();
$error++;
break;
}
}
}
}
if (!$error && $trigger)
{
// Call trigger
$this->context = array('extralanguagesaddupdate'=>1);
$result = $this->call_trigger($trigger, $userused);
if ($result < 0) $error++;
// End call trigger
}
if ($error)
{
$this->db->rollback();
return -1;
}
else
{
$this->db->commit();
return 1;
}
}
else return 0;
}
/**
* Update an extra field value for the current object.
* Data to describe values to update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
@ -5643,7 +5796,7 @@ abstract class CommonObject
* @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY)
* @param User $userused Object user
* @return int -1=error, O=did nothing, 1=OK
* @see setValueFrom(), insertExtraFields()
* @see updateExtraLanguages(), setValueFrom(), insertExtraFields()
*/
public function updateExtraField($key, $trigger = null, $userused = null)
{
@ -5661,7 +5814,7 @@ abstract class CommonObject
$langs->load('admin');
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$target_extrafields = $extrafields->fetch_name_optionals_label($this->table_element);
$extrafields->fetch_name_optionals_label($this->table_element);
$value = $this->array_options["options_".$key];
@ -5765,6 +5918,29 @@ abstract class CommonObject
else return 0;
}
/**
* Update an extra language value for the current object.
* Data to describe values to update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
*
* @param string $key Key of the extrafield (without starting 'options_')
* @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY)
* @param User $userused Object user
* @return int -1=error, O=did nothing, 1=OK
* @see updateExtraFields(), insertExtraLanguages()
*/
public function updateExtraLanguages($key, $trigger = null, $userused = null)
{
global $conf, $langs, $user;
if (empty($userused)) $userused = $user;
$error = 0;
if (!empty($conf->global->MAIN_EXTRALANGUAGES_DISABLED)) return 0; // For avoid conflicts if trigger used
return 0;
}
/**
* Return HTML string to put an input field into a page

View File

@ -842,7 +842,7 @@ class ExtraFields
/**
* Load array this->attributes, or old this->attribute_xxx like attribute_label, attribute_type, ...
*
* @param string $elementtype Type of element ('adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...).
* @param string $elementtype Type of element ('' = all, 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...).
* @param boolean $forceload Force load of extra fields whatever is status of cache.
* @return array Array of attributes keys+label for all extra fields.
*/
@ -859,30 +859,6 @@ class ExtraFields
$array_name_label = array();
// To avoid conflicts with external modules. TODO Remove this.
if (empty($forceload) && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return $array_name_label;
// If already loaded
// TODO Enable this cache test
// if (empty($forceload) && ! empty($this->attributes[$tab->elementtype]['loaded'])) return $array_name_label;
// Set array of label of entity
// Remove completely loading of label. This should be done by presentation.
/*
$labelmulticompany=array();
if (!empty($conf->multicompany->enabled))
{
$sql_entity_name='SELECT rowid, label FROM '.MAIN_DB_PREFIX.'entity WHERE rowid in (0,'.$conf->entity.')';
$resql_entity_name=$this->db->query($sql_entity_name);
if ($resql_entity_name)
{
while ($obj = $this->db->fetch_object($resql_entity_name))
{
$labelmulticompany[$obj->rowid]=$obj->label;
}
}
}*/
// We should not have several time this request. If we have, there is some optimization to do by calling a simple $extrafields->fetch_optionals() in top of code and not into subcode
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,printable,totalizable,fielddefault,fieldcomputed,entity,enabled,help";
$sql .= " FROM ".MAIN_DB_PREFIX."extrafields";

File diff suppressed because it is too large Load Diff

View File

@ -329,12 +329,24 @@ class Form
*/
public function widgetForTranslation($fieldname, $object, $perm, $typeofdata = 'string', $check = '', $morecss = '')
{
global $conf, $langs;
global $conf, $langs, $extralanguages;
$result = '';
if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE)) {
$langcode = $conf->global->PDF_USE_ALSO_LANGUAGE_CODE;
// List of extra languages
$arrayoflangcode = array();
if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE)) $arrayoflangcode[] = $conf->global->PDF_USE_ALSO_LANGUAGE_CODE;
if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
if (! is_object($extralanguages)) {
include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
$extralanguages = new ExtraLanguages($this->db);
}
$extralanguages->fetch_name_extralanguages('societe');
if (! is_array($extralanguages->attributes[$object->element]) || empty($extralanguages->attributes[$object->element][$fieldname])) {
return ''; // No extralang field to show
}
$result .='<div class="inline-block paddingleft image-'.$object->element.'-'.$fieldname.'">';
$s=img_picto($langs->trans("ShowOtherLanguages"), 'language', '', false, 0, 0, '', 'fa-15 editfieldlang');
@ -343,22 +355,28 @@ class Form
$result .='<div class="inline-block hidden field-'.$object->element.'-'.$fieldname.'">';
$valuetoshow = GETPOSTISSET('field-'.$object->element."-".$fieldname."-".$langcode) ? GETPOST('field-'.$object->element.'-'.$fieldname."-".$langcode, $check) : '';
if (empty($valuetoshow)) {
$object->fetchValueForAlternateLanguages();
//var_dump($object->array_languages);
$valuetoshow = $object->array_languages[$fieldname][$langcode];
}
$resultforextrlang = '';
foreach($arrayoflangcode as $langcode)
{
$valuetoshow = GETPOSTISSET('field-'.$object->element."-".$fieldname."-".$langcode) ? GETPOST('field-'.$object->element.'-'.$fieldname."-".$langcode, $check) : '';
if (empty($valuetoshow)) {
$object->fetchValuesForExtraLanguages();
//var_dump($object->array_languages);
$valuetoshow = $object->array_languages[$fieldname][$langcode];
}
$s=picto_from_langcode($conf->global->PDF_USE_ALSO_LANGUAGE_CODE, 'class="pictoforlang"');
$result .= $s;
if ($typeofdata == 'textarea') {
$result .= '<textarea name="field-'.$object->element."-".$fieldname."-".$langcode.'" id="'.$fieldname."-".$langcode.'" class="'.$morecss.'" rows="'.ROWS_2.'" wrap="soft">';
$result .= $valuetoshow;
$result .= '</textarea>';
} else {
$result .= '<input type="text" class="inputfieldforlang '.($morecss ? ' '.$morecss : '').'" name="field-'.$object->element.'-'.$fieldname.'-'.$langcode.'" value="'.$valuetoshow.'">';
$s=picto_from_langcode($langcode, 'class="pictoforlang paddingright"');
$resultforextrlang .= $s;
if ($typeofdata == 'textarea') {
$resultforextrlang .= '<textarea name="field-'.$object->element."-".$fieldname."-".$langcode.'" id="'.$fieldname."-".$langcode.'" class="'.$morecss.'" rows="'.ROWS_2.'" wrap="soft">';
$resultforextrlang .= $valuetoshow;
$resultforextrlang .= '</textarea>';
} else {
$resultforextrlang .= '<input type="text" class="inputfieldforlang '.($morecss ? ' '.$morecss : '').'" name="field-'.$object->element.'-'.$fieldname.'-'.$langcode.'" value="'.$valuetoshow.'">';
}
}
$result .= $resultforextrlang;
$result .= '</div>';
$result .= '<script>$(".image-'.$object->element.'-'.$fieldname.'").click(function() { console.log("Toggle lang widget"); jQuery(".field-'.$object->element.'-'.$fieldname.'").toggle(); });</script>';
}
@ -7260,7 +7278,7 @@ class Form
*/
public function showrefnav($object, $paramid, $morehtml = '', $shownav = 1, $fieldid = 'rowid', $fieldref = 'ref', $morehtmlref = '', $moreparam = '', $nodbprefix = 0, $morehtmlleft = '', $morehtmlstatus = '', $morehtmlright = '')
{
global $langs, $conf, $hookmanager;
global $langs, $conf, $hookmanager, $extralanguages;
$ret = '';
if (empty($fieldid)) $fieldid = 'rowid';
@ -7359,6 +7377,31 @@ class Form
if ($object->element == 'societe')
{
$ret .= dol_htmlentities($object->name);
// List of extra languages
$arrayoflangcode = array();
if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE)) $arrayoflangcode[] = $conf->global->PDF_USE_ALSO_LANGUAGE_CODE;
if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
if (! is_object($extralanguages)) {
include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
$extralanguages = new ExtraLanguages($this->db);
}
$extralanguages->fetch_name_extralanguages('societe');
if (! empty($extralanguages->attributes['societe']['name']))
{
$object->fetchValuesForExtraLanguages();
$htmltext = '';
// If there is extra languages
foreach($arrayoflangcode as $extralangcode) {
$s=picto_from_langcode($extralangcode, 'class="pictoforlang paddingright"');
$htmltext .= $s.$object->array_languages['name'][$extralangcode];
}
$ret .= $this->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft');
}
}
}
elseif ($object->element == 'member')
{

View File

@ -1387,7 +1387,7 @@ class FormFile
if ($permtoeditline)
{
$paramsectiondir = (in_array($modulepart, array('medias', 'ecm')) ? '&section_dir='.urlencode($relativepath) : '');
print '<a href="'.(($useinecm == 1 || $useinecm == 5) ? '#' : ($url.'?action=editfile&urlfile='.urlencode($filepath).$paramsectiondir.$param)).'" class="editfilelink" rel="'.$filepath.'">'.img_edit('default', 0, 'class="paddingrightonly"').'</a>';
print '<a class="editfielda" href="'.(($useinecm == 1 || $useinecm == 5) ? '#' : ($url.'?action=editfile&urlfile='.urlencode($filepath).$paramsectiondir.$param)).'" class="editfilelink" rel="'.$filepath.'">'.img_edit('default', 0, 'class="paddingrightonly"').'</a>';
}
}
if ($permonobject)
@ -1879,9 +1879,9 @@ class FormFile
print '<td class="center">'.dol_print_date($link->datea, "dayhour", "tzuser").'</td>';
print '<td class="center"></td>';
print '<td class="right">';
print '<a href="'.$_SERVER['PHP_SELF'].'?action=update&linkid='.$link->id.$param.'" class="editfilelink reposition" >'.img_edit().'</a>'; // id= is included into $param
print '<a href="'.$_SERVER['PHP_SELF'].'?action=update&linkid='.$link->id.$param.'" class="editfilelink editfielda reposition" >'.img_edit().'</a>'; // id= is included into $param
if ($permissiontodelete) {
print ' &nbsp; <a href="'.$_SERVER['PHP_SELF'].'?action=delete&linkid='.$link->id.$param.'" class="deletefilelink">'.img_delete().'</a>'; // id= is included into $param
print ' &nbsp; <a class="deletefilelink" href="'.$_SERVER['PHP_SELF'].'?action=delete&linkid='.$link->id.$param.'">'.img_delete().'</a>'; // id= is included into $param
} else {
print '&nbsp;';
}

View File

@ -1545,8 +1545,9 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess
// Define $destfull (path to file including filename) and $destfile (only filename)
$destfull = $upload_dir."/".$TFile['name'][$i];
$destfile = $TFile['name'][$i];
$destfilewithoutext = preg_replace('/\.[^\.]+$/', '', $destfile);
if ($savingdocmask)
if ($savingdocmask && strpos($savingdocmask, $destfilewithoutext) !== 0)
{
$destfull = $upload_dir."/".preg_replace('/__file__/', $TFile['name'][$i], $savingdocmask);
$destfile = preg_replace('/__file__/', $TFile['name'][$i], $savingdocmask);

View File

@ -1646,12 +1646,12 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
if (!empty($object->name_alias)) $morehtmlref .= '<div class="refidno">'.$object->name_alias.'</div>';
// Add label
if ($object->element == 'product' || $object->element == 'bank_account' || $object->element == 'project_task')
if (in_array($object->element, array('product', 'bank_account', 'project_task')))
{
if (!empty($object->label)) $morehtmlref .= '<div class="refidno">'.$object->label.'</div>';
}
if (method_exists($object, 'getBannerAddress') && $object->element != 'product' && $object->element != 'bookmark' && $object->element != 'ecm_directories' && $object->element != 'ecm_files')
if (method_exists($object, 'getBannerAddress') && !in_array($object->element, array('product', 'bookmark', 'ecm_directories', 'ecm_files')))
{
$moreaddress = $object->getBannerAddress('refaddress', $object);
if ($moreaddress) {
@ -1660,7 +1660,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
$morehtmlref .= '</div>';
}
}
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && in_array($object->element, array('societe', 'contact', 'member', 'product')))
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && ($conf->global->MAIN_SHOW_TECHNICAL_ID == '1' || preg_match('/'.preg_quote($object->element, '/').'/i', $conf->global->MAIN_SHOW_TECHNICAL_ID)) && ! empty($object->id))
{
$morehtmlref .= '<div style="clear: both;"></div><div class="refidno">';
$morehtmlref .= $langs->trans("TechnicalID").': '.$object->id;
@ -1718,10 +1718,11 @@ function dol_bc($var, $moreclass = '')
* @param string $sep Separator to use to build string
* @param Translate $outputlangs Object lang that contains language for text translation.
* @param int $mode 0=Standard output, 1=Remove address
* @param string $extralangcode User extralanguage $langcode as values for address, town
* @return string Formated string
* @see dol_print_address()
*/
function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs = '', $mode = 0)
function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs = '', $mode = 0, $extralangcode = '')
{
global $conf, $langs;
@ -1729,15 +1730,15 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
$countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR'); // See also MAIN_FORCE_STATE_INTO_ADDRESS
// See format of addresses on https://en.wikipedia.org/wiki/Address
// Address
if (empty($mode)) {
$ret .= $object->address;
$ret .= ($extralangcode ? $object->array_languages['address'][$extralangcode] : $object->address);
}
// Zip/Town/State
if (in_array($object->country_code, array('AU', 'CA', 'US')) || !empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)) // US: title firstname name \n address lines \n town, state, zip \n country
{
$ret .= ($ret ? $sep : '').$object->town;
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town);
$ret .= ($ret ? $sep : '').$town;
if ($object->state)
{
$ret .= ($ret ? ", " : '').$object->state;
@ -1746,7 +1747,8 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
}
elseif (in_array($object->country_code, array('GB', 'UK'))) // UK: title firstname name \n address lines \n town state \n zip \n country
{
$ret .= ($ret ? $sep : '').$object->town;
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town);
$ret .= ($ret ? $sep : '').$town;
if ($object->state)
{
$ret .= ($ret ? ", " : '').$object->state;
@ -1756,7 +1758,8 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
elseif (in_array($object->country_code, array('ES', 'TR'))) // ES: title firstname name \n address lines \n zip town \n state \n country
{
$ret .= ($ret ? $sep : '').$object->zip;
$ret .= ($object->town ? (($object->zip ? ' ' : '').$object->town) : '');
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town);
$ret .= ($town ? (($object->zip ? ' ' : '').$town) : '');
if ($object->state)
{
$ret .= "\n".$object->state;
@ -1765,13 +1768,15 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
elseif (in_array($object->country_code, array('IT'))) // IT: tile firstname name\n address lines \n zip (Code Departement) \n country
{
$ret .= ($ret ? $sep : '').$object->zip;
$ret .= ($object->town ? (($object->zip ? ' ' : '').$object->town) : '');
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town);
$ret .= ($town ? (($object->zip ? ' ' : '').$town) : '');
$ret .= ($object->state_code ? (' '.($object->state_code)) : '');
}
else // Other: title firstname name \n address lines \n zip town \n country
{
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town);
$ret .= $object->zip ? (($ret ? $sep : '').$object->zip) : '';
$ret .= ($object->town ? (($object->zip ? ' ' : ($ret ? $sep : '')).$object->town) : '');
$ret .= ($town ? (($object->zip ? ' ' : ($ret ? $sep : '')).$town) : '');
if ($object->state && in_array($object->country_code, $countriesusingstate))
{
$ret .= ($ret ? ", " : '').$object->state;
@ -2853,16 +2858,16 @@ function dol_user_country()
/**
* Format address string
*
* @param string $address Address
* @param string $address Address string, already formatted with dol_format_address()
* @param int $htmlid Html ID (for example 'gmap')
* @param int $mode thirdparty|contact|member|other
* @param int $element 'thirdparty'|'contact'|'member'|'other'
* @param int $id Id of object
* @param int $noprint No output. Result is the function return
* @param string $charfornl Char to use instead of nl2br. '' means we use a standad nl2br.
* @return string|void Nothing if noprint is 0, formatted address if noprint is 1
* @see dol_format_address()
*/
function dol_print_address($address, $htmlid, $mode, $id, $noprint = 0, $charfornl = '')
function dol_print_address($address, $htmlid, $element, $id, $noprint = 0, $charfornl = '')
{
global $conf, $user, $langs, $hookmanager;
@ -2871,7 +2876,7 @@ function dol_print_address($address, $htmlid, $mode, $id, $noprint = 0, $charfor
if ($address)
{
if ($hookmanager) {
$parameters = array('element' => $mode, 'id' => $id);
$parameters = array('element' => $element, 'id' => $id);
$reshook = $hookmanager->executeHooks('printAddress', $parameters, $address);
$out .= $hookmanager->resPrint;
}
@ -2880,24 +2885,22 @@ function dol_print_address($address, $htmlid, $mode, $id, $noprint = 0, $charfor
if (empty($charfornl)) $out .= nl2br($address);
else $out .= preg_replace('/[\r\n]+/', $charfornl, $address);
// TODO Remove this block, we can add this using the hook now
$showgmap = $showomap = 0;
// TODO Add a hook here
if (($mode == 'thirdparty' || $mode == 'societe') && !empty($conf->google->enabled) && !empty($conf->global->GOOGLE_ENABLE_GMAPS)) $showgmap = 1;
if ($mode == 'contact' && !empty($conf->google->enabled) && !empty($conf->global->GOOGLE_ENABLE_GMAPS_CONTACTS)) $showgmap = 1;
if ($mode == 'member' && !empty($conf->google->enabled) && !empty($conf->global->GOOGLE_ENABLE_GMAPS_MEMBERS)) $showgmap = 1;
if (($mode == 'thirdparty' || $mode == 'societe') && !empty($conf->openstreetmap->enabled) && !empty($conf->global->OPENSTREETMAP_ENABLE_MAPS)) $showomap = 1;
if ($mode == 'contact' && !empty($conf->openstreetmap->enabled) && !empty($conf->global->OPENSTREETMAP_ENABLE_MAPS_CONTACTS)) $showomap = 1;
if ($mode == 'member' && !empty($conf->openstreetmap->enabled) && !empty($conf->global->OPENSTREETMAP_ENABLE_MAPS_MEMBERS)) $showomap = 1;
if (($element == 'thirdparty' || $element == 'societe') && !empty($conf->google->enabled) && !empty($conf->global->GOOGLE_ENABLE_GMAPS)) $showgmap = 1;
if ($element == 'contact' && !empty($conf->google->enabled) && !empty($conf->global->GOOGLE_ENABLE_GMAPS_CONTACTS)) $showgmap = 1;
if ($element == 'member' && !empty($conf->google->enabled) && !empty($conf->global->GOOGLE_ENABLE_GMAPS_MEMBERS)) $showgmap = 1;
if (($element == 'thirdparty' || $element == 'societe') && !empty($conf->openstreetmap->enabled) && !empty($conf->global->OPENSTREETMAP_ENABLE_MAPS)) $showomap = 1;
if ($element == 'contact' && !empty($conf->openstreetmap->enabled) && !empty($conf->global->OPENSTREETMAP_ENABLE_MAPS_CONTACTS)) $showomap = 1;
if ($element == 'member' && !empty($conf->openstreetmap->enabled) && !empty($conf->global->OPENSTREETMAP_ENABLE_MAPS_MEMBERS)) $showomap = 1;
if ($showgmap)
{
$url = dol_buildpath('/google/gmaps.php?mode='.$mode.'&id='.$id, 1);
$url = dol_buildpath('/google/gmaps.php?mode='.$element.'&id='.$id, 1);
$out .= ' <a href="'.$url.'" target="_gmaps"><img id="'.$htmlid.'" class="valigntextbottom" src="'.DOL_URL_ROOT.'/theme/common/gmap.png"></a>';
}
if ($showomap)
{
$url = dol_buildpath('/openstreetmap/maps.php?mode='.$mode.'&id='.$id, 1);
$url = dol_buildpath('/openstreetmap/maps.php?mode='.$element.'&id='.$id, 1);
$out .= ' <a href="'.$url.'" target="_gmaps"><img id="'.$htmlid.'_openstreetmap" class="valigntextbottom" src="'.DOL_URL_ROOT.'/theme/common/gmap.png"></a>';
}
}

View File

@ -311,7 +311,7 @@ if ($this->statut == 0 && ($object_rights->creer) && $action != 'selectlines') {
$coldisplay++;
if (($line->info_bits & 2) == 2 || !empty($disableedit)) {
} else { ?>
<a href="<?php print $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=editline&amp;lineid='.$line->id.'#line_'.$line->id; ?>">
<a class="editfielda reposition" href="<?php print $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=editline&amp;lineid='.$line->id.'#line_'.$line->id; ?>">
<?php print img_edit().'</a>';
}
print '</td>';
@ -319,7 +319,7 @@ if ($this->statut == 0 && ($object_rights->creer) && $action != 'selectlines') {
print '<td class="linecoldelete center">';
$coldisplay++;
if (($line->fk_prev_id == null) && empty($disableremove)) { //La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=ask_deleteline&amp;lineid='.$line->id.'">';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=ask_deleteline&amp;lineid='.$line->id.'">';
print img_delete();
print '</a>';
}

View File

@ -2436,7 +2436,7 @@ elseif ($id || $ref)
{
// edit-delete buttons
print '<td class="linecoledit center">';
print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=editline&amp;lineid=' . $lines[$i]->id . '">' . img_edit() . '</a>';
print '<a class="editfielda reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=editline&amp;lineid=' . $lines[$i]->id . '">' . img_edit() . '</a>';
print '</td>';
print '<td class="linecoldelete" width="10">';
print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=deleteline&amp;lineid=' . $lines[$i]->id . '">' . img_delete() . '</a>';

View File

@ -98,10 +98,10 @@ MustBeLowerThanPHPLimit=Note: <b>your</b> PHP configuration currently limits the
NoMaxSizeByPHPLimit=Note: No limit is set in your PHP configuration
MaxSizeForUploadedFiles=Maximum size for uploaded files (0 to disallow any upload)
UseCaptchaCode=Use graphical code (CAPTCHA) on login page
AntiVirusCommand= Full path to antivirus command
AntiVirusCommandExample= Example for ClamWin: c:\\Progra~1\\ClamWin\\bin\\clamscan.exe<br>Example for ClamAv: /usr/bin/clamscan
AntiVirusCommand=Full path to antivirus command
AntiVirusCommandExample=Example for ClamAv Daemon (require clamav-daemon): /usr/bin/clamdscan<br>Example for ClamWin (very very slow): c:\\Progra~1\\ClamWin\\bin\\clamscan.exe
AntiVirusParam= More parameters on command line
AntiVirusParamExample= Example for ClamWin: --database="C:\\Program Files (x86)\\ClamWin\\lib"
AntiVirusParamExample=Example for ClamAv Daemon: --fdpass<br>Example for ClamWin: --database="C:\\Program Files (x86)\\ClamWin\\lib"
ComptaSetup=Accounting module setup
UserSetup=User management setup
MultiCurrencySetup=Multi-currency setup

View File

@ -1962,14 +1962,14 @@ elseif ($id || $ref)
print '<input type="submit" class="button" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans("Save").'"><br>';
print '<input type="submit" class="button" id="cancellinebutton" name="cancel" value="'.$langs->trans("Cancel").'"><br>';
}
elseif ($object->statut == 0)
elseif ($object->statut == Reception::STATUS_DRAFT)
{
// edit-delete buttons
print '<td class="linecoledit center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=editline&amp;lineid='.$lines[$i]->id.'">'.img_edit().'</a>';
print '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=editline&amp;lineid='.$lines[$i]->id.'">'.img_edit().'</a>';
print '</td>';
print '<td class="linecoldelete" width="10">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=deleteline&amp;lineid='.$lines[$i]->id.'">'.img_delete().'</a>';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=deleteline&amp;lineid='.$lines[$i]->id.'">'.img_delete().'</a>';
print '</td>';
// Display lines extrafields

View File

@ -491,7 +491,7 @@ if (empty($reshook))
}
// Fill array 'array_languages' with data from add form
$ret = $object->setValuesForAlternateLanguages();
$ret = $object->setValuesForExtraLanguages();
if ($ret < 0)
{
$error++;
@ -931,7 +931,7 @@ else
* Creation
*/
$private = GETPOST("private", "int");
if (!empty($conf->global->THIRDPARTY_DEFAULT_CREATE_CONTACT) && !isset($_GET['private']) && !isset($_POST['private'])) $private = 1;
if (!empty($conf->global->THIRDPARTY_DEFAULT_CREATE_CONTACT) && ! GETPOSTISSET('private')) $private = 1;
if (empty($private)) $private = 0;
// Load object modCodeTiers
@ -1852,7 +1852,9 @@ else
// Name
print '<tr><td class="titlefieldcreate">'.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0, 'string', '', 1).'</td>';
print '<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dol_escape_htmltag($object->name).'" autofocus="autofocus"></td></tr>';
print '<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dol_escape_htmltag($object->name).'" autofocus="autofocus">';
print $form->widgetForTranslation("name", $object, $permissiontoadd, 'string', 'alpahnohtml', 'minwidth300');
print '</td></tr>';
// Alias names (commercial, trademark or alias names)
print '<tr id="name_alias"><td><label for="name_alias_input">'.$langs->trans('AliasNames').'</label></td>';
@ -1961,18 +1963,21 @@ else
print '<tr><td class="tdtop">'.$form->editfieldkey('Address', 'address', '', $object, 0).'</td>';
print '<td colspan="3"><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
print $object->address;
print '</textarea></td></tr>';
print '</textarea>';
print $form->widgetForTranslation("address", $object, $permissiontoadd, 'textarea', 'alphanohtml', 'quatrevingtpercent');
print '</td></tr>';
// Zip / Town
print '<tr><td>'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).'</td><td>';
print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth50onsmartphone');
print '</td><td>'.$form->editfieldkey('Town', 'town', '', $object, 0).'</td><td>';
print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
print $form->widgetForTranslation("town", $object, $permissiontoadd, 'string', 'alphanohtml', 'maxwidth100 quatrevingtpercent');
print '</td></tr>';
// Country
print '<tr><td>'.$form->editfieldkey('Country', 'selectcounty_id', '', $object, 0).'</td><td colspan="3">';
print $form->select_country((GETPOST('country_id') != '' ?GETPOST('country_id') : $object->country_id), 'country_id');
print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id') : $object->country_id), 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>';

View File

@ -1403,6 +1403,15 @@ class Societe extends CommonObject
$error++;
}
}
// Actions on extra languages
if (!$error && empty($conf->global->MAIN_EXTRALANGUAGES_DISABLED)) // For avoid conflicts if trigger used
{
$result = $this->insertExtraLanguages();
if ($result < 0)
{
$error++;
}
}
if (!$error && $call_trigger)
{

View File

@ -7,7 +7,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
--btncolorbg: #fbfbfb;
--btncolorborderhover: none;
--btncolorborder: #FFF;
--butactionbg:rgb(225, 231, 225);
--butactionbg:rgb(225, 235, 225);
--butactiondeletebg: rgb(234,228,225);
}

View File

@ -175,11 +175,15 @@ input, select {
margin-bottom:1px;
margin-top:1px;
}
#mainbody input.button {
#mainbody input.button:not(.buttongen):not(.bordertransp) {
background: var(--butactionbg);
border-collapse: collapse;
border: none;
}
#mainbody input.buttongen {
padding: 4px 4px;
}
input.button:focus {
border-bottom: 0;
}
@ -401,7 +405,7 @@ div#moretabsList, div#moretabsListaction {
hr { border: 0; border-top: 1px solid #ccc; }
.tabBar hr { margin-top: 20px; margin-bottom: 17px; }
.button, .buttonDelete, input[name="sbmtConnexion"] {
.button:not(.bordertransp), .buttonDelete:not(.bordertransp) {
margin-bottom: 0;
margin-top: 0;
margin-left: 5px;

View File

@ -530,7 +530,7 @@ div#moretabsList, div#moretabsListaction {
hr { border: 0; border-top: 1px solid #ccc; }
.button, .buttonDelete, input[name="sbmtConnexion"] {
.button:not(.bordertransp), .buttonDelete:not(.bordertransp) {
border-color: #c5c5c5;
border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25);
display: inline-block;