From de107fb02e93431ecfad06f8e8606767124d572b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 11:27:05 +0200 Subject: [PATCH 01/11] NEW Can set a squarred icon on your company setup --- htdocs/admin/company.php | 212 ++++++++++++------ .../install/mysql/migration/10.0.0-11.0.0.sql | 2 + htdocs/install/mysql/tables/llx_societe.sql | 1 + htdocs/langs/en_US/admin.lang | 3 + htdocs/societe/class/societe.class.php | 16 +- htdocs/theme/eldy/global.inc.php | 16 +- htdocs/theme/md/style.css.php | 4 + 7 files changed, 182 insertions(+), 72 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index a3534d3bc5a..9da2e550501 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -105,69 +105,79 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha')) dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE", GETPOST("note", 'none'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD", GETPOST("barcode", 'alpha'), 'chaine', 0, '', $conf->entity); - $varforimage='logo'; $dirforimage=$conf->mycompany->dir_output.'/logos/'; - if ($_FILES[$varforimage]["tmp_name"]) + $dirforimage=$conf->mycompany->dir_output.'/logos/'; + + $arrayofimages = array('logo', 'logo_squarred'); + + foreach($arrayofimages as $varforimage) { - if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg)) + if ($_FILES[$varforimage]["tmp_name"]) { - $original_file=$reg[1]; - - $isimage=image_format_supported($original_file); - if ($isimage >= 0) + $reg = array(); + if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg)) { - dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file); - if (! is_dir($dirforimage)) - { - dol_mkdir($dirforimage); - } - $result=dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']); - if ($result > 0) - { - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO", $original_file, 'chaine', 0, '', $conf->entity); + $original_file=$reg[1]; - // Create thumbs of logo (Note that PDF use original file and not thumbs) - if ($isimage > 0) + $isimage=image_format_supported($original_file); + if ($isimage >= 0) + { + dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file); + if (! is_dir($dirforimage)) { - // Create thumbs - //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get... - - // Create small thumb, Used on logon for example - $imgThumbSmall = vignette($dirforimage.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality); - if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg)) - { - $imgThumbSmall = $reg[1]; // Save only basename - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity); - } - else dol_syslog($imgThumbSmall); - - // Create mini thumb, Used on menu or for setup page for example - $imgThumbMini = vignette($dirforimage.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality); - if (image_format_supported($imgThumbMini) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbMini, $reg)) - { - $imgThumbMini = $reg[1]; // Save only basename - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity); - } - else dol_syslog($imgThumbMini); + dol_mkdir($dirforimage); + } + $result=dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']); + if ($result > 0) + { + $constant = "MAIN_INFO_SOCIETE_LOGO"; + if ($varforimage == 'logo_squarred') $constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED"; + + dolibarr_set_const($db, $constant, $original_file, 'chaine', 0, '', $conf->entity); + + // Create thumbs of logo (Note that PDF use original file and not thumbs) + if ($isimage > 0) + { + // Create thumbs + //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get... + + // Create small thumb, Used on logon for example + $imgThumbSmall = vignette($dirforimage.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality); + if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg)) + { + $imgThumbSmall = $reg[1]; // Save only basename + dolibarr_set_const($db, $constant."_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity); + } + else dol_syslog($imgThumbSmall); + + // Create mini thumb, Used on menu or for setup page for example + $imgThumbMini = vignette($dirforimage.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality); + if (image_format_supported($imgThumbMini) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbMini, $reg)) + { + $imgThumbMini = $reg[1]; // Save only basename + dolibarr_set_const($db, $constant."_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity); + } + else dol_syslog($imgThumbMini); + } + else dol_syslog("ErrorImageFormatNotSupported", LOG_WARNING); + } elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) { + $error++; + $langs->load("errors"); + $tmparray=explode(':', $result); + setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors'); + } + else + { + $error++; + setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); } - else dol_syslog("ErrorImageFormatNotSupported", LOG_WARNING); - } elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) { - $error++; - $langs->load("errors"); - $tmparray=explode(':', $result); - setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors'); } else { $error++; - setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); + $langs->load("errors"); + setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors'); } } - else - { - $error++; - $langs->load("errors"); - setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors'); - } } } @@ -247,7 +257,7 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha')) } } -if ($action == 'addthumb') // Regenerate thumbs +if ($action == 'addthumb' || $action == 'addthumbsquarred') // Regenerate thumbs { if (file_exists($conf->mycompany->dir_output.'/logos/'.$_GET["file"])) { @@ -256,15 +266,20 @@ if ($action == 'addthumb') // Regenerate thumbs // Create thumbs of logo if ($isimage > 0) { + $constant = "MAIN_INFO_SOCIETE_LOGO"; + if ($action == 'addthumbsquarred') $constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED"; + + $reg = array(); + // Create thumbs - //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get... + //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get... // Create small thumb. Used on logon for example $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthsmall, $maxheightsmall, '_small', $quality); if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg)) { $imgThumbSmall = $reg[1]; // Save only basename - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, $constant."_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity); } else dol_syslog($imgThumbSmall); @@ -273,7 +288,7 @@ if ($action == 'addthumb') // Regenerate thumbs if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbMini, $reg)) { $imgThumbMini = $reg[1]; // Save only basename - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, $constant."_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity); } else dol_syslog($imgThumbMini); @@ -297,24 +312,37 @@ if ($action == 'addthumb') // Regenerate thumbs } } -if ($action == 'removelogo') + +if ($action == 'removelogo' || $action == 'removelogosquarred') { + $constant = "MAIN_INFO_SOCIETE_LOGO"; + if ($action == 'removelogosquarred') $constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED"; + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $logofile=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo; - if ($mysoc->logo != '') dol_delete_file($logofile); - dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO", $conf->entity); - $mysoc->logo=''; + $logofilename = $mysoc->logo; + if ($action == 'removelogosquarred') $logofilename = $mysoc->logo_squarred; + $logofile=$conf->mycompany->dir_output.'/logos/'.$logofilename; + if ($logofilename != '') dol_delete_file($logofile); + dolibarr_del_const($db, $constant, $conf->entity); + if ($action == 'removelogosquarred') $mysoc->logo_squarred=''; + else $mysoc->logo=''; - $logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small; - if ($mysoc->logo_small != '') dol_delete_file($logosmallfile); - dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL", $conf->entity); - $mysoc->logo_small=''; + $logofilename = $mysoc->logo_small; + if ($action == 'removelogosquarred') $logofilename = $mysoc->logo_squarred_small; + $logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$logofilename; + if ($logofilename != '') dol_delete_file($logosmallfile); + dolibarr_del_const($db, $constant."_SMALL", $conf->entity); + if ($action == 'removelogosquarred') $mysoc->logo_squarred_small=''; + else $mysoc->logo_small=''; - $logominifile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini; - if ($mysoc->logo_mini != '') dol_delete_file($logominifile); - dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI", $conf->entity); - $mysoc->logo_mini=''; + $logofilename = $mysoc->logo_mini; + if ($action == 'removelogosquarred') $logofilename = $mysoc->logo_squarred_mini; + $logominifile=$conf->mycompany->dir_output.'/logos/thumbs/'.$logofilename; + if ($logofilename != '') dol_delete_file($logominifile); + dolibarr_del_const($db, $constant."_MINI", $conf->entity); + if ($action == 'removelogosquarred') $mysoc->logo_squarred_mini=''; + else $mysoc->logo_mini=''; } @@ -434,7 +462,7 @@ if ($action == 'edit' || $action == 'updateedit') // Logo print ''; print '
'; - print ''; + print ''; print ''; if (! empty($mysoc->logo_mini)) { print ''.img_delete($langs->trans("Delete")).''; @@ -448,6 +476,23 @@ if ($action == 'edit' || $action == 'updateedit') print '
'; print ''; + // Logo (squarred) + print ''; + print '
'; + print ''; + print ''; + if (! empty($mysoc->logo_squarred_mini)) { + print ''.img_delete($langs->trans("Delete")).''; + if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) { + print '   '; + print ''; + } + } else { + print ''; + } + print '
'; + print ''; + // Note print ''; print ''; @@ -829,7 +874,7 @@ else // Logo - print ''.$langs->trans("Logo").''; + print ''.$form->textwithpicto($langs->trans("Logo"), $langs->trans("LogoDesc")).''; $tagtd='tagtd '; if ($conf->browser->layout == 'phone') $tagtd=''; @@ -854,7 +899,34 @@ else print ''; + // Logo (squarred) + print ''.$form->textwithpicto($langs->trans("LogoSquarred"), $langs->trans("LogoSquarredDesc")).''; + + $tagtd='tagtd '; + if ($conf->browser->layout == 'phone') $tagtd=''; + print '
'; + print $mysoc->logo_squarred; + print '
'; + + // It offers the generation of the thumbnail if it does not exist + if (!is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini) && preg_match('/(\.jpg|\.jpeg|\.png)$/i', $mysoc->logo_squarred)) + { + print '  '; + } + elseif ($mysoc->logo_squarred_mini && is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) + { + print ''; + } + else + { + print ''; + } + print '
'; + + print ''; + + // Note print ''.$langs->trans("Note").'' . (! empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? nl2br($conf->global->MAIN_INFO_SOCIETE_NOTE) : '') . ''; print ''; diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 1948ce28a57..a857898f5dc 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -76,6 +76,8 @@ ALTER TABLE llx_holiday_extrafields ADD INDEX idx_holiday_extrafields (fk_object ALTER TABLE llx_societe_rib MODIFY label varchar(200); +ALTER TABLE llx_societe ADD COLUMN logo_squarred varchar(255); + insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_SENTBYMAIL','Email sent','Executed when an email is sent from user card','user',300); create table llx_entrepot_extrafields diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql index 4db88defc68..f312015a662 100644 --- a/htdocs/install/mysql/tables/llx_societe.sql +++ b/htdocs/install/mysql/tables/llx_societe.sql @@ -107,6 +107,7 @@ create table llx_societe supplier_order_min_amount double(24,8) DEFAULT NULL, -- min amount for supplier orders default_lang varchar(6), -- default language logo varchar(255) DEFAULT NULL, + logo_squarred varchar(255) DEFAULT NULL, canvas varchar(32) DEFAULT NULL, -- type of canvas if used (null by default) fk_entrepot integer DEFAULT 0, -- if we need a link between third party and warehouse webservices_url varchar(255), -- supplier webservice url diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index afce2e4fa34..b34ca99013d 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1070,6 +1070,9 @@ CompanyCountry=Country CompanyCurrency=Main currency CompanyObject=Object of the company Logo=Logo +LogoDesc=Main logo of company. Will be used into generated documents (PDF, ...) +LogoSquarred=Logo (squarred) +LogoSquarredDesc=Must be a squarred icon (width = height). This logo will be used as the favorite icon or other need like for the top menu bar (if not disabled into disaply setup). DoNotSuggestPaymentMode=Do not suggest NoActiveBankAccountDefined=No active bank account defined OwnerOfBankAccount=Owner of bank account %s diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index c4c702bc73b..2b4ae2bb7a0 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -465,6 +465,9 @@ class Societe extends CommonObject public $logo; public $logo_small; public $logo_mini; + public $logo_squarred; + public $logo_squarred_small; + public $logo_squarred_mini; public $array_options; @@ -1072,6 +1075,7 @@ class Societe extends CommonObject $sql .= ",barcode = ".(! empty($this->barcode)?"'".$this->db->escape($this->barcode)."'":"null"); $sql .= ",default_lang = ".(! empty($this->default_lang)?"'".$this->db->escape($this->default_lang)."'":"null"); $sql .= ",logo = ".(! empty($this->logo)?"'".$this->db->escape($this->logo)."'":"null"); + $sql .= ",logo_squarred = ".(! empty($this->logo_squarred)?"'".$this->db->escape($this->logo_squarred)."'":"null"); $sql .= ",outstanding_limit= ".($this->outstanding_limit!=''?$this->outstanding_limit:'null'); $sql .= ",order_min_amount= ".($this->order_min_amount!=''?$this->order_min_amount:'null'); $sql .= ",supplier_order_min_amount= ".($this->supplier_order_min_amount!=''?$this->supplier_order_min_amount:'null'); @@ -1266,7 +1270,7 @@ class Societe extends CommonObject $sql .= ', s.webservices_url, s.webservices_key'; $sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.barcode'; $sql .= ', s.fk_departement as state_id, s.fk_pays as country_id, s.fk_stcomm, s.remise_supplier, s.mode_reglement, s.cond_reglement, s.fk_account, s.tva_assuj'; - $sql .= ', s.mode_reglement_supplier, s.cond_reglement_supplier, s.localtax1_assuj, s.localtax1_value, s.localtax2_assuj, s.localtax2_value, s.fk_prospectlevel, s.default_lang, s.logo'; + $sql .= ', s.mode_reglement_supplier, s.cond_reglement_supplier, s.localtax1_assuj, s.localtax1_value, s.localtax2_assuj, s.localtax2_value, s.fk_prospectlevel, s.default_lang, s.logo, s.logo_squarred'; $sql .= ', s.fk_shipping_method'; $sql .= ', s.outstanding_limit, s.import_key, s.canvas, s.fk_incoterms, s.location_incoterms'; $sql .= ', s.order_min_amount, s.supplier_order_min_amount'; @@ -1420,6 +1424,7 @@ class Societe extends CommonObject $this->modelpdf = $obj->model_pdf; $this->default_lang = $obj->default_lang; $this->logo = $obj->logo; + $this->logo_squarred = $obj->logo_squarred; $this->webservices_url = $obj->webservices_url; $this->webservices_key = $obj->webservices_key; @@ -2110,6 +2115,12 @@ class Societe extends CommonObject $label.= Form::showphoto('societe', $this, 0, 40, 0, 'photowithmargin', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip. $label.= '
'; } + elseif (! empty($this->logo_squarred) && class_exists('Form')) + { + /*$label.= '
'; + $label.= Form::showphoto('societe', $this, 0, 40, 0, 'photowithmargin', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip. + $label.= '
';*/ + } $label.= '
'; @@ -3522,6 +3533,9 @@ class Societe extends CommonObject $this->logo=empty($conf->global->MAIN_INFO_SOCIETE_LOGO)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO; $this->logo_small=empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SMALL)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_SMALL; $this->logo_mini=empty($conf->global->MAIN_INFO_SOCIETE_LOGO_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI; + $this->logo_squarred=empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED; + $this->logo_squarred_small=empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL; + $this->logo_squarred_mini=empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI; // Define if company use vat or not $this->tva_assuj=$conf->global->FACTURE_TVAOPTION; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index ddd865cbbb2..1e69bdf1ecc 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -902,6 +902,17 @@ table[summary="list_of_modules"] .fa-cog { font-size: !important; } + div#login_left, div#login_right { + min-width: 150px !important; + max-width: 200px !important; + padding-left: 5px !important; + padding-right: 5px !important; + } + + div.login_block { + height: 64px !important; + } + .divmainbodylarge { margin-left: 20px !important; margin-right: 20px !important; } .tdoverflowonsmartphone { @@ -923,11 +934,14 @@ table[summary="list_of_modules"] .fa-cog { padding-bottom: 5px; } + .login_table .tdinputlogin { + min-width: unset !important; + } input, input[type=text], input[type=password], select, textarea { min-width: 20px; } .trinputlogin input[type=text], input[type=password] { - max-width: 180px; + max-width: 140px; } .vmenu .searchform input { max-width: 138px; /* length of input text in the quick search box when using a smartphone and without dolidroid */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 72974ded51f..ba97c329073 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1061,6 +1061,10 @@ table[summary="list_of_modules"] .fa-cog { font-size: px !important; } + .login_vertical_align { + padding-left: 0; + } + .divmainbodylarge { margin-left: 20px; margin-right: 20px; } .tdoverflowonsmartphone { From fc886b9950b03088597a58dc16825d08835fc021 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 11:29:39 +0200 Subject: [PATCH 02/11] css --- htdocs/theme/eldy/global.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 1e69bdf1ecc..22515f9a76f 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1105,7 +1105,7 @@ div.blockvmenulogo margin-right: 8px; background-color: rgba(255,255,255,0.7); padding: 0; - border-radius: 5px; + border-radius: 4px; height: px; /* width: 100px; */ max-width: 100px; From ab8199f71aa00a2e4b32d7130f84c2a2f877fa00 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 11:38:49 +0200 Subject: [PATCH 03/11] Fix avoid deletion of file if we still need it --- htdocs/admin/company.php | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 9da2e550501..46bd2352b46 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -321,25 +321,43 @@ if ($action == 'removelogo' || $action == 'removelogosquarred') require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $logofilename = $mysoc->logo; - if ($action == 'removelogosquarred') $logofilename = $mysoc->logo_squarred; + $logofilenamebis = $mysoc->logo_squarred; + if ($action == 'removelogosquarred') + { + $logofilename = $mysoc->logo_squarred; + $logofilenamebis = $mysoc->logo; + } + $logofile=$conf->mycompany->dir_output.'/logos/'.$logofilename; - if ($logofilename != '') dol_delete_file($logofile); + if ($logofilename != '' && $logofilename != $logofilenamebis) dol_delete_file($logofile); dolibarr_del_const($db, $constant, $conf->entity); if ($action == 'removelogosquarred') $mysoc->logo_squarred=''; else $mysoc->logo=''; $logofilename = $mysoc->logo_small; - if ($action == 'removelogosquarred') $logofilename = $mysoc->logo_squarred_small; + $logofilenamebis = $mysoc->logo_squarred_small; + if ($action == 'removelogosquarred') + { + $logofilename = $mysoc->logo_squarred_small; + $logofilenamebis = $mysoc->logo_small; + } + $logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$logofilename; - if ($logofilename != '') dol_delete_file($logosmallfile); + if ($logofilename != '' && $logofilename != $logofilenamebis) dol_delete_file($logosmallfile); dolibarr_del_const($db, $constant."_SMALL", $conf->entity); if ($action == 'removelogosquarred') $mysoc->logo_squarred_small=''; else $mysoc->logo_small=''; $logofilename = $mysoc->logo_mini; - if ($action == 'removelogosquarred') $logofilename = $mysoc->logo_squarred_mini; + $logofilenamebis = $mysoc->logo_squarred_mini; + if ($action == 'removelogosquarred') + { + $logofilename = $mysoc->logo_squarred_mini; + $logofilenamebis = $mysoc->logo_mini; + } + $logominifile=$conf->mycompany->dir_output.'/logos/thumbs/'.$logofilename; - if ($logofilename != '') dol_delete_file($logominifile); + if ($logofilename != '' && $logofilename != $logofilenamebis) dol_delete_file($logominifile); dolibarr_del_const($db, $constant."_MINI", $conf->entity); if ($action == 'removelogosquarred') $mysoc->logo_squarred_mini=''; else $mysoc->logo_mini=''; From 4db57f53f9e77d831351c94820ab2ea8200e3c1c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 11:39:33 +0200 Subject: [PATCH 04/11] typo --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index b34ca99013d..93bf4b90f94 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1072,7 +1072,7 @@ CompanyObject=Object of the company Logo=Logo LogoDesc=Main logo of company. Will be used into generated documents (PDF, ...) LogoSquarred=Logo (squarred) -LogoSquarredDesc=Must be a squarred icon (width = height). This logo will be used as the favorite icon or other need like for the top menu bar (if not disabled into disaply setup). +LogoSquarredDesc=Must be a squarred icon (width = height). This logo will be used as the favorite icon or other need like for the top menu bar (if not disabled into display setup). DoNotSuggestPaymentMode=Do not suggest NoActiveBankAccountDefined=No active bank account defined OwnerOfBankAccount=Owner of bank account %s From 5801d09dbeb7480e59bb59d6b31249e1f6fe7390 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2019 12:28:13 +0200 Subject: [PATCH 05/11] NEW Use the squarre logo as favicon of pages --- ChangeLog | 1 + htdocs/core/lib/security2.lib.php | 5 +++- htdocs/core/menus/standard/eldy.lib.php | 6 ++-- htdocs/main.inc.php | 37 ++++++++++++------------- htdocs/public/test/test_arrays.php | 1 - htdocs/theme/eldy/manifest.json.php | 10 +++---- 6 files changed, 31 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index c8b7db19236..ede0e10a89f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,7 @@ Following changes may create regressions for some external modules, but were nec * Removed function dol_micro_time. Use native PHP microtime instead. * The trigger BON_PRELEVEMENT_CREATE has been renamed into DIRECT_DEBIT_ORDER_CREATE. * The constant INVOICE_SHOW_POS_IN_EXPORT has been renamed into INVOICE_SHOW_POS. +* If your logo was visible on the menu bar, you must upload a new logo into 'Home-Setup-Company/Organization' to have it visible agin in menu. ***** ChangeLog for 10.0.2 compared to 10.0.1 ***** diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 07eecf0f352..c81ea9d98d7 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -282,8 +282,11 @@ if (! function_exists('dol_loginfunction')) // Set jquery theme $dol_loginmesg = (! empty($_SESSION["dol_loginmesg"])?$_SESSION["dol_loginmesg"]:''); - $favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico', 1); + + $favicon = DOL_URL_ROOT.'/theme/common/dolibarr_logo_256x256.png'; + if (! empty($mysoc->logo_squarred_mini)) $favicon = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini); if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL; + $jquerytheme = 'base'; if (! empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index dbf56429086..0bfc9f9b7b9 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -478,16 +478,16 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Show logo company if (empty($conf->global->MAIN_MENU_INVERT) && empty($noout) && ! empty($conf->global->MAIN_SHOW_LOGO) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $mysoc->logo_mini=(empty($conf->global->MAIN_INFO_SOCIETE_LOGO_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI); + //$mysoc->logo_mini=(empty($conf->global->MAIN_INFO_SOCIETE_LOGO_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI); $mysoc->logo_squarred_mini=(empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI); if (! empty($mysoc->logo_squarred_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) { $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini); } - elseif (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) + /*elseif (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) { $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); - } + }*/ else { $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo_squarred.png'; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 2d612f5808d..33c0e289aed 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1195,7 +1195,7 @@ function top_httphead($contenttype = 'text/html', $forcenocache = 0) */ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $disablejmobile = 0, $disablenofollow = 0) { - global $db, $conf, $langs, $user, $hookmanager; + global $db, $conf, $langs, $user, $mysoc, $hookmanager; top_httphead(); @@ -1224,9 +1224,11 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr print ''."\n"; // Favicon - $favicon = DOL_MAIN_URL_ROOT . '/theme/'.$conf->theme.'/img/favicon.ico'; + $favicon = DOL_URL_ROOT.'/theme/common/dolibarr_logo_256x256.png'; + if (! empty($mysoc->logo_squarred_mini)) $favicon = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini); if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL; if (empty($conf->dol_use_jmobile)) print ''."\n"; // Not required into an Android webview + //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print ''."\n"; //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print ''."\n"; //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print ''."\n"; @@ -1614,9 +1616,6 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead print '