From dbc017ae45c83ad5a2299592ddf84be8ad988ebb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 12 Sep 2016 02:05:09 +0200 Subject: [PATCH 01/37] Fix bad merge --- htdocs/theme/eldy/style.css.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 1b3ad4da2d6..59e7a95f258 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -4415,11 +4415,7 @@ img.demothumb { /* nboftopmenuentries = , fontsize= */ /* rule to reduce top menu - 1st reduction */ -<<<<<<< HEAD @media only screen and (max-width: px) -======= -@media only screen and (max-width: px) ->>>>>>> branch '3.9' of git@github.com:Dolibarr/dolibarr.git { div.tmenucenter { max-width: px; /* size of viewport */ From d6ea6d172561ae5ffda70fec8417730033470d95 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 12 Sep 2016 02:30:21 +0200 Subject: [PATCH 02/37] Fix deprecated option should be on --- htdocs/fourn/commande/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index a65386ac7dd..a7a642c4e85 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -130,8 +130,8 @@ if (empty($user->socid)) $fieldstosearchall["cf.note_private"]="NotePrivate"; $checkedtypetiers=0; $arrayfields=array( 'cf.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), - 'cf.ref_supplier'=>array('label'=>$langs->trans("RefOrderSupplier"), 'checked'=>1, 'enabled'=>$conf->global->SUPPLIER_ORDER_HIDE_REF_SUPPLIER), - 'p.project_ref'=>array('label'=>$langs->trans("ProjectRef"), 'enabled'=>$conf->global->PROJECT_SHOW_REF_INTO_LISTS), + 'cf.ref_supplier'=>array('label'=>$langs->trans("RefOrderSupplier"), 'checked'=>1, 'enabled'=>1), + 'p.project_ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>0, 'enabled'=>1), 'u.login'=>array('label'=>$langs->trans("AuthorRequest"), 'checked'=>1), 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), 's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1), From ac509d6565f2cb059c1e99a3c99ad5f765fd203e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 12 Sep 2016 02:47:36 +0200 Subject: [PATCH 03/37] FIX #2991 --- htdocs/opensurvey/card.php | 19 ++++++++++++------- .../class/opensurveysondage.class.php | 3 +-- htdocs/public/opensurvey/studs.php | 11 ++++++++++- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 26cf85cb3d6..3fa238894e1 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -46,11 +46,6 @@ if (GETPOST('id')) { $object=new Opensurveysondage($db); $result=$object->fetch(0, $numsondage); -if ($result <= 0) -{ - dol_print_error($db,$object->error); - exit; -} $expiredate=dol_mktime(0, 0, 0, GETPOST('expiremonth'), GETPOST('expireday'), GETPOST('expireyear')); @@ -206,7 +201,17 @@ foreach ($toutsujet as $value) $toutsujet=str_replace("@","
",$toutsujet); $toutsujet=str_replace("°","'",$toutsujet); - +if (empty($object->ref)) // For survey, id is a hex string +{ + $langs->load("errors"); + print $langs->trans("ErrorRecordNotFound"); + + llxFooter(); + + $db->close(); + exit; +} + print '
'."\n"; print ''; @@ -442,6 +447,6 @@ print '
'; print '
'; -llxFooterSurvey(); +llxFooter(); $db->close(); diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 02952f4bf75..5ad27731d88 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -228,8 +228,7 @@ class Opensurveysondage extends CommonObject $obj = $this->db->fetch_object($resql); $this->id_sondage = $obj->id_sondage; - //For compatibility - $this->ref = $this->id_sondage; + $this->ref = $this->id_sondage; //For compatibility $this->commentaires = $obj->description; // deprecated $this->description = $obj->description; diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index 834f17b8b2c..6f242a00544 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -41,7 +41,6 @@ if (GETPOST('sondage')) $object=new Opensurveysondage($db); $result=$object->fetch(0,$numsondage); -if ($result <= 0) dol_print_error('','Failed to get survey id '.$numsondage); $nblignes=$object->fetch_lines(); @@ -241,6 +240,16 @@ $arrayofjs=array(); $arrayofcss=array('/opensurvey/css/style.css'); llxHeaderSurvey($object->titre, "", 0, 0, $arrayofjs, $arrayofcss); +if (empty($object->ref)) // For survey, id is a hex string +{ + $langs->load("errors"); + print $langs->trans("ErrorRecordNotFound"); + + llxFooterSurvey(); + + $db->close(); + exit; +} // Define format of choices $toutsujet=explode(",",$object->sujet); From 34c19f9cf1493fd556f1511f26c8d0b8ec7b2b94 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 12 Sep 2016 02:50:50 +0200 Subject: [PATCH 04/37] On non public page, access with a bad fetch id can return error --- htdocs/opensurvey/card.php | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 3fa238894e1..e27763fadd6 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -46,6 +46,11 @@ if (GETPOST('id')) { $object=new Opensurveysondage($db); $result=$object->fetch(0, $numsondage); +if ($result <= 0) +{ + dol_print_error($db,$object->error); + exit; +} $expiredate=dol_mktime(0, 0, 0, GETPOST('expiremonth'), GETPOST('expireday'), GETPOST('expireyear')); @@ -201,17 +206,6 @@ foreach ($toutsujet as $value) $toutsujet=str_replace("@","
",$toutsujet); $toutsujet=str_replace("°","'",$toutsujet); -if (empty($object->ref)) // For survey, id is a hex string -{ - $langs->load("errors"); - print $langs->trans("ErrorRecordNotFound"); - - llxFooter(); - - $db->close(); - exit; -} - print '
'."\n"; print ''; @@ -445,8 +439,6 @@ if ($object->allow_comments) { print '
'; -print '
'; - llxFooter(); $db->close(); From bd734de437502297e2658b43c693be887db4dc24 Mon Sep 17 00:00:00 2001 From: phf Date: Mon, 12 Sep 2016 09:52:35 +0200 Subject: [PATCH 05/37] Fix bad query --- htdocs/install/mysql/tables/llx_multicurrency_rate.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_multicurrency_rate.sql b/htdocs/install/mysql/tables/llx_multicurrency_rate.sql index 74661088751..545807c8aed 100644 --- a/htdocs/install/mysql/tables/llx_multicurrency_rate.sql +++ b/htdocs/install/mysql/tables/llx_multicurrency_rate.sql @@ -23,5 +23,5 @@ CREATE TABLE llx_multicurrency_rate date_sync datetime DEFAULT NULL, rate double NOT NULL DEFAULT 0, fk_multicurrency integer NOT NULL, - entity integer DEFAULT 1, -) ENGINE=innodb; \ No newline at end of file + entity integer DEFAULT 1 +) ENGINE=innodb; From 20141ec9bc0203f9585e2fa89e96cf9756ea9ab8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 12 Sep 2016 17:31:36 +0200 Subject: [PATCH 06/37] Fix default value of new table --- htdocs/install/mysql/migration/3.9.0-4.0.0.sql | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql index 67e3b3af448..e90205d1dc3 100644 --- a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql +++ b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql @@ -47,7 +47,7 @@ DELETE FROM llx_user_param where param = 'MAIN_THEME' and value in ('auguria', ' -- DROP TABLE llx_product_lot; CREATE TABLE llx_product_lot ( rowid integer AUTO_INCREMENT PRIMARY KEY, - entity integer, + entity integer DEFAULT 1, fk_product integer NOT NULL, -- Id of product batch varchar(30) DEFAULT NULL, -- Lot or serial number eatby date DEFAULT NULL, -- Eatby date @@ -61,6 +61,10 @@ CREATE TABLE llx_product_lot ( ALTER TABLE llx_product_lot ADD UNIQUE INDEX uk_product_lot(fk_product, batch); +-- VPGSQL8.2 ALTER TABLE llx_product_lot ALTER COLUMN entity SET DEFAULT 1; +ALTER TABLE llx_product_lot MODIFY COLUMN entity integer DEFAULT 1; +UPDATE llx_product_lot SET entity = 1 WHERE entity IS NULL; + DROP TABLE llx_stock_serial; ALTER TABLE llx_product ADD COLUMN note_public text; From 0cf5ee2f28b751baee5ba5456141f3b2073730fc Mon Sep 17 00:00:00 2001 From: phf Date: Tue, 13 Sep 2016 10:12:55 +0200 Subject: [PATCH 07/37] Fix clone object with "link" as extrafield --- htdocs/core/class/commonobject.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index cf54ade1a64..0a0b85dab7a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4173,7 +4173,9 @@ abstract class CommonObject $object = new $InfoFieldList[0]($this->db); if ($value) { - $res=$object->fetch(0,$value); + if (is_numeric($value)) $res=$object->fetch($value); + else $res=$object->fetch('',$value); + if ($res > 0) $this->array_options[$key]=$object->id; else { From f8912267cb417c121391e1d4bb849c8952a7b652 Mon Sep 17 00:00:00 2001 From: Quentin Vial-Gouteyron Date: Tue, 13 Sep 2016 11:56:39 +0200 Subject: [PATCH 08/37] NEW Hook on stock product card --- htdocs/product/stock/product.php | 62 +++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 13 deletions(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 2411dde51e4..801fc9efd86 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -63,12 +63,43 @@ if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'produit&stock',$id,'product&product','','',$fieldid); +$object = new Product($db); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + +if ($id > 0 || ! empty($ref)) +{ + $result = $object->fetch($id, $ref); + +} +$modulepart='product'; + +// Get object canvas (By default, this is not defined, so standard usage of dolibarr) +$canvas = !empty($object->canvas)?$object->canvas:GETPOST("canvas"); +$objcanvas=null; +if (! empty($canvas)) +{ + require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; + $objcanvas = new Canvas($db,$action); + $objcanvas->getCanvas('stockproduct','card',$canvas); +} + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('stockproductcard','globalcard')); + + /* * Actions */ if ($cancel) $action=''; +$parameters=array('id'=>$id, 'ref'=>$ref, 'objcanvas'=>$objcanvas); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + // Set stock limit if ($action == 'setseuil_stock_alerte') { @@ -664,28 +695,33 @@ else /* */ /* ************************************************************************** */ +$parameters=array(); -if (empty($action) && $object->id) +$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook +if (empty($reshook)) { - print "
\n"; - if ($user->rights->stock->mouvement->creer) - { - print ''.$langs->trans("StockCorrection").''; - } - - //if (($user->rights->stock->mouvement->creer) && ! $object->hasbatch()) - if ($user->rights->stock->mouvement->creer) + if (empty($action) && $object->id) { - print ''.$langs->trans("StockTransfer").''; + print "
\n"; + + if ($user->rights->stock->mouvement->creer) + { + print ''.$langs->trans("StockCorrection").''; + } + + //if (($user->rights->stock->mouvement->creer) && ! $object->hasbatch()) + if ($user->rights->stock->mouvement->creer) + { + print ''.$langs->trans("StockTransfer").''; + } + + print '
'; } - print '
'; } - - /* * Stock detail (by warehouse). May go down into batch details. */ From 6d304f4a234b7ff9d145059bb40a61ce1321ffcd Mon Sep 17 00:00:00 2001 From: Quentin Vial-Gouteyron Date: Tue, 13 Sep 2016 14:56:57 +0200 Subject: [PATCH 09/37] NEW Hook formObjectOptions --- htdocs/product/stock/product.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 801fc9efd86..5a600707bc7 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -536,7 +536,11 @@ if ($id > 0 || $ref) print ''.$form->editfieldkey("StockLimit",'seuil_stock_alerte',$object->seuil_stock_alerte,$object,$user->rights->produit->creer).''; print $form->editfieldval("StockLimit",'seuil_stock_alerte',$object->seuil_stock_alerte,$object,$user->rights->produit->creer,'string'); print ''; - + + // Hook formObject + $parameters=array('colspan' => 3); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + // Desired stock print ''.$form->editfieldkey($form->textwithpicto($langs->trans("DesiredStock"), $langs->trans("DesiredStockDesc"), 1),'desiredstock',$object->desiredstock,$object,$user->rights->produit->creer); print ''; From 93b216e628d37e93e8d187477ecec95024096543 Mon Sep 17 00:00:00 2001 From: Sergio Sanchis Climent Date: Thu, 15 Sep 2016 05:18:08 +0200 Subject: [PATCH 10/37] FIX: #5699 --- htdocs/core/class/utils.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index dd4096c5257..2724d64f17f 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -168,7 +168,7 @@ class Utils // Check type parameter if ($type == 'auto') $type = $db->type; - if (! in_array($type, array('pgsql', 'mysql', 'mysqli'))) + if (! in_array($type, array('pgsql', 'mysql', 'mysqli','mysqlnobin'))) { $langs->load("errors"); $this->error=$langs->transnoentitiesnoconv("ErrorBadValueForParameter", $type, "Basetype"); From 3d8f756646655dcb71058d55e4e0463355d91603 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Thu, 15 Sep 2016 10:51:48 +0200 Subject: [PATCH 11/37] prevent space separator in module definition If we type in definition of dictionnary "code,libelle, color" we can't insert/update value... propose to allow typing space bettween field (better lisibility) and remove space after --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 65d9514e796..eae25599075 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -580,7 +580,7 @@ if ($id == 10) // Actions add or modify an entry into a dictionary if (GETPOST('actionadd') || GETPOST('actionmodify')) { - $listfield=explode(',',$tabfield[$id]); + $listfield=explode(',', str_replace(' ', '',$tabfield[$id])); $listfieldinsert=explode(',',$tabfieldinsert[$id]); $listfieldmodify=explode(',',$tabfieldinsert[$id]); $listfieldvalue=explode(',',$tabfieldvalue[$id]); From 54756ef729860621a30de38833b94395c398131e Mon Sep 17 00:00:00 2001 From: Ion Agorria Date: Thu, 15 Sep 2016 23:45:13 +0200 Subject: [PATCH 12/37] Fix wrong trigger in supplier order --- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 2d2619fb203..2b979862d43 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3089,7 +3089,7 @@ class CommandeFournisseurLigne extends CommonOrderLine if (! $error && ! $notrigger) { // Call trigger - $result=$this->call_trigger('LINEORDER_INSERT',$user); + $result=$this->call_trigger('LINEORDER_SUPPLIER_CREATE',$user); if ($result < 0) $error++; // End call triggers } From 1b05be0305365919cf3e85ea27c1a3499404f42c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josep=20Llu=C3=ADs?= Date: Fri, 16 Sep 2016 17:07:01 +0200 Subject: [PATCH 13/37] Minor fix: incorrect key translations "Post" key doesn't exist: Changed to "PostOrFunction" "Email" key doesn't exist: Changed to "EMail" "DateCreate" changed to "DateCreateShort" in $arrayfields (with the same key in print_liste_field_titre function) --- htdocs/contact/list.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 57d3cc52090..b8c96884e96 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -129,18 +129,18 @@ $fieldstosearchall = array( $arrayfields=array( 'p.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1), 'p.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1), - 'p.poste'=>array('label'=>$langs->trans("Post"), 'checked'=>1), + 'p.poste'=>array('label'=>$langs->trans("PostOrFunction"), 'checked'=>1), 'p.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0), 'p.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0), - 'p.phone'=>array('label'=>$langs->trans("PhonePro"), 'checked'=>1), + 'p.phone'=>array('label'=>$langs->trans("Phone"), 'checked'=>1), 'p.phone_perso'=>array('label'=>$langs->trans("PhonePerso"), 'checked'=>0), 'p.phone_mobile'=>array('label'=>$langs->trans("PhoneMobile"), 'checked'=>1), 'p.fax'=>array('label'=>$langs->trans("Fax"), 'checked'=>1), - 'p.email'=>array('label'=>$langs->trans("Email"), 'checked'=>1), + 'p.email'=>array('label'=>$langs->trans("EMail"), 'checked'=>1), 'p.skype'=>array('label'=>$langs->trans("Skype"), 'checked'=>1, 'enabled'=>(! empty($conf->skype->enabled))), 'p.thirdparty'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)), 'p.priv'=>array('label'=>$langs->trans("ContactVisibility"), 'checked'=>1, 'position'=>200), - 'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + 'p.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500), 'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 'p.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), ); From 7fe0c4211c846ae8d5dd2394003b383941f95c12 Mon Sep 17 00:00:00 2001 From: Ion Agorria Date: Sat, 17 Sep 2016 02:35:02 +0200 Subject: [PATCH 14/37] Move order supplier deleteline code to line class --- .../class/fournisseur.commande.class.php | 111 +++++++++++------- 1 file changed, 70 insertions(+), 41 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 2d2619fb203..476bffaec8f 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1627,55 +1627,34 @@ class CommandeFournisseur extends CommonOrder * * @param int $idline Id of line to delete * @param int $notrigger 1=Disable call to triggers - * @return <0 if KO, >0 if OK + * @return int <0 if KO, >0 if OK */ public function deleteline($idline, $notrigger=0) { - global $user,$langs,$conf; - $error = 0; - - if ($this->statut != 0) + if ($this->statut == 0) { - return -1; - } + $line = new CommandeFournisseurLigne($this->db); - $this->db->begin(); + if ($line->fetch($idline) <= 0) + { + return 0; + } - if (! $notrigger) - { - // Call trigger - $result=$this->call_trigger('LINEORDER_SUPPLIER_DELETE',$user); - if ($result < 0) $error++; - // End call triggers - } - - if (! $error) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid = ".$idline; - $resql=$this->db->query($sql); - - dol_syslog(get_class($this)."::deleteline sql=".$sql); - if (! $resql) - { - $this->error=$this->db->lasterror(); - $error++; - } - } - - if (! $error) - { - $result=$this->update_price(); - } - - if (! $error) - { - $this->db->commit(); - return 1; + if ($line->delete($notrigger) > 0) + { + $this->update_price(); + return 1; + } + else + { + $this->error = $line->error; + $this->errors = $line->errors; + return -1; + } } else - { - $this->db->rollback(); - return -1; + { + return -2; } } @@ -3202,5 +3181,55 @@ class CommandeFournisseurLigne extends CommonOrderLine return -1; } } + + /** + * Delete line in database + * + * @param int $notrigger 1=Disable call to triggers + * @return int <0 if KO, >0 if OK + */ + function delete($notrigger) + { + global $user; + + $error=0; + + $this->db->begin(); + + $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid='".$this->rowid."';"; + + dol_syslog(__METHOD__, LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + + if (!$notrigger) + { + // Call trigger + $result=$this->call_trigger('LINEORDER_SUPPLIER_DELETE',$user); + if ($result < 0) $error++; + // End call triggers + } + + if (!$error) + { + $this->db->commit(); + return 1; + } + + foreach($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + else + { + $this->error=$this->db->lasterror(); + return -1; + } + } } From 97e396af697e6f71237c4861d7044982ffc28045 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 17 Sep 2016 21:03:20 +0200 Subject: [PATCH 15/37] Work on module website --- .../install/mysql/migration/4.0.0-5.0.0.sql | 1 + .../mysql/tables/llx_website_pages.sql | 2 +- htdocs/theme/eldy/style.css.php | 7 ++-- htdocs/theme/md/style.css.php | 31 ++++++++++------ htdocs/websites/index.php | 35 +++++++++++++------ 5 files changed, 53 insertions(+), 23 deletions(-) diff --git a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql index a0c74af9482..ef7189a3fa0 100644 --- a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql +++ b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql @@ -95,6 +95,7 @@ create table llx_product_lot_extrafields ALTER TABLE llx_product_lot_extrafields ADD INDEX idx_product_lot_extrafields (fk_object); +ALTER TABLE llx_website_page MODIFY content MEDIUMTEXT; diff --git a/htdocs/install/mysql/tables/llx_website_pages.sql b/htdocs/install/mysql/tables/llx_website_pages.sql index 28f0c870dea..f1ea66bb56a 100644 --- a/htdocs/install/mysql/tables/llx_website_pages.sql +++ b/htdocs/install/mysql/tables/llx_website_pages.sql @@ -25,7 +25,7 @@ CREATE TABLE llx_website_page title varchar(255), description varchar(255), keywords varchar(255), - content text, + content mediumtext, -- text is not enough in size status integer, date_creation datetime, date_modification datetime, diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index fa6d056c587..b014776e15f 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1780,7 +1780,7 @@ img.toolbarbutton { } /* hide the toggler-button when the pane is 'slid open' */ -.ui-layout-resizer-sliding .ui-layout-toggler { +.ui-layout-resizer-sliding .ui-layout-toggler { display: none; } @@ -2007,7 +2007,9 @@ span.tabspan { /* Boutons actions */ /* ============================================================================== */ -div.divButAction { margin-bottom: 1.4em; } +div.divButAction { + margin-bottom: 1.4em; +} span.butAction, span.butActionDelete { cursor: pointer; @@ -3321,6 +3323,7 @@ td.hidden { } .websitetools { float: right; + height: 28px; } .websiteinputurl { display: inline-block; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index d4d24172bbf..5591edd7a80 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -32,7 +32,7 @@ if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1); if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); if (! defined('NOLOGIN')) define('NOLOGIN',1); // File must be accessed by logon page so without login -//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); +//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); @@ -580,7 +580,7 @@ div.myavailability { margin-top: 25px !important; } -/* for future usage (when left menu has been removed) */ +/* DOL_XXX for future usage (when left menu has been removed). If we do not use datatable */ .table-responsive { width: calc(100% - 330px); margin-bottom: 15px; @@ -615,7 +615,7 @@ div.myavailability { .maxwidth500 { max-width: 500px; } .minheight20 { min-height: 20px; } .minheight40 { min-height: 40px; } -.titlefield { width: 30%; } +.titlefield { width: 25%; } .titlefieldcreate { width: 20%; } /* Force values for small screen */ @@ -849,7 +849,7 @@ div.ficheaddleft { browser->layout != 'phone') { print "padding-".$left.": 16px;\n"; } else print "margin-top: 10px;\n"; ?> } -/* Force values for small screen */ +/* Force values on one colum for small screen */ @media only screen and (max-width: 900px) { div.fiche { @@ -1167,7 +1167,7 @@ div.mainmenu { div.mainmenu.home{ background-image: url(); - background-position-x: middle; + background-position-x: center; } div.mainmenu.accountancy { @@ -1281,7 +1281,7 @@ foreach($mainmenuusedarray as $val) $url=dol_buildpath($path.'/theme/'.$theme.'/img/menus/generic'.$generic.".png",1); $found=1; if ($generic < 4) $generic++; - print "/* A mainmenu entry but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n"; + print "/* A mainmenu entry was found but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n"; } if ($found) { @@ -1777,7 +1777,7 @@ img.toolbarbutton { } /* hide the toggler-button when the pane is 'slid open' */ -.ui-layout-resizer-sliding ui-layout-toggler { +.ui-layout-resizer-sliding .ui-layout-toggler { display: none; } @@ -2016,8 +2016,8 @@ span.tabspan { /* Boutons actions */ /* ============================================================================== */ -div.divButAction { - margin-bottom: 1.4em; +div.divButAction { + margin-bottom: 1.4em; vertical-align: top; } @@ -3216,7 +3216,18 @@ td.hidden { } .websitetools { float: right; - padding-top: 2px; + height: 28px; +} +.websiteinputurl { + display: inline-block; + vertical-align: top; +} +.websiteiframenoborder { + border: 0px; +} +a.websitebuttonsitepreview img { + width: 26px; + display: inline-block; } .websiteiframenoborder { border: 0px; diff --git a/htdocs/websites/index.php b/htdocs/websites/index.php index 11bcc12e7af..d0aa6424787 100644 --- a/htdocs/websites/index.php +++ b/htdocs/websites/index.php @@ -222,35 +222,48 @@ if ($action == 'delete') // Update css if ($action == 'updatecss') { - $db->begin(); + //$db->begin(); $res = $object->fetch(0, $website); + /* $res = $object->update($user); if ($res > 0) { $db->commit(); - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); $action=''; } else { + $error++; $db->rollback(); }*/ - $csscontent =''."\n"; + $csscontent.= '"."\n"; + $csscontent.= ''."\n"; $csscontent.= GETPOST('WEBSITE_CSS_INLINE'); + dol_syslog("Save file css into ".$filecss); + dol_mkdir($pathofwebsite); $result = file_put_contents($filecss, $csscontent); if (! empty($conf->global->MAIN_UMASK)) @chmod($filecss, octdec($conf->global->MAIN_UMASK)); - - if ($result) setEventMessages($langs->trans("Saved"), null, 'mesgs'); - else setEventMessages('Failed to write file '.$fileindex, null, 'errors'); + if (! $result) + { + $error++; + setEventMessages('Failed to write file '.$filecss, null, 'errors'); + } + + if (! $error) + { + setEventMessages($langs->trans("Saved"), null, 'mesgs'); + } + $action='preview'; } @@ -432,7 +445,7 @@ if ($action == 'updatecontent') /* $objectpage->content = preg_replace('//s', '', $objectpage->content); */ $res = $objectpage->update($user); - if (! $res > 0) + if ($res < 0) { $error++; setEventMessages($objectpage->error, $objectpage->errors, 'errors'); @@ -487,7 +500,7 @@ if ($action == 'updatecontent') dol_delete_file($filetpl); $tplcontent =''; - $tplcontent.= ''."\n"; + $tplcontent.= ""."\n"; $tplcontent.= ''."\n"; $tplcontent.= '
'."\n"; $tplcontent.= ''."\n"; @@ -840,7 +853,9 @@ if ($action == 'editcss') print '
'; $csscontent = @file_get_contents($filecss); - + // Clean php css file to get only css part + $csscontent = preg_replace('//s', '', $csscontent); + dol_fiche_head(); print ''."\n"; @@ -967,7 +982,7 @@ if ($action == 'editcontent') $doleditor->Create(0, '', false); } -print ''; +print "\n\n"; From 6093dfe3334c5f5b6bc7c9ef7929a119cb1ba66d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Sep 2016 12:10:12 +0200 Subject: [PATCH 16/37] Uniformize code --- htdocs/core/class/html.formsms.class.php | 36 +++++++++++++++--------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/htdocs/core/class/html.formsms.class.php b/htdocs/core/class/html.formsms.class.php index 35736b56228..b2802f91c09 100644 --- a/htdocs/core/class/html.formsms.class.php +++ b/htdocs/core/class/html.formsms.class.php @@ -85,10 +85,11 @@ class FormSms /** * Show the form to input an sms. * - * @param string $width Width of form + * @param string $morecss Class on first column td + * @param int $showform Show form tags and submit button (recommanded is to use with value 0) * @return void */ - function show_form($width='180px') + function show_form($morecss='titlefield', $showform=1) { global $conf, $langs, $user, $form; @@ -119,13 +120,14 @@ function limitChars(textarea, limit, infodiv) } '; - print "
param["returnurl"]."\">\n"; + if ($showform) print "param["returnurl"]."\">\n"; + print ''; foreach ($this->param as $key=>$value) { print "\n"; } - print "\n"; + print "
\n"; // Substitution array if ($this->withsubstit) @@ -145,8 +147,9 @@ function limitChars(textarea, limit, infodiv) { if ($this->withfromreadonly) { + print '
'.$langs->trans("SmsFrom"); print ''; - print "
".$langs->trans("SmsFrom").""; + print ""; if ($this->fromtype == 'user') { $langs->load("users"); @@ -172,7 +175,7 @@ function limitChars(textarea, limit, infodiv) } else { - print "
".$langs->trans("SmsFrom").""; + print '
'.$langs->trans("SmsFrom").""; //print ''; if ($conf->global->MAIN_SMS_SENDMODE == 'ovh') // For backward compatibility @deprecated { @@ -320,16 +323,21 @@ function limitChars(textarea, limit, infodiv) print "
\n"; - print '
'; - print ''; - if ($this->withcancel) + + if ($showform) { - print '     '; - print ''; + print '
'; + print ''; + if ($this->withcancel) + { + print '     '; + print ''; + } + print '
'; + + print "\n"; } - print '
'; - - print "\n"; + print "\n"; } From a4c3a4588d8cd5e274c2768858b8d174b6639f36 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Sep 2016 14:12:49 +0200 Subject: [PATCH 17/37] FIX link "back to list" was not visible. --- htdocs/comm/card.php | 5 +++-- htdocs/fourn/card.php | 4 +++- htdocs/margin/tabs/thirdpartyMargins.php | 4 +++- htdocs/societe/agenda.php | 4 +++- htdocs/societe/commerciaux.php | 4 +++- htdocs/societe/consumption.php | 4 +++- htdocs/societe/document.php | 4 +++- htdocs/societe/note.php | 4 +++- htdocs/societe/notify/card.php | 4 +++- htdocs/societe/price.php | 4 +++- htdocs/societe/project.php | 4 +++- htdocs/societe/rib.php | 12 +++++++++--- htdocs/societe/societecontact.php | 4 +++- 13 files changed, 45 insertions(+), 16 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 1428857f3dd..f1002bd27f5 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -197,8 +197,9 @@ if ($id > 0) dol_fiche_head($head, 'customer', $langs->trans("ThirdParty"),0,'company'); - - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 71f86cf0fe5..74d19c93a03 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -132,7 +132,9 @@ if ($object->id > 0) dol_fiche_head($head, 'supplier', $langs->trans("ThirdParty"),0,'company'); - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index 1d4d1f8f0ca..4797f0985e0 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -91,7 +91,9 @@ if ($socid > 0) dol_fiche_head($head, 'margin', $langs->trans("ThirdParty"),0,'company'); - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 4547c7d75da..c2ef3f7ad03 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -81,7 +81,9 @@ if ($socid) dol_fiche_head($head, 'agenda', $langs->trans("ThirdParty"),0,'company'); - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/societe/commerciaux.php b/htdocs/societe/commerciaux.php index 08d2bdd7a8b..273ef07bb0e 100644 --- a/htdocs/societe/commerciaux.php +++ b/htdocs/societe/commerciaux.php @@ -114,7 +114,9 @@ if (! empty($socid)) dol_fiche_head($head, 'salesrepresentative', $langs->trans("ThirdParty"),0,'company'); - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index eb912548caa..da3792d0897 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -114,7 +114,9 @@ if (empty($socid)) $head = societe_prepare_head($object); dol_fiche_head($head, 'consumption', $langs->trans("ThirdParty"),0,'company'); -dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); +$linkback = ''.$langs->trans("BackToList").''; + +dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index 4ad8abc9a43..e64c9c49656 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -109,7 +109,9 @@ if ($object->id) $totalsize+=$file['size']; } - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php index 5c9bc15328f..97326f185d1 100644 --- a/htdocs/societe/note.php +++ b/htdocs/societe/note.php @@ -77,7 +77,9 @@ if ($id > 0) print '
'; print ''; - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index b1fd1bb585c..a1f38f0562a 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -155,7 +155,9 @@ if ($result > 0) dol_fiche_head($head, 'notify', $langs->trans("ThirdParty"),0,'company'); - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index 4c988603417..9236fc35f6f 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -151,7 +151,9 @@ $head = societe_prepare_head($object); dol_fiche_head($head, 'price', $langs->trans("ThirdParty"), 0, 'company'); -dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); +$linkback = ''.$langs->trans("BackToList").''; + +dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/societe/project.php b/htdocs/societe/project.php index f99bd517975..fe206dd4cc5 100644 --- a/htdocs/societe/project.php +++ b/htdocs/societe/project.php @@ -81,7 +81,9 @@ if ($socid) dol_fiche_head($head, 'project', $langs->trans("ThirdParty"),0,'company'); - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index 548f81c82dd..39069d1e3f5 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -238,7 +238,9 @@ if ($socid && $action != 'edit' && $action != "create") print $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id."&ribid=".($ribid?$ribid:$id), $langs->trans("DeleteARib"), $langs->trans("ConfirmDeleteRib", $account->getRibLabel()), "confirm_delete", '', 0, 1); } - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); print '
'; @@ -417,7 +419,9 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer) { dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"),0,'company'); - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); print '
'; @@ -514,7 +518,9 @@ if ($socid && $action == 'create' && $user->rights->societe->creer) { dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"),0,'company'); - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); print '
'; diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php index 69298f263e8..4ed1852da80 100644 --- a/htdocs/societe/societecontact.php +++ b/htdocs/societe/societecontact.php @@ -149,7 +149,9 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); print '
'; From d1c4f02bf7d9e333daa2350c0748a2111ef4296b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Sep 2016 13:58:17 +0200 Subject: [PATCH 18/37] Uniformize code and style --- dev/skeletons/skeleton_list.php | 12 +++---- htdocs/categories/index.php | 2 +- htdocs/comm/card.php | 14 ++++---- htdocs/fourn/card.php | 10 +++--- htdocs/langs/en_US/stocks.lang | 1 + htdocs/product/composition/card.php | 5 +-- htdocs/product/note.php | 4 ++- htdocs/product/price.php | 43 ++++++++++++++++++------ htdocs/product/stock/index.php | 2 +- htdocs/product/stock/list.php | 2 +- htdocs/product/stock/productlot_list.php | 30 ++++++++--------- htdocs/product/traduction.php | 5 ++- htdocs/societe/agenda.php | 4 ++- htdocs/theme/eldy/style.css.php | 15 +++++++++ htdocs/theme/md/style.css.php | 3 ++ 15 files changed, 101 insertions(+), 51 deletions(-) diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index 1facee1306e..0ca6962bbef 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -256,11 +256,11 @@ if ($resql) $arrayofselected=is_array($toselect)?$toselect:array(); - $params=''; + $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - if ($search_field1 != '') $params.= '&search_field1='.urlencode($search_field1); - if ($search_field2 != '') $params.= '&search_field2='.urlencode($search_field2); + if ($search_field1 != '') $param.= '&search_field1='.urlencode($search_field1); + if ($search_field2 != '') $param.= '&search_field2='.urlencode($search_field2); if ($optioncss != '') $param.='&optioncss='.$optioncss; // Add $param from extra fields foreach ($search_array_options as $key => $val) @@ -286,7 +286,7 @@ if ($resql) print ''; print ''; - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit); if ($sall) { @@ -319,8 +319,8 @@ if ($resql) // Fields title print ''; // LIST_OF_TD_TITLE_FIELDS - //if (! empty($arrayfields['t.field1']['checked'])) print_liste_field_titre($arrayfields['t.field1']['label'],$_SERVER['PHP_SELF'],'t.field1','',$params,'',$sortfield,$sortorder); - //if (! empty($arrayfields['t.field2']['checked'])) print_liste_field_titre($arrayfields['t.field2']['label'],$_SERVER['PHP_SELF'],'t.field2','',$params,'',$sortfield,$sortorder); + //if (! empty($arrayfields['t.field1']['checked'])) print_liste_field_titre($arrayfields['t.field1']['label'],$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder); + //if (! empty($arrayfields['t.field2']['checked'])) print_liste_field_titre($arrayfields['t.field2']['label'],$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index 07c586e3b11..d44407324c0 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -173,7 +173,7 @@ print ''; print ''; diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 6a24717aea3..5e96d038314 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -520,7 +520,7 @@ if ($id > 0) print '
'.$langs->trans("Categories").''; if (! empty($conf->use_javascript_ajax)) { - print ''; + print ''; } print '
'; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -560,7 +560,7 @@ if ($id > 0) print '
'.$langs->trans("Summary").''.$langs->trans("ShowCustomerPreview").''.$langs->trans("ShowCustomerPreview").'
'.$langs->trans("CurrentOutstandingBill").'
'; print ''; - print ''."\n"; - $i = 0; + $i=0; + $var=true; + $totalarray=array(); while ($i < min($num,$limit)) { $obj = $db->fetch_object($resql); @@ -612,6 +614,7 @@ if ($resql) print $projectstatic->getNomUrl(1); if ($projectstatic->hasDelay()) print img_warning($langs->trans('Late')); print ''; + if (! $i) $totalarray['nbfield']++; } // Title if (! empty($arrayfields['p.title']['checked'])) @@ -619,6 +622,7 @@ if ($resql) print ''; + if (! $i) $totalarray['nbfield']++; } // Company if (! empty($arrayfields['s.nom']['checked'])) @@ -635,6 +639,7 @@ if ($resql) print ' '; } print ''; + if (! $i) $totalarray['nbfield']++; } // Sales Representatives if (! empty($arrayfields['commercial']['checked'])) @@ -676,6 +681,7 @@ if ($resql) print ' '; } print ''; + if (! $i) $totalarray['nbfield']++; } // Date start if (! empty($arrayfields['p.dateo']['checked'])) @@ -683,13 +689,15 @@ if ($resql) print ''; - } + if (! $i) $totalarray['nbfield']++; + } // Date end if (! empty($arrayfields['p.datee']['checked'])) { print ''; + if (! $i) $totalarray['nbfield']++; } // Visibility if (! empty($arrayfields['p.public']['checked'])) @@ -698,31 +706,46 @@ if ($resql) if ($obj->public) print $langs->trans('SharedProject'); else print $langs->trans('PrivateProject'); print ''; + if (! $i) $totalarray['nbfield']++; } // Amount if (! empty($arrayfields['p.opp_amount']['checked'])) { print ''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totaloppfield']=$totalarray['nbfield']; } if (! empty($arrayfields['p.fk_opp_status']['checked'])) { print ''; - } + if (! $i) $totalarray['nbfield']++; + } if (! empty($arrayfields['p.opp_percent']['checked'])) { print ''; - } + if (! $i) $totalarray['nbfield']++; + } if (! empty($arrayfields['p.budget_amount']['checked'])) { print ''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalbudgetfield']=$totalarray['nbfield']; } // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) @@ -740,6 +763,7 @@ if ($resql) print ''; } } + if (! $i) $totalarray['nbfield']++; } // Fields from hook $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); @@ -751,6 +775,7 @@ if ($resql) print ''; + if (! $i) $totalarray['nbfield']++; } // Date modification if (! empty($arrayfields['p.tms']['checked'])) @@ -758,16 +783,26 @@ if ($resql) print ''; + if (! $i) $totalarray['nbfield']++; } // Status if (! empty($arrayfields['p.fk_statut']['checked'])) { $projectstatic->statut = $obj->fk_statut; print ''; + if (! $i) $totalarray['nbfield']++; } - // Action column - print ''; - + // Action column + print ''; + if (! $i) $totalarray['nbfield']++; + print "\n"; } @@ -775,6 +810,27 @@ if ($resql) $i++; } + + // Show total line + if (isset($totalarray['totaloppfield']) || isset($totalarray['totalbudgetfield'])) + { + print ''; + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if ($i == 1) + { + if ($num < $limit) print ''; + else print ''; + } + elseif ($totalarray['totaloppfield'] == $i) print ''; + elseif ($totalarray['totalbudgetfield'] == $i) print ''; + else print ''; + } + print ''; + } + $db->free($resql); $parameters=array('sql' => $sql); diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index f32685f6eeb..bf5a0e66085 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2773,6 +2773,9 @@ tr.liste_titre_topborder td { .liste_titre td a.notasortlink { color: rgb(); } +.liste_titre td a.notasortlink:hover { + background: transparent; +} tr.liste_titre_sel th, th.liste_titre_sel, tr.liste_titre_sel td, td.liste_titre_sel, form.liste_titre_sel div { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index fb0a8d972b2..4c790b20d44 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2638,6 +2638,9 @@ tr.liste_titre_topborder td { .liste_titre td a.notasortlink { color: rgb(); } +.liste_titre td a.notasortlink:hover { + background: transparent; +} div.liste_titre { padding-left: 3px; } From 537c6b0cc7ade297b634b314b7543058b7104a97 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Sep 2016 15:57:53 +0200 Subject: [PATCH 21/37] Uniformize code --- htdocs/compta/bank/index.php | 11 ++++++----- htdocs/projet/list.php | 16 ++++++++-------- htdocs/societe/list.php | 22 +++++++++++----------- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index 444f4a1b55d..0bd855b928a 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -185,6 +185,7 @@ if ($resql) } $db->free($resql); } +else dol_print_error($db); @@ -267,10 +268,10 @@ print ''; if (! empty($arrayfields['b.ref']['checked'])) print_liste_field_titre($arrayfields['b.ref']['label'],$_SERVER["PHP_SELF"],'b.ref','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['accountype']['checked'])) print_liste_field_titre($arrayfields['accountype']['label'],$_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['b.label']['checked'])) print_liste_field_titre($arrayfields['b.label']['label'],$_SERVER["PHP_SELF"],'b.label','',$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['b.number']['checked'])) print_liste_field_titre($arrayfields['b.number']['label'],$_SERVER["PHP_SELF"],'b.number','',$param,'',$sortfield,$sortorder); -print ''; -print ''; -print ''; +if (! empty($arrayfields['b.number']['checked'])) print_liste_field_titre($arrayfields['b.number']['label'],$_SERVER["PHP_SELF"],'b.number','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['toreconcile']['checked'])) print_liste_field_titre($arrayfields['toreconcile']['label'],$_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['b.clos']['checked'])) print_liste_field_titre($arrayfields['b.clos']['label'],$_SERVER["PHP_SELF"],'b.clos','',$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'],$_SERVER["PHP_SELF"],'','',$param,'align="right"',$sortfield,$sortorder); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -367,7 +368,7 @@ if (! empty($arrayfields['b.tms']['checked'])) // Statut if (! empty($arrayfields['b.clos']['checked'])) { - print ''; + print ''; } else { - print ''; } } // Civility - print ''; @@ -120,7 +124,7 @@ if ($id > 0) { include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - print '"; + print '"; } print ""; print "
'; + print ''; print ''; @@ -642,7 +642,7 @@ if ($id > 0) print '
'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPropals").' '.$num.''; print ''; print '
'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPropals").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'; print ''; - print '
'; + print ''; } print ''; - print ''; + print ''; print "\n"; $var=True; diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 807ac8b7ef0..0498c32bf05 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -152,7 +152,7 @@ if ($result) print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"], "e.label","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("LocationSummary"),$_SERVER["PHP_SELF"], "e.lieu","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stockqty",'',$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("EstimatedStockValue"), $_SERVER["PHP_SELF"], "e.valo_pmp",'',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("EstimatedStockValue"), $_SERVER["PHP_SELF"], "estimatedvalue",'',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("EstimatedStockValueSell"), $_SERVER["PHP_SELF"], "",'',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"], "e.statut",'',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'',$param,'',$sortfield,$sortorder,'maxwidthsearch '); diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 4ead8e983fe..2b771a9c9aa 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -277,15 +277,15 @@ if ($resql) $arrayofselected=is_array($toselect)?$toselect:array(); - $params=''; + $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - if ($search_entity != '') $params.= '&search_entity='.urlencode($search_entity); - if ($search_product != '') $params.= '&search_product='.urlencode($search_product); - if ($search_batch != '') $params.= '&search_batch='.urlencode($search_batch); - if ($search_fk_user_creat != '') $params.= '&search_fk_user_creat='.urlencode($search_fk_user_creat); - if ($search_fk_user_modif != '') $params.= '&search_fk_user_modif='.urlencode($search_fk_user_modif); - if ($search_import_key != '') $params.= '&search_import_key='.urlencode($search_import_key); + if ($search_entity != '') $param.= '&search_entity='.urlencode($search_entity); + if ($search_product != '') $param.= '&search_product='.urlencode($search_product); + if ($search_batch != '') $param.= '&search_batch='.urlencode($search_batch); + if ($search_fk_user_creat != '') $param.= '&search_fk_user_creat='.urlencode($search_fk_user_creat); + if ($search_fk_user_modif != '') $param.= '&search_fk_user_modif='.urlencode($search_fk_user_modif); + if ($search_import_key != '') $param.= '&search_import_key='.urlencode($search_import_key); if ($optioncss != '') $param.='&optioncss='.$optioncss; // Add $param from extra fields foreach ($search_array_options as $key => $val) @@ -311,7 +311,7 @@ if ($resql) print ''; print ''; - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit); if ($sall) { @@ -343,14 +343,14 @@ if ($resql) // Fields title print ''; - if (! empty($arrayfields['t.entity']['checked'])) print_liste_field_titre($arrayfields['t.entity']['label'],$_SERVER['PHP_SELF'],'t.entity','',$params,'',$sortfield,$sortorder); - if (! empty($arrayfields['t.batch']['checked'])) print_liste_field_titre($arrayfields['t.batch']['label'],$_SERVER['PHP_SELF'],'t.batch','',$params,'',$sortfield,$sortorder); + if (! empty($arrayfields['t.entity']['checked'])) print_liste_field_titre($arrayfields['t.entity']['label'],$_SERVER['PHP_SELF'],'t.entity','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['t.batch']['checked'])) print_liste_field_titre($arrayfields['t.batch']['label'],$_SERVER['PHP_SELF'],'t.batch','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['t.fk_product']['checked'])) print_liste_field_titre($arrayfields['t.fk_product']['label'],$_SERVER['PHP_SELF'],'t.fk_product','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['t.eatby']['checked'])) print_liste_field_titre($arrayfields['t.eatby']['label'],$_SERVER['PHP_SELF'],'t.eatby','',$params,'',$sortfield,$sortorder); - if (! empty($arrayfields['t.sellby']['checked'])) print_liste_field_titre($arrayfields['t.sellby']['label'],$_SERVER['PHP_SELF'],'t.sellby','',$params,'',$sortfield,$sortorder); - if (! empty($arrayfields['t.fk_user_creat']['checked'])) print_liste_field_titre($arrayfields['t.fk_user_creat']['label'],$_SERVER['PHP_SELF'],'t.fk_user_creat','',$params,'',$sortfield,$sortorder); - if (! empty($arrayfields['t.fk_user_modif']['checked'])) print_liste_field_titre($arrayfields['t.fk_user_modif']['label'],$_SERVER['PHP_SELF'],'t.fk_user_modif','',$params,'',$sortfield,$sortorder); - if (! empty($arrayfields['t.import_key']['checked'])) print_liste_field_titre($arrayfields['t.import_key']['label'],$_SERVER['PHP_SELF'],'t.import_key','',$params,'',$sortfield,$sortorder); + if (! empty($arrayfields['t.eatby']['checked'])) print_liste_field_titre($arrayfields['t.eatby']['label'],$_SERVER['PHP_SELF'],'t.eatby','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['t.sellby']['checked'])) print_liste_field_titre($arrayfields['t.sellby']['label'],$_SERVER['PHP_SELF'],'t.sellby','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['t.fk_user_creat']['checked'])) print_liste_field_titre($arrayfields['t.fk_user_creat']['label'],$_SERVER['PHP_SELF'],'t.fk_user_creat','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['t.fk_user_modif']['checked'])) print_liste_field_titre($arrayfields['t.fk_user_modif']['label'],$_SERVER['PHP_SELF'],'t.fk_user_modif','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['t.import_key']['checked'])) print_liste_field_titre($arrayfields['t.import_key']['label'],$_SERVER['PHP_SELF'],'t.import_key','',$param,'',$sortfield,$sortorder); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index 15174f82fb4..b609e96661a 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -246,6 +246,9 @@ else dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); + print '
'; + + $cnt_trans = 0; if (! empty($object->multilangs)) { @@ -253,8 +256,8 @@ else { $cnt_trans++; $s=picto_from_langcode($key); - print "
".($s?$s.' ':'')." ".$langs->trans('Language_'.$key).": ".''.img_delete('', '')."
"; print '
'.$langs->trans("LastCustomerOrders",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' '.$num.''; print ''; //if($num2 > 0) print ''; //else print ''; @@ -711,7 +711,7 @@ if ($id > 0) print '
'.$langs->trans("LastCustomerOrders",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').''.img_picto($langs->trans("CreateInvoiceForThisCustomer"),'object_bill').''.img_picto($langs->trans("NoOrdersToInvoice"),'object_bill').'
'; print ''; - print ''; print ''; } $i = 0; @@ -831,7 +831,7 @@ if ($id > 0) print '
'; + print ''; print ''; @@ -770,7 +770,7 @@ if ($id > 0) print ''; print ''; + print '
'.$langs->trans("LastSendings",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllSendings").' '.$num.''; print ''; print '
'.$langs->trans("LastSendings",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllSendings").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'; - print '
'.$langs->trans("LastContracts",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllContracts").' '.$num.'
'.$langs->trans("AllContracts").' '.$num.'
'; print ''; - print ''; + print ''; print ''; $var=!$var; } @@ -896,7 +896,7 @@ if ($id > 0) print '
'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllInterventions").' '.$num.'
'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllInterventions").' '.$num.'
'; print ''; - print ''; print ''; print '
'; + print ''; print ''; diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 45d96d909a5..39f0009fbf4 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -284,7 +284,7 @@ if ($object->id > 0) print '
'.$langs->trans("LastCustomersBills",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllBills").' '.$num.''; print ''; print '
'.$langs->trans("LastCustomersBills",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllBills").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'; print ''; print ''; + print '
'; - print '
'.$langs->trans("Summary").''.$langs->trans("ShowSupplierPreview").'
'.$langs->trans("ShowSupplierPreview").'
'; print '
'; @@ -299,7 +299,7 @@ if ($object->id > 0) print ''; print ''; print ''; //Query from product/liste.php @@ -389,7 +389,7 @@ if ($object->id > 0) print ''; print ''; @@ -494,7 +494,7 @@ if ($object->id > 0) print ''; print ''; @@ -568,7 +568,7 @@ if ($object->id > 0) print ''; print ''; diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index baf8fcde0db..681c1da3898 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -135,3 +135,4 @@ OpenInternal=Open for internal actions OpenShipping=Open for shippings OpenDispatch=Open for dispatch UseDispatchStatus=Use dispatch status (aprouve/refuse) +OptionMULTIPRICESIsOn=Option "several prices per segment" is on. It means a product has several selling price so value for sell can't be calculated diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index ef9c34f32ee..e1644c241e5 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -207,7 +207,7 @@ if ($id > 0 || ! empty($ref)) dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); - print '
'.$langs->trans("ProductsAndServices").''; - print ''.$langs->trans("All").' '.$object->nbOfProductRefs().''; + print ''.$langs->trans("All").' '.$object->nbOfProductRefs().''; print '
'; print ''; - print ''; + print ''; print ''; print '
'.$langs->trans("LastSupplierProposals",($num<$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPriceRequests").' '.$num.''.$langs->trans("AllPriceRequests").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'; print '
'; print ''; - print ''; + print ''; print ''; print '
'.$langs->trans("LastSupplierOrders",($num<$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' '.$num.''.$langs->trans("AllOrders").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'; print '
'; - print ''; + print '
'.$langs->trans('LastSuppliersBills',($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans('AllBills').' '.$num.'
'; print ''; print '
'.$langs->trans('LastSuppliersBills',($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans('AllBills').' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'; print '
'; + print '
'; // Nature if($object->type!=Product::TYPE_SERVICE) @@ -248,7 +248,8 @@ if ($id > 0 || ! empty($ref)) dol_fiche_end(); - + print '
'; + $prodsfather = $object->getFather(); // Parent Products $object->get_sousproduits_arbo(); // Load $object->sousprods $prods_arbo=$object->get_arbo_each_prod(); diff --git a/htdocs/product/note.php b/htdocs/product/note.php index f771a9831c1..b3f2fa1c01c 100644 --- a/htdocs/product/note.php +++ b/htdocs/product/note.php @@ -104,7 +104,9 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; - $cssclass='titlefield'; + $cssclass='titlefield'; + if ($action == 'editnote') $cssclass='titlefieldcreate'; + if ($action == 'editnote_private') $cssclass='titlefieldcreate'; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 881fa0b95f8..4e04a4c626a 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -719,7 +719,9 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility { // We show only vat for level 1 - print '
'; + print ''; + print ''; + print ''; } else { @@ -732,15 +734,26 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) else print vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true); print ''; } - - print '
' . $langs->trans("VATRate") . '' . vatrate($object->multiprices_tva_tx[1], true) . '
' . $langs->trans("VATRate") . '' . vatrate($object->multiprices_tva_tx[1], true) . '
'; + print '
'; + + print '
'; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + $var=True; + for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { - print ''; + $var = ! $var; + + print ''; // Label of price print ''; // Price by quantity - if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) + if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) // TODO Fix the form included into a tr instead of a td { print ''; print ''; print ''; - foreach ($object->prices_by_qty_list[$i] as $ii => $prices) { + foreach ($object->prices_by_qty_list[$i] as $ii => $prices) + { if ($action == 'edit_price_by_qty' && $rowid == $prices['rowid'] && ($user->rights->produit->creer || $user->rights->service->creer)) { print ''; print ''; @@ -892,7 +906,7 @@ else print ''; // Price by quantity - if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) + if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) // TODO Fix the form inside tr instead of td { print ''; print ''; + + $var = false; for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) { $var = !$var; @@ -1286,7 +1302,9 @@ if ($action == 'edit_price' && $object->getRights()->creer) } } + // List of price changes -log historic (ordered by descending date) + if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_price') && ! in_array($action, array('edit_price','edit_vat'))) { $sql = "SELECT p.rowid, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.recuperableonly,"; @@ -1320,9 +1338,12 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_ if ($num > 0) { + // Default prices or + // Log of previous customer prices $backbutton='' . $langs->trans("Back") . ''; if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print_barre_liste($langs->trans("DefaultPrice"),'','','','','',$backbutton, 0, 0, 'title_accountancy.png'); + else print_barre_liste($langs->trans("PriceByCustomerLog"),'','','','','','', 0, 0, 'title_accountancy.png'); print '
'; print $langs->trans("PriceLevel"); if ($user->admin) print ' id.'">'.img_edit($langs->trans('EditSellingPriceLabel'),0).''; - print ''.$langs->trans("SellingPrice").''.$langs->trans("MinPrice").'
'.$langs->trans("SellingPrice").''.$langs->trans("MinPrice").'
'; @@ -789,7 +802,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) print '
' . $langs->trans("PriceByQuantity") . ' ' . $i; print ''; @@ -804,7 +817,8 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) print '' . $langs->trans("Discount") . ' 
' . $langs->trans("PriceByQuantity"); if ($object->prices_by_qty [0] == 0) { @@ -1219,6 +1233,8 @@ if ($action == 'edit_price' && $object->getRights()->creer) print '
'; @@ -1359,7 +1380,7 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_ { $objp = $db->fetch_object($result); $var = ! $var; - print ''; + print ''; // Date print ""; @@ -1424,8 +1445,9 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_ } print "\n"; - $i ++; + $i++; } + $db->free($result); print "
" . dol_print_date($db->jdate($objp->dp), "dayhour") . "
"; print "
"; @@ -1796,6 +1818,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) if (count($prodcustprice->lines) > 0) { + $var = false; foreach ($prodcustprice->lines as $line) { $var = ! $var; diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php index 158da034d2f..5f075370df6 100644 --- a/htdocs/product/stock/index.php +++ b/htdocs/product/stock/index.php @@ -140,7 +140,7 @@ if ($resql) print '
'.$langs->trans("SellByDate").''.$langs->trans("Warehouse").''.$langs->trans("FullList").''.$langs->trans("FullList").'
'; + print ''; print ''; print ''; if (! empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 7dd3751ad64..d733c6192e5 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -116,7 +116,9 @@ if ($socid) print '
'; - $object->info($socid); + print '
'; + + $object->info($socid); print dol_print_object_info($object, 1); print ''; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index b014776e15f..f32685f6eeb 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -101,6 +101,7 @@ $usegradienttop=(isset($conf->global->THEME_ELDY_TOPMENU_BACK1)?0:1); $usegradienttitle=(isset($conf->global->THEME_ELDY_BACKTITLE1)?0:1); $useboldtitle=(isset($conf->global->THEME_ELDY_USEBOLDTITLE)?$conf->global->THEME_ELDY_USEBOLDTITLE:1); $borderwith=2; +$noborderline=1; // Case of option always editable if (! isset($conf->global->THEME_ELDY_BACKBODY)) $conf->global->THEME_ELDY_BACKBODY=$colorbackbody; @@ -2289,7 +2290,9 @@ tr.nocellnopadd td.nobordernopadding, tr.nocellnopadd td.nocellnopadd table.border, table.dataTable, .table-border, .table-border-col, .table-key-border-col, .table-val-border-col, div.border { + border: 1px solid #E0E0E0; + border-collapse: collapse !important; padding: 1px 2px 1px 3px; /* t r b l */ } @@ -2312,8 +2315,16 @@ div .tdtop { } table.border td, div.border div div.tagtd { + padding: 2px 2px 2px 2px; border: 1px solid #E0E0E0; + + padding: 3px 2px 3px 2px; + border-bottom: 1px solid #E0E0E0; + + padding: 3px 2px 3px 2px; + /* border: 1px solid #E0E0E0; */ + border-collapse: collapse; } @@ -2759,6 +2770,10 @@ tr.liste_titre_topborder td { text-shadow: none !important; color: rgb(); } +.liste_titre td a.notasortlink { + color: rgb(); +} + tr.liste_titre_sel th, th.liste_titre_sel, tr.liste_titre_sel td, td.liste_titre_sel, form.liste_titre_sel div { font-family: ; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 5591edd7a80..fb0a8d972b2 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2635,6 +2635,9 @@ tr.liste_titre_topborder td { text-shadow: none !important; color: rgb(); } +.liste_titre td a.notasortlink { + color: rgb(); +} div.liste_titre { padding-left: 3px; } From 7e24f449d2c254013c33e9eec263796021fbff21 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Sep 2016 15:36:38 +0200 Subject: [PATCH 19/37] Can filter on project category on project list --- htdocs/projet/list.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 04edadda890..8b466d655b3 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -63,6 +63,7 @@ $pageprev = $page - 1; $pagenext = $page + 1; $search_all=GETPOST("search_all"); +$search_categ=GETPOST("search_categ",'alpha'); $search_ref=GETPOST("search_ref"); $search_label=GETPOST("search_label"); $search_societe=GETPOST("search_societe"); @@ -147,6 +148,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $search_all=''; + $search_categ=''; $search_ref=""; $search_label=""; $search_societe=""; @@ -204,11 +206,14 @@ if ($resql) else dol_print_error($db); if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0]='0'; // To avoid sql syntax error if not found + $distinct='DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once. $sql = "SELECT ".$distinct." p.rowid as projectid, p.ref, p.title, p.fk_statut, p.fk_opp_status, p.public, p.fk_user_creat"; $sql.= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount"; $sql.= ", s.nom as name, s.rowid as socid"; $sql.= ", cls.code as opp_status_code"; +// We'll need these fields in order to filter by categ +if ($search_categ) $sql .= ", cs.fk_categorie, cs.fk_project"; // Add fields for extrafields foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; // Add fields from hooks @@ -219,6 +224,8 @@ $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_extrafields as ef on (p.rowid = ef.fk_object)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls on p.fk_opp_status = cls.rowid"; +// We'll need this table joined to the select in order to filter by categ +if (! empty($search_categ)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_project as cs ON p.rowid = cs.fk_project"; // We'll need this table joined to the select in order to filter by categ // We'll need this table joined to the select in order to filter by sale if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; if ($search_user > 0) @@ -229,6 +236,8 @@ $sql.= " WHERE p.entity IN (".getEntity('project',1).')'; if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; +if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ); +if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL"; if ($search_ref) $sql .= natural_search('p.ref', $search_ref); if ($search_label) $sql .= natural_search('p.title', $search_label); if ($search_societe) $sql .= natural_search('s.nom', $search_societe); @@ -372,6 +381,8 @@ if ($resql) print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); } + $moreforfilter=''; + // If the user can view thirdparties other than his' if ($user->rights->societe->client->voir || $socid) { @@ -390,6 +401,16 @@ if ($resql) $moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300'); $moreforfilter.=''; + // Filter on categories + if (! empty($conf->categorie->enabled)) + { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $moreforfilter.='
'; + $moreforfilter.=$langs->trans('Categories'). ': '; + $moreforfilter.=$formother->select_categories('project',$search_categ,'search_categ',1); + $moreforfilter.='
'; + } + if (! empty($moreforfilter)) { print '
'; From 13c3db08e74df0430b92960b946b6c09dc32f161 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Sep 2016 15:48:29 +0200 Subject: [PATCH 20/37] Uniformize code and look and feel --- htdocs/compta/bank/index.php | 472 ++++++++++++++++++++++---------- htdocs/projet/list.php | 94 +++++-- htdocs/theme/eldy/style.css.php | 3 + htdocs/theme/md/style.css.php | 3 + 4 files changed, 412 insertions(+), 160 deletions(-) diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index a5038fc2e78..444f4a1b55d 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -33,14 +33,93 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->load("banks"); $langs->load("categories"); +$action=GETPOST('action','alpha'); +$massaction=GETPOST('massaction','alpha'); +$show_files=GETPOST('show_files','int'); +$confirm=GETPOST('confirm','alpha'); +$toselect = GETPOST('toselect', 'array'); + +$statut=GETPOST('statut')?GETPOST('statut', 'alpha'):'opened'; // 'all' or ''='opened' +$optioncss = GETPOST('optioncss','alpha'); + // Security check if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'banque'); -$statut=GETPOST('statut'); +$diroutputmassaction=$conf->banque->dir_output . '/temp/massgeneration/'.$user->id; + +$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); +$page = GETPOST("page",'int'); +if ($page == -1) { $page = 0; } +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortfield) $sortfield='b.label'; +if (! $sortorder) $sortorder='ASC'; + +// Initialize technical object to manage context to save list fields +$contextpage='bankaccountlist'; + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array($contextpage)); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('bankaccount'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); + +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 'b.ref'=>'Ref', + 'b.label'=>'Label', +); + +$checkedtypetiers=0; +$arrayfields=array( + 'b.ref'=>array('label'=>$langs->trans("BankAccounts"), 'checked'=>1), + 'accountype'=>array('label'=>$langs->trans("AccountType"), 'checked'=>1), + 'b.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), + 'b.number'=>array('label'=>$langs->trans("AccountIdShort"), 'checked'=>1), + 'toreconcile'=>array('label'=>$langs->trans("TransactionsToConciliate"), 'checked'=>1), + 'b.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + 'b.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), + 'b.clos'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), + 'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1010), +); +// Extra fields +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) +{ + foreach($extrafields->attribute_label as $key => $val) + { + $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]); + } +} +/* + * Actions + */ +if (GETPOST('cancel')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } + +$parameters=array('socid'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + +// Purge search criteria +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers +{ + $statut = 'all'; + +} + + + /* * View */ @@ -50,11 +129,48 @@ $title=$langs->trans('BankAccounts'); // Load array of financial accounts (opened by default) $accounts = array(); -$sql = "SELECT rowid, courant, rappro"; -$sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; +$sql = "SELECT rowid, label, courant, rappro"; +// Add fields from extrafields +foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as b"; +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bankcacount_extrafields as ef on (c.rowid = ef.fk_object)"; $sql.= " WHERE entity IN (".getEntity('bank_account', 1).")"; -if ($statut != 'all') $sql.= " AND clos = 0"; -$sql.= $db->order('label', 'ASC'); +if ($statut == 'opened') $sql.= " AND clos = 0"; +if ($statut == 'closed') $sql.= " AND clos = 1"; + +// Add where from extra fields +foreach ($search_array_options as $key => $val) +{ + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $typ=$extrafields->attribute_type[$tmpkey]; + $mode=0; + if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric + if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) + { + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + } +} +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; + +$sql.= $db->order($sortfield,$sortorder); + +// Count total nb of records +$nbtotalofrecords = 0; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + +$sql.= $db->plimit($limit + 1,$offset); $resql = $db->query($sql); if ($resql) @@ -70,38 +186,212 @@ if ($resql) $db->free($resql); } -$nbtotalofrecords = $num; $help_url='EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas'; llxHeader('',$title,$help_url); $link=''; -if ($statut == '') $link=''.$langs->trans("IncludeClosedAccount").''; -if ($statut == 'all') $link=''.$langs->trans("OnlyOpenedAccount").''; - -print_barre_liste($title,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$link,$num,$nbtotalofrecords,'title_bank.png',0,'','',$limit, 1); +$num_rows = count($accounts); -/* - * Comptes courants (courant = 1) - */ -print '
'.($s?$s.' ':'')." ".$langs->trans('Language_'.$key).": ".''.img_delete('', '').'
'.$langs->trans('Label').''.$object->multilangs[$key]["label"].'
'.$langs->trans('Description').''.$object->multilangs[$key]["description"].'
'; -print ''; -print ''; -print ''; +$arrayofselected=is_array($toselect)?$toselect:array(); + +$param=''; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; +if ($statut != '') $param.='&statut='.$statut; +if ($show_files) $param.='&show_files=' .$show_files; +if ($optioncss != '') $param.='&optioncss='.$optioncss; +// Add $param from extra fields +foreach ($search_array_options as $key => $val) +{ + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); +} + +// List of mass actions available +$arrayofmassactions = array( +// 'presend'=>$langs->trans("SendByMail"), +// 'builddoc'=>$langs->trans("PDFMerge"), +); +if ($user->rights->banque->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); +if ($massaction == 'presend') $arrayofmassactions=array(); +$massactionbutton=$form->selectMassAction('', $arrayofmassactions); + + +// Lines of title fields +print ''; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +print_barre_liste($title,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_bank.png',0,'','',$limit, 1); + + +if ($sall) +{ + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); +} + +$moreforfilter=''; + + +// Bank accounts +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook +if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; +else $moreforfilter = $hookmanager->resPrint; + +if (! empty($moreforfilter)) +{ + print '
'; + print $moreforfilter; + print '
'; +} + +$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; +//$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + +print '
'.$langs->trans("CurrentAccounts").''.$langs->trans("Bank").''.$langs->trans("AccountIdShort").'
'."\n"; + +// Fields title +print ''; +if (! empty($arrayfields['b.ref']['checked'])) print_liste_field_titre($arrayfields['b.ref']['label'],$_SERVER["PHP_SELF"],'b.ref','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['accountype']['checked'])) print_liste_field_titre($arrayfields['accountype']['label'],$_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['b.label']['checked'])) print_liste_field_titre($arrayfields['b.label']['label'],$_SERVER["PHP_SELF"],'b.label','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['b.number']['checked'])) print_liste_field_titre($arrayfields['b.number']['label'],$_SERVER["PHP_SELF"],'b.number','',$param,'',$sortfield,$sortorder); print ''; print ''; print ''; +// Extra fields +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) +{ + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + } + } +} +// Hook fields +$parameters=array('arrayfields'=>$arrayfields); +$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; + +print ''; +// Ref +if (! empty($arrayfields['b.ref']['checked'])) +{ + print ''; +} +// Account type +if (! empty($arrayfields['accountype']['checked'])) +{ + print ''; +} +// Ref +if (! empty($arrayfields['b.label']['checked'])) +{ + print ''; +} +// Number +if (! empty($arrayfields['b.number']['checked'])) +{ + print ''; +} +// Transactions to reconcile +if (! empty($arrayfields['toreconcile']['checked'])) +{ + print ''; +} +// Extra fields +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) +{ + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + $typeofextrafield=$extrafields->attribute_type[$key]; + print ''; + } + } +} +// Fields from hook +$parameters=array('arrayfields'=>$arrayfields); +$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +// Date creation +if (! empty($arrayfields['b.datec']['checked'])) +{ + print ''; +} +// Date modification +if (! empty($arrayfields['b.tms']['checked'])) +{ + print ''; +} +// Statut +if (! empty($arrayfields['b.clos']['checked'])) +{ + print ''; +} +// Balance +print ''; +// Action column +print ''; +print ''; + + + $total = array(); $found = 0; $var=true; foreach ($accounts as $key=>$type) { - if ($type == 1) - { + //if ($type == 1) + //{ $found++; $acc = new Account($db); @@ -110,8 +400,16 @@ foreach ($accounts as $key=>$type) $var = !$var; $solde = $acc->solde(1); + + + + print ''; print ''; + print ''; print ''; print ''; print ''; - print ''; - - $total[$acc->currency_code] += $solde; - } -} -if (! $found) print ''; -// Total -foreach ($total as $key=>$solde) -{ - print ''; -} - -print '
'.$langs->trans("TransactionsToConciliate").''.$langs->trans("Status").''.$langs->trans("BankBalance").'
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select'))) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $searchclass=''; + if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring'; + if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; + print ''; + } + print ''; + print ''; + print ''; + $array=array( + 'opened'=>$langs->trans("Opened"), + 'closed'=>$langs->trans("Closed") + ); + print $form->selectarray("statut", $array, $statut, 1); + print ''; +$searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); +print $searchpitco; +print '
'.$acc->getNomUrl(1).''; + print $langs->trans("CashAccounts"); + print $acc->type_lib[$acc->type]; + print ''.$acc->bank.''.$acc->number.''; @@ -131,143 +429,35 @@ foreach ($accounts as $key=>$type) print ''; print ''.price($solde, 0, $langs, 0, 0, -1, $acc->currency_code).''; print '
'.$langs->trans("None").'
'.$langs->trans("Total").' '.$key.''.price($solde, 0, $langs, 0, 0, -1, $key).'
'; -print '
'; - -/* - * Comptes caisse/liquide (courant = 2) - */ -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; - -$total = array(); $found = 0; -$var=true; -foreach ($accounts as $key=>$type) -{ - if ($type == 2) - { - $found++; - - $acc = new Account($db); - $acc->fetch($key); - - $var = !$var; - $solde = $acc->solde(1); - - print ""; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $total[$acc->currency_code] += $solde; - } -} -if (! $found) -{ - $var = !$var; - print ''; -} -// Total -foreach ($total as $key=>$solde) -{ - print ''; -} - -print '
'.$langs->trans("CashAccounts").'   '.$langs->trans("Status").''.$langs->trans("BankBalance").'
'.$acc->getNomUrl(1).''.$acc->bank.'  '.$acc->getLibStatut(2).''; - print ''.price($solde, 0, $langs, 0, 0, -1, $acc->currency_code).''; - print '
'.$langs->trans("None").'
'.$langs->trans("Total").' '.$key.''.price($solde, 0, $langs, 0, 0, -1, $key).'
'; -print '
'; - -/* - * Comptes placements (courant = 0) - */ -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; - -$total = array(); $found = 0; -$var=true; -foreach ($accounts as $key=>$type) -{ - if ($type == 0) - { - $found++; - - $acc = new Account($db); - $acc->fetch($key); - - $var = !$var; - $solde = $acc->solde(1); - - print ""; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + if (! $i) $totalarray['nbfield']++; + print ''; $total[$acc->currency_code] += $solde; - } -} -if (! $found) -{ - $var = !$var; - print ''; + //} } +if (! $found) print ''; // Total foreach ($total as $key=>$solde) { - print ''; + print ''; } -print "
'.$langs->trans("SavingAccounts").''.$langs->trans("Bank").''.$langs->trans("Numero").''.$langs->trans("TransactionsToConciliate").''.$langs->trans("Status").''.$langs->trans("BankBalance").'
'.$acc->getNomUrl(1).''.$acc->bank.''.$acc->number.''; - if ($acc->rappro) + + // Action column + print ''; + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { - $result=$acc->load_board($user,$acc->id); - if ($result<0) { - setEventMessages($acc->error, $acc->errors, 'errors'); - } else { - print $result->nbtodo; - if ($result->nbtodolate) print ' ('.$result->nbtodolate.img_warning($langs->trans("Late")).')'; - } + $selected=0; + if (in_array($obj->rowid, $arrayofselected)) $selected=1; + print ''; } - else print $langs->trans("FeatureDisabled"); - print ''.$acc->getLibStatut(2).''; - print ''.price($solde, 0, $langs, 0, 0, -1, $acc->currency_code).''; print '
'.$langs->trans("None").'
'.$langs->trans("None").'
'.$langs->trans("Total").' '.$key.''.price($solde, 0, $langs, 0, 0, -1, $key).'
'.$langs->trans("Total").' '.$key.''.price($solde, 0, $langs, 0, 0, -1, $key).'
"; +print '
'; /* - * Boutons d'actions + * Buttons actions */ print '
'."\n"; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 8b466d655b3..a2384158926 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -383,16 +383,6 @@ if ($resql) $moreforfilter=''; - // If the user can view thirdparties other than his' - if ($user->rights->societe->client->voir || $socid) - { - $langs->load("commercial"); - $moreforfilter.='
'; - $moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': '; - $moreforfilter.=$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth300'); - $moreforfilter.='
'; - } - // If the user can view user other than himself $moreforfilter.='
'; $moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': '; @@ -411,6 +401,16 @@ if ($resql) $moreforfilter.='
'; } + // If the user can view thirdparties other than his' + if ($user->rights->societe->client->voir || $socid) + { + $langs->load("commercial"); + $moreforfilter.='
'; + $moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': '; + $moreforfilter.=$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth300'); + $moreforfilter.='
'; + } + if (! empty($moreforfilter)) { print '
'; @@ -586,7 +586,9 @@ if ($resql) print '
'; print dol_trunc($obj->title,80); print ''; print dol_print_date($db->jdate($obj->date_start),'day'); print ''; print dol_print_date($db->jdate($obj->date_end),'day'); print ''; - if ($obj->opp_status_code) print price($obj->opp_amount, 1, '', 1, -1, -1, ''); + if ($obj->opp_status_code) + { + print price($obj->opp_amount, 1, '', 1, -1, -1, ''); + $totalarray['totalopp'] += $obj->opp_amount; + } print ''; if ($obj->opp_status_code) print $langs->trans("OppStatusShort".$obj->opp_status_code); print ''; if ($obj->opp_percent) print price($obj->opp_percent, 1, '', 1, 0).'%'; print ''; - if ($obj->budget_amount != '') print price($obj->budget_amount, 1, '', 1, -1, -1); + if ($obj->budget_amount != '') + { + print price($obj->budget_amount, 1, '', 1, -1, -1); + $totalarray['totalbudget'] += $obj->budget_amount; + } print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour'); print ''.$projectstatic->getLibStatut(5).''; + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + { + $selected=0; + if (in_array($obj->rowid, $arrayofselected)) $selected=1; + print ''; + } + print '
'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price($totalarray['totalopp']).''.price($totalarray['totalbudget']).'
'.$langs->trans("TransactionsToConciliate").''.$langs->trans("Status").''.$langs->trans("BankBalance").''; + print ''; $array=array( 'opened'=>$langs->trans("Opened"), 'closed'=>$langs->trans("Closed") diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index a2384158926..6bf03741732 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -383,14 +383,6 @@ if ($resql) $moreforfilter=''; - // If the user can view user other than himself - $moreforfilter.='
'; - $moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': '; - $includeonly=''; - if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); - $moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300'); - $moreforfilter.='
'; - // Filter on categories if (! empty($conf->categorie->enabled)) { @@ -401,6 +393,14 @@ if ($resql) $moreforfilter.=''; } + // If the user can view user other than himself + $moreforfilter.='
'; + $moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': '; + $includeonly=''; + if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); + $moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300'); + $moreforfilter.='
'; + // If the user can view thirdparties other than his' if ($user->rights->societe->client->voir || $socid) { diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 75d28bf41a4..f466263acdc 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -537,6 +537,17 @@ if ($type == 'c' || $type == 'p') $moreforfilter.=''; } } +if ($type == 'f') +{ + if (! empty($conf->categorie->enabled)) + { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $moreforfilter.='
'; + $moreforfilter.=$langs->trans('Categories'). ': '; + $moreforfilter.=$formother->select_categories('supplier',$search_categ,'search_categ',1); + $moreforfilter.='
'; + } +} // If the user can view prospects other than his' if ($user->rights->societe->client->voir || $socid) @@ -546,17 +557,6 @@ if ($user->rights->societe->client->voir || $socid) $moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user, 0, 1, 'maxwidth300'); $moreforfilter.=''; } -if ($type == 'f') -{ - if (! empty($conf->categorie->enabled)) - { - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; - $moreforfilter.='
'; - $moreforfilter.=$langs->trans('Categories'). ': '; - $moreforfilter.=$formother->select_categories('supplier',$search_categ,'search_categ',1); - $moreforfilter.='
'; - } -} if (! empty($moreforfilter)) { print '
'; From 46ce1d3a6983c5d166ef55776e93baaad18156e6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Sep 2016 16:11:30 +0200 Subject: [PATCH 22/37] Uniformize code --- htdocs/contact/note.php | 19 +++++++++++-------- htdocs/core/tpl/notes.tpl.php | 14 +++++++------- htdocs/societe/agenda.php | 5 ++--- htdocs/societe/note.php | 17 ++++++++++------- htdocs/societe/notify/card.php | 8 ++++---- 5 files changed, 34 insertions(+), 29 deletions(-) diff --git a/htdocs/contact/note.php b/htdocs/contact/note.php index 761efcfa840..17c718cfb42 100644 --- a/htdocs/contact/note.php +++ b/htdocs/contact/note.php @@ -83,6 +83,10 @@ if ($id > 0) $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', ''); + $cssclass='titlefield'; + //if ($action == 'editnote_public') $cssclass='titlefieldcreate'; + //if ($action == 'editnote_private') $cssclass='titlefieldcreate'; + print '
'; print '
'; @@ -98,19 +102,19 @@ if ($id > 0) $objsoc = new Societe($db); $objsoc->fetch($object->socid); - print '
'.$langs->trans("ThirdParty").''.$objsoc->getNomUrl(1).'
'.$langs->trans("ThirdParty").''.$objsoc->getNomUrl(1).'
'.$langs->trans("ThirdParty").''; + print '
'.$langs->trans("ThirdParty").''; print $langs->trans("ContactNotLinkedToCompany"); print '
'.$langs->trans("UserTitle").''; + print '
'.$langs->trans("UserTitle").''; print $object->getCivilityLabel(); print '
'.$langs->trans("DateToBirth").''.dol_print_date($object->birthday,"day"); + print ''.$langs->trans("DateToBirth").''.dol_print_date($object->birthday,"day"); print '   '; //var_dump($birthdatearray); @@ -138,17 +142,16 @@ if ($id > 0) } else { - print ''.$langs->trans("DateToBirth").''.$langs->trans("Unknown")."'.$langs->trans("DateToBirth").''.$langs->trans("Unknown")."
"; - print '
'; + //print '
'; - print '
'; + //print '
'; - $cssclass='titlefield'; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index 901756f9bfb..bc7cf44ce66 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -69,17 +69,17 @@ else $typeofdata='textarea:12:100'; ?> -
+
-
-
>editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam); ?>
-
editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, '', null, null, $moreparam); ?>
+
+
>editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam); ?>
+
editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, '', null, null, $moreparam); ?>
societe_id)) { ?> -
-
>editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam); ?>
-
editfieldval("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, '', null, null, $moreparam); ?>
+
+
>editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam); ?>
+
editfieldval("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, '', null, null, $moreparam); ?>
diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index d733c6192e5..7d68e067265 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -113,10 +113,9 @@ if ($socid) print ''; - - print '
'; + //print '
'; - print '
'; + //print '
'; $object->info($socid); print dol_print_object_info($object, 1); diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php index 5c9bc15328f..ac441f52938 100644 --- a/htdocs/societe/note.php +++ b/htdocs/societe/note.php @@ -78,7 +78,11 @@ if ($id > 0) print ''; dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); - + + $cssclass='titlefield'; + //if ($action == 'editnote_public') $cssclass='titlefieldcreate'; + //if ($action == 'editnote_private') $cssclass='titlefieldcreate'; + print '
'; print '
'; @@ -86,12 +90,12 @@ if ($id > 0) if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { - print ''.$langs->trans('Prefix').''.$object->prefix_comm.''; + print ''.$langs->trans('Prefix').''.$object->prefix_comm.''; } if ($object->client) { - print ''; + print ''; print $langs->trans('CustomerCode').''; print $object->code_client; if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; @@ -100,7 +104,7 @@ if ($id > 0) if ($object->fournisseur) { - print ''; + print ''; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; @@ -111,10 +115,9 @@ if ($id > 0) print '
'; - print '
'; + //print '
'; - //$colwidth='25'; - $cssclass='titlefield'; + //print '
'; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index 39a0ee2371b..b3617a12b27 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -165,12 +165,12 @@ if ($result > 0) // Prefix if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { - print ''.$langs->trans('Prefix').''.$object->prefix_comm.''; + print ''.$langs->trans('Prefix').''.$object->prefix_comm.''; } if ($object->client) { - print ''; + print ''; print $langs->trans('CustomerCode').''; print $object->code_client; if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; @@ -179,14 +179,14 @@ if ($result > 0) if ($object->fournisseur) { - print ''; + print ''; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; print ''; } - print ''.$langs->trans("NbOfActiveNotifications").''; + print ''.$langs->trans("NbOfActiveNotifications").''; print ''; $notify=new Notify($db); $tmparray = $notify->getNotificationsArray('', $object->id); From c8b8e13014949d6a5bec6de6ef0b7e748e91dc95 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Sep 2016 21:13:23 +0200 Subject: [PATCH 23/37] Work on dol_banner for proposals. --- htdocs/comm/propal/card.php | 82 +++++++++++++++++++-- htdocs/comm/propal/class/propal.class.php | 19 +++-- htdocs/comm/propal/note.php | 10 ++- htdocs/compta/bank/card.php | 8 +- htdocs/core/class/commonobject.class.php | 4 +- htdocs/core/class/html.form.class.php | 40 ++++++---- htdocs/core/class/html.formprojet.class.php | 36 ++++++--- htdocs/core/lib/functions.lib.php | 28 +++++-- htdocs/product/note.php | 17 ++--- htdocs/societe/note.php | 5 -- htdocs/theme/eldy/style.css.php | 9 ++- htdocs/theme/md/style.css.php | 1 + 12 files changed, 184 insertions(+), 75 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index d045c5f0ea7..90fdc246be6 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1660,23 +1660,86 @@ if ($action == 'create') // Print form confirm print $formconfirm; - print ''; $linkback = '' . $langs->trans("BackToList") . ''; - // Ref + + $morehtmlref='
'; + + // Ref customer + $morehtmlref.=$langs->trans('RefCustomer').' '; + if ($action != 'refclient' && ! empty($object->brouillon)) + $morehtmlref.='' . img_edit($langs->trans('Modify')) . ' : '; + if ($user->rights->propal->creer && $action == 'refclient') { + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=' '; + $morehtmlref.=''; + } else { + $morehtmlref.=$object->ref_client; + } + + // Thirdparty + $morehtmlref.='
'.$langs->trans('Company') . ' : ' . $soc->getNomUrl(1); + + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->propal->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + + $morehtmlref.='
'; + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + print '
'; + + print '
'; + + // Ref + /* print ''; + */ // Ref customer + /* print '
' . $langs->trans('Ref') . ''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); print '
'; print ''; if ($action != 'refclient' && ! empty($object->brouillon)) print ''; - print ''; - print '
'; print $langs->trans('RefCustomer') . '' . img_edit($langs->trans('Modify')) . '
'; + print '
'; print ''; if ($user->rights->propal->creer && $action == 'refclient') { print '
'; @@ -1690,10 +1753,12 @@ if ($action == 'create') } print ''; print ''; - + */ + // Company + /* print '' . $langs->trans('Company') . '' . $soc->getNomUrl(1) . ''; - print ''; + print '';*/ // Lin for thirdparty discounts print '' . $langs->trans('Discounts') . ''; @@ -1916,6 +1981,7 @@ if ($action == 'create') } // Project + /* if (! empty($conf->projet->enabled)) { $langs->load("projects"); @@ -1949,7 +2015,7 @@ if ($action == 'create') } } print ''; - } + }*/ if ($soc->outstanding_limit) { @@ -2069,7 +2135,7 @@ if ($action == 'create') } // Statut - print '' . $langs->trans('Status') . '' . $object->getLibStatut(4) . ''; + //print '' . $langs->trans('Status') . '' . $object->getLibStatut(4) . ''; print '
'; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 6523688fd8d..fb24e82f68d 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -49,7 +49,8 @@ class Propal extends CommonObject public $table_element_line='propaldet'; public $fk_element='fk_propal'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - + public $picto='propal'; + /** * {@inheritdoc} */ @@ -2890,19 +2891,19 @@ class Propal extends CommonObject /** * Return label of status of proposal (draft, validated, ...) * - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto * @return string Label */ function getLibStatut($mode=0) { - return $this->LibStatut($this->statut,$mode); + return $this->LibStatut($this->statut, $mode); } /** * Return label of a status (draft, validated, ...) * * @param int $statut id statut - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ function LibStatut($statut,$mode=1) @@ -2921,8 +2922,9 @@ class Propal extends CommonObject if ($mode == 2) return img_picto($this->labelstatut_short[$statut], $statuttrans).' '.$this->labelstatut_short[$statut]; if ($mode == 3) return img_picto($this->labelstatut[$statut], $statuttrans); if ($mode == 4) return img_picto($this->labelstatut[$statut],$statuttrans).' '.$this->labelstatut[$statut]; - if ($mode == 5) return ''.$this->labelstatut_short[$statut].' '.img_picto($this->labelstatut_short[$statut],$statuttrans); - } + if ($mode == 5) return ''.$this->labelstatut_short[$statut].' '.img_picto($this->labelstatut[$statut],$statuttrans); + if ($mode == 6) return ''.$this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],$statuttrans); + } /** @@ -3232,11 +3234,8 @@ class Propal extends CommonObject } $linkend=''; - $picto='propal'; - - if ($withpicto) - $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend); + $result.=($link.img_object($label, $this->picto, 'class="classfortooltip"').$linkend); if ($withpicto && $withpicto != 2) $result.=' '; $result.=$link.$this->ref.$linkend; diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index 91972673201..89f31256717 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -75,15 +75,19 @@ if ($id > 0 || ! empty($ref)) $societe = new Societe($db); if ( $societe->fetch($object->socid) ) { - $head = propal_prepare_head($object); + $head = propal_prepare_head($object); dol_fiche_head($head, 'note', $langs->trans('Proposal'), 0, 'propal'); + $cssclass='titlefield'; + //if ($action == 'editnote_public') $cssclass='titlefieldcreate'; + //if ($action == 'editnote_private') $cssclass='titlefieldcreate'; + print ''; $linkback = ''.$langs->trans('BackToList').''; // Ref - print ''; @@ -138,7 +142,7 @@ if ($id > 0 || ! empty($ref)) print "
'.$langs->trans('Ref').''; + print '
'.$langs->trans('Ref').''; print $form->showrefnav($object,'ref',$linkback,1,'ref','ref',''); print '
"; - print '
'; + //print '
'; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 5f075ebf821..8cbf532c89a 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -646,7 +646,7 @@ else { print ''; - print ''; + print ''; print ''; // Show fields of bank account @@ -710,7 +710,7 @@ else print '
'.$langs->trans("BankName").'
'.$langs->trans("BankName").''.$account->bank.'
'; // Accountancy code - print ''; + print ''; print ''; @@ -908,7 +908,7 @@ else print '
'.$langs->trans("AccountancyCode").'
'.$langs->trans("AccountancyCode").''; if (! empty($conf->accounting->enabled)) { print length_accountg($account->account_number).'
'; // If bank account - print ''; + print ''; print ''; print ''; @@ -975,7 +975,7 @@ else $tdextra = ' class="fieldrequired titlefieldcreate"'; } - print ''.$langs->trans("AccountancyCode").''; + print ''.$langs->trans("AccountancyCode").''; print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index e3262b2a363..c43380a9e7a 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -52,7 +52,7 @@ if (in_array($object->element,array('propal', 'supplier_proposal','facture','fac lines) == 0); ?> - + From 95f2cae82574fd34e6f178d38ac67aac01c06f31 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Sep 2016 00:26:30 +0200 Subject: [PATCH 26/37] Start to work on sepa mandate generation --- htdocs/compta/bank/class/account.class.php | 2 - .../bank/doc/pdf_sepamandate.modules.php | 496 ++++++++++++++++++ htdocs/core/modules/bank/modules_bank.php | 57 ++ htdocs/core/modules/modPrelevement.class.php | 16 +- htdocs/societe/rib.php | 73 +-- 5 files changed, 608 insertions(+), 36 deletions(-) create mode 100644 htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php create mode 100644 htdocs/core/modules/bank/modules_bank.php diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 7d34c637265..9cb9e130bab 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1259,8 +1259,6 @@ class Account extends CommonObject // For backward compatibility, we try to guess country from other information if (! empty($this->iban)) { - if ($mysoc->country_code === 'IN') return $mysoc->country_code; // Test to know if we can trust IBAN - // If IBAN defined, we can know country of account from it if (preg_match("/^([a-zA-Z][a-zA-Z])/i",$this->iban,$reg)) return $reg[1]; } diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php new file mode 100644 index 00000000000..fac7ef1a9d5 --- /dev/null +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -0,0 +1,496 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php + * \ingroup project + * \brief File of class to generate document with template sepamandate + */ + +require_once DOL_DOCUMENT_ROOT.'/core/modules/project/modules_project.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + + +/** + * Classe permettant de generer les projets au modele Baleine + */ + +class pdf_sepamandate extends ModeleBankAccountDoc +{ + var $emetteur; // Objet societe qui emet + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function __construct($db) + { + global $conf,$langs,$mysoc; + + $langs->load("main"); + $langs->load("projects"); + $langs->load("companies"); + + $this->db = $db; + $this->name = "baleine"; + $this->description = $langs->trans("DocumentModelSepaMandate"); + + // Dimension page pour format A4 + $this->type = 'pdf'; + $formatarray=pdf_getFormat(); + $this->page_largeur = $formatarray['width']; + $this->page_hauteur = $formatarray['height']; + $this->format = array($this->page_largeur,$this->page_hauteur); + $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; + $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; + $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; + $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; + + $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO + $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION + $this->option_codeproduitservice = 1; // Affiche code produit-service + + // Recupere emmetteur + $this->emetteur=$mysoc; + if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined + + // Defini position des colonnes + $this->posxref=$this->marge_gauche+1; + $this->posxlabel=$this->marge_gauche+25; + $this->posxworkload=$this->marge_gauche+100; + $this->posxprogress=$this->marge_gauche+130; + $this->posxdatestart=$this->marge_gauche+150; + $this->posxdateend=$this->marge_gauche+170; + } + + + /** + * Fonction generant le projet sur le disque + * + * @param Project $object Object project a generer + * @param Translate $outputlangs Lang output object + * @return int 1 if OK, <=0 if KO + */ + function write_file($object,$outputlangs) + { + global $conf, $hookmanager, $langs, $user; + + if (! is_object($outputlangs)) $outputlangs=$langs; + // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO + if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; + + $outputlangs->load("main"); + $outputlangs->load("dict"); + $outputlangs->load("companies"); + $outputlangs->load("projects"); + + if ($conf->projet->dir_output) + { + //$nblignes = count($object->lines); // This is set later with array of tasks + + $objectref = dol_sanitizeFileName($object->ref); + $dir = $conf->projet->dir_output; + if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref; + $file = $dir . "/" . $objectref . ".pdf"; + + if (! file_exists($dir)) + { + if (dol_mkdir($dir) < 0) + { + $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); + return 0; + } + } + + if (file_exists($dir)) + { + // Add pdfgeneration hook + if (! is_object($hookmanager)) + { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager=new HookManager($this->db); + } + $hookmanager->initHooks(array('pdfgeneration')); + $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + global $action; + $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks + + $pdf=pdf_getInstance($this->format); + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance + $heightforinfotot = 50; // Height reserved to output the info and total part + $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) + $pdf->SetAutoPageBreak(1,0); + + if (class_exists('TCPDF')) + { + $pdf->setPrintHeader(false); + $pdf->setPrintFooter(false); + } + $pdf->SetFont(pdf_getPDFFont($outputlangs)); + + // Complete object by loading several other informations + $task = new Task($this->db); + $tasksarray = $task->getTasksArray(0,0,$object->id); + + if (! $object->id > 0) // Special case when used with object = specimen, we may return all lines + { + $tasksarray=array_slice($tasksarray, 0, min(5, count($tasksarray))); + } + + $object->lines=$tasksarray; + $nblignes=count($object->lines); + + $pdf->Open(); + $pagenb=0; + $pdf->SetDrawColor(128,128,128); + + $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); + $pdf->SetSubject($outputlangs->transnoentities("Project")); + $pdf->SetCreator("Dolibarr ".DOL_VERSION); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Project")); + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); + + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right + + // New page + $pdf->AddPage(); + $pagenb++; + $this->_pagehead($pdf, $object, 1, $outputlangs); + $pdf->SetFont('','', $default_font_size - 1); + $pdf->MultiCell(0, 3, ''); // Set interline to 3 + $pdf->SetTextColor(0,0,0); + + $tab_top = 50; + $tab_height = 200; + $tab_top_newpage = 40; + $tab_height_newpage = 210; + + // Affiche notes + if (! empty($object->note_public)) + { + $pdf->SetFont('','', $default_font_size - 1); + $pdf->writeHTMLCell(190, 3, $this->posxref-1, $tab_top-2, dol_htmlentitiesbr($object->note_public), 0, 1); + $nexY = $pdf->GetY(); + $height_note=$nexY-($tab_top-2); + + // Rect prend une longueur en 3eme param + $pdf->SetDrawColor(192,192,192); + $pdf->Rect($this->marge_gauche, $tab_top-3, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1); + + $tab_height = $tab_height - $height_note; + $tab_top = $nexY+6; + } + else + { + $height_note=0; + } + + $iniY = $tab_top + 7; + $curY = $tab_top + 7; + $nexY = $tab_top + 7; + + // Boucle sur les lignes + for ($i = 0 ; $i < $nblignes ; $i++) + { + $curY = $nexY; + + // Description of ligne + $ref=$object->lines[$i]->ref; + $libelleline=$object->lines[$i]->label; + $progress=$object->lines[$i]->progress.'%'; + $datestart=dol_print_date($object->lines[$i]->date_start,'day'); + $dateend=dol_print_date($object->lines[$i]->date_end,'day'); + $planned_workload=convertSecondToTime($object->lines[$i]->planned_workload,'allhourmin'); + + $pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page + + $pdf->SetXY($this->posxref, $curY); + $pdf->MultiCell($this->posxlabel-$this->posxref, 3, $outputlangs->convToOutputCharset($ref), 0, 'L'); + $pdf->SetXY($this->posxlabel, $curY); + $pdf->MultiCell($this->posxworkload-$this->posxlabel, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L'); + $pdf->SetXY($this->posxworkload, $curY); + $pdf->MultiCell($this->posxprogress-$this->posxworkload, 3, $planned_workload, 0, 'R'); + $pdf->SetXY($this->posxprogress, $curY); + $pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, $progress, 0, 'R'); + + $pdf->SetXY($this->posxdatestart, $curY); + $pdf->MultiCell($this->posxdateend-$this->posxdatestart, 3, $datestart, 0, 'C'); + $pdf->SetXY($this->posxdateend, $curY); + $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxdateend, 3, $dateend, 0, 'C'); + + $pageposafter=$pdf->getPage(); + + $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut + $nexY = $pdf->GetY(); + + // Add line + if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) + { + $pdf->setPage($pageposafter); + $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80))); + //$pdf->SetDrawColor(190,190,200); + $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); + $pdf->SetLineStyle(array('dash'=>0)); + } + + $nexY+=2; // Passe espace entre les lignes + + // Detect if some page were added automatically and output _tableau for past pages + while ($pagenb < $pageposafter) + { + $pdf->setPage($pagenb); + if ($pagenb == 1) + { + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + } + else + { + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + } + $this->_pagefoot($pdf,$object,$outputlangs,1); + $pagenb++; + $pdf->setPage($pagenb); + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + } + if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) + { + if ($pagenb == 1) + { + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + } + else + { + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + } + $this->_pagefoot($pdf,$object,$outputlangs,1); + // New page + $pdf->AddPage(); + if (! empty($tplidx)) $pdf->useTemplate($tplidx); + $pagenb++; + } + } + + // Show square + if ($pagenb == 1) + { + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; + } + else + { + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; + } + + /* + * Pied de page + */ + $this->_pagefoot($pdf,$object,$outputlangs); + if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); + + $pdf->Close(); + + $pdf->Output($file,'F'); + + // Add pdfgeneration hook + if (! is_object($hookmanager)) + { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager=new HookManager($this->db); + } + $hookmanager->initHooks(array('pdfgeneration')); + $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + global $action; + $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + + if (! empty($conf->global->MAIN_UMASK)) + @chmod($file, octdec($conf->global->MAIN_UMASK)); + + return 1; // Pas d'erreur + } + else + { + $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); + return 0; + } + } + + $this->error=$langs->transnoentities("ErrorConstantNotDefined","LIVRAISON_OUTPUTDIR"); + return 0; + } + + + /** + * Show table for lines + * + * @param PDF $pdf Object PDF + * @param string $tab_top Top position of table + * @param string $tab_height Height of table (rectangle) + * @param int $nexY Y + * @param Translate $outputlangs Langs object + * @param int $hidetop Hide top bar of array + * @param int $hidebottom Hide bottom bar of array + * @return void + */ + function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0) + { + global $conf,$mysoc; + + $default_font_size = pdf_getPDFFontSize($outputlangs); + + $pdf->SetDrawColor(128,128,128); + + // Rect prend une longueur en 3eme param + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height); + // line prend une position y en 3eme param + $pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6); + + $pdf->SetTextColor(0,0,0); + $pdf->SetFont('','', $default_font_size); + + $pdf->SetXY($this->posxref, $tab_top+1); + $pdf->MultiCell($this->posxlabel-$this->posxref,3, $outputlangs->transnoentities("Tasks"),'','L'); + + $pdf->SetXY($this->posxlabel, $tab_top+1); + $pdf->MultiCell($this->posxworkload-$this->posxlabel, 3, $outputlangs->transnoentities("Description"), 0, 'L'); + + $pdf->SetXY($this->posxworkload, $tab_top+1); + $pdf->MultiCell($this->posxprogress-$this->posxworkload, 3, $outputlangs->transnoentities("PlannedWorkloadShort"), 0, 'R'); + + $pdf->SetXY($this->posxprogress, $tab_top+1); + $pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, '%', 0, 'R'); + + $pdf->SetXY($this->posxdatestart, $tab_top+1); + $pdf->MultiCell($this->posxdateend-$this->posxdatestart, 3, '', 0, 'C'); + + $pdf->SetXY($this->posxdateend, $tab_top+1); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdatestart, 3, '', 0, 'C'); + + } + + /** + * Show top header of page. + * + * @param PDF $pdf Object PDF + * @param Project $object Object to show + * @param int $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output + * @return void + */ + function _pagehead(&$pdf, $object, $showaddress, $outputlangs) + { + global $langs,$conf,$mysoc; + + $default_font_size = pdf_getPDFFontSize($outputlangs); + + pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); + + $pdf->SetTextColor(0,0,60); + $pdf->SetFont('','B', $default_font_size + 3); + + $posx=$this->page_largeur-$this->marge_droite-100; + $posy=$this->marge_haute; + + $pdf->SetXY($this->marge_gauche,$posy); + + // Logo + $logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo; + if ($mysoc->logo) + { + if (is_readable($logo)) + { + $height=pdf_getHeightForLogo($logo); + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) + } + else + { + $pdf->SetTextColor(200,0,0); + $pdf->SetFont('','B', $default_font_size - 2); + $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); + $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorGoToModuleSetup"), 0, 'L'); + } + } + else $pdf->MultiCell(100, 4, $outputlangs->transnoentities($this->emetteur->name), 0, 'L'); + + $pdf->SetFont('','B', $default_font_size + 3); + $pdf->SetXY($posx,$posy); + $pdf->SetTextColor(0,0,60); + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Project")." ".$outputlangs->convToOutputCharset($object->ref), '', 'R'); + $pdf->SetFont('','', $default_font_size + 2); + + $posy+=6; + $pdf->SetXY($posx,$posy); + $pdf->SetTextColor(0,0,60); + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateStart")." : " . dol_print_date($object->date_start,'day',false,$outputlangs,true), '', 'R'); + $posy+=6; + $pdf->SetXY($posx,$posy); + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : " . dol_print_date($object->date_end,'day',false,$outputlangs,true), '', 'R'); + + $pdf->SetTextColor(0,0,60); + + // Add list of linked objects + /* Removed: A project can have more than thousands linked objects (orders, invoices, proposals, etc.... + $object->fetchObjectLinked(); + + foreach($object->linkedObjects as $objecttype => $objects) + { + var_dump($objects);exit; + if ($objecttype == 'commande') + { + $outputlangs->load('orders'); + $num=count($objects); + for ($i=0;$i<$num;$i++) + { + $posy+=4; + $pdf->SetXY($posx,$posy); + $pdf->SetFont('','', $default_font_size - 1); + $text=$objects[$i]->ref; + if ($objects[$i]->ref_client) $text.=' ('.$objects[$i]->ref_client.')'; + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), '', 'R'); + } + } + } + */ + + } + + /** + * Show footer of page. Need this->emetteur object + * + * @param PDF $pdf PDF + * @param Project $object Object to show + * @param Translate $outputlangs Object lang for output + * @param int $hidefreetext 1=Hide free text + * @return integer + */ + function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) + { + global $conf; + $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + return pdf_pagefoot($pdf,$outputlangs,'BANK_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); + } + +} + diff --git a/htdocs/core/modules/bank/modules_bank.php b/htdocs/core/modules/bank/modules_bank.php new file mode 100644 index 00000000000..b0a121d7dc5 --- /dev/null +++ b/htdocs/core/modules/bank/modules_bank.php @@ -0,0 +1,57 @@ + + * Copyright (C) 2014 Marcos García + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/core/modules/bank/modules_bank.php + * \ingroup project + * \brief File that contain parent class for bank models + * and parent class for bank numbering models + */ +require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; + + +/** + * Parent class for bank account models + */ +abstract class ModeleBankAccountDoc extends CommonDocGenerator +{ + var $error=''; + + + /** + * Return list of active generation modules + * + * @param DoliDB $db Database handler + * @param integer $maxfilenamelength Max length of value to show + * @return array List of templates + */ + static function liste_modeles($db,$maxfilenamelength=0) + { + global $conf; + + $type='bankaccount'; + $liste=array(); + + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $liste=getListOfModels($db,$type,$maxfilenamelength); + + return $liste; + } +} + diff --git a/htdocs/core/modules/modPrelevement.class.php b/htdocs/core/modules/modPrelevement.class.php index b2d0589f828..75e8410e19e 100644 --- a/htdocs/core/modules/modPrelevement.class.php +++ b/htdocs/core/modules/modPrelevement.class.php @@ -73,7 +73,16 @@ class modPrelevement extends DolibarrModules // Constants $this->const = array(); - + $r=0; + + $this->const[$r][0] = "BANK_ADDON_PDF"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "sepamandate"; + $this->const[$r][3] = 'Name of manager to generate SEPA mandate'; + $this->const[$r][4] = 0; + $r++; + + // Boxes $this->boxes = array(); @@ -138,7 +147,10 @@ class modPrelevement extends DolibarrModules // Permissions $this->remove($options); - $sql = array(); + $sql = array( + "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity, + "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','bankaccount',".$conf->entity.")", + ); return $this->_init($sql,$options); } diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index d31226ac052..395d4b05ec4 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -49,6 +49,8 @@ $id=GETPOST("id","int"); $ribid=GETPOST("ribid","int"); $action=GETPOST("action"); +$account = new CompanyBankAccount($db); + /* * Actions @@ -57,9 +59,6 @@ $action=GETPOST("action"); if ($action == 'update' && ! $_POST["cancel"]) { // Modification - $account = new CompanyBankAccount($db); - - if (! GETPOST('label')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); @@ -144,21 +143,6 @@ if ($action == 'add' && ! $_POST["cancel"]) $action='create'; $error++; } - if ($account->needIBAN() == 1) - { - if (! GETPOST('iban')) - { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("IBAN")), null, 'errors'); - $action='create'; - $error++; - } - if (! GETPOST('bic')) - { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BIC")), null, 'errors'); - $action='create'; - $error++; - } - } if (! $error) { @@ -182,18 +166,38 @@ if ($action == 'add' && ! $_POST["cancel"]) $account->owner_address = GETPOST('owner_address','alpha'); $account->frstrecur = GETPOST('frstrecur'); - $result = $account->update($user); // TODO Use create and include update into create method - if (! $result) - { - setEventMessages($account->error, $account->errors, 'errors'); - $_GET["action"]='create'; // Force chargement page création - } - else - { - $url=DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id; - header('Location: '.$url); - exit; - } + // This test can be done only once properties were set + if ($account->needIBAN() == 1) + { + if (! GETPOST('iban')) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("IBAN")), null, 'errors'); + $action='create'; + $error++; + } + if (! GETPOST('bic')) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BIC")), null, 'errors'); + $action='create'; + $error++; + } + } + + if (! $error) + { + $result = $account->update($user); // TODO Use create and include update into create method + if (! $result) + { + setEventMessages($account->error, $account->errors, 'errors'); + $_GET["action"]='create'; // Force chargement page création + } + else + { + $url=DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id; + header('Location: '.$url); + exit; + } + } } } @@ -248,8 +252,6 @@ llxHeader(); $head=societe_prepare_head2($object); - -$account = new CompanyBankAccount($db); if (! $id) $account->fetch(0,$object->id); else @@ -382,6 +384,7 @@ if ($socid && $action != 'edit' && $action != "create") { print ''; print ''; + print ''; } print_liste_field_titre($langs->trans("DefaultRIB"), '', '', '', '', 'align="center"'); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); @@ -408,6 +411,12 @@ if ($socid && $action != 'edit' && $action != "create") // FRSTRECUR print ''; + + include_once DOL_DOCUMENT_ROOT.'/core/modules/bank/modules_bank.php'; + $modellist=ModeleBankAccountDoc::liste_modeles($db); + print ''; // TODO Add link to generate doc } // Default From 7ac1b712e042bf70760754fb1cc3ebe080612c6d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Sep 2016 00:39:46 +0200 Subject: [PATCH 27/37] Start to work on sepa mandate generation --- htdocs/societe/rib.php | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index 395d4b05ec4..1adc9611213 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -384,10 +384,13 @@ if ($socid && $action != 'edit' && $action != "create") { print ''; print ''; - print ''; } print_liste_field_titre($langs->trans("DefaultRIB"), '', '', '', '', 'align="center"'); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); + if (! empty($conf->prelevement->enabled)) + { + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); + } print "\n"; foreach ($rib_list as $rib) @@ -411,12 +414,6 @@ if ($socid && $action != 'edit' && $action != "create") // FRSTRECUR print ''; - - include_once DOL_DOCUMENT_ROOT.'/core/modules/bank/modules_bank.php'; - $modellist=ModeleBankAccountDoc::liste_modeles($db); - print ''; // TODO Add link to generate doc } // Default @@ -445,6 +442,28 @@ if ($socid && $action != 'edit' && $action != "create") print ''; } print ''; + + if (! empty($conf->prelevement->enabled)) + { + include_once DOL_DOCUMENT_ROOT.'/core/modules/bank/modules_bank.php'; + $modellist=ModeleBankAccountDoc::liste_modeles($db); + print ''; } From b076ea298516cb634051fec9286d89b6536d343c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Sep 2016 00:49:29 +0200 Subject: [PATCH 28/37] Code comment --- htdocs/core/login/functions_dolibarr.php | 2 +- htdocs/core/login/functions_ldap.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/login/functions_dolibarr.php b/htdocs/core/login/functions_dolibarr.php index c421fdb1aeb..ee162bd9cc8 100644 --- a/htdocs/core/login/functions_dolibarr.php +++ b/htdocs/core/login/functions_dolibarr.php @@ -106,7 +106,7 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest= else { dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko bad password for '".$usertotest."'"); - sleep(1); + sleep(2); // Anti brut force protection $langs->load('main'); $langs->load('errors'); $_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadLoginPassword"); diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php index 71b93f8ee82..c94312c8aa2 100644 --- a/htdocs/core/login/functions_ldap.php +++ b/htdocs/core/login/functions_ldap.php @@ -229,7 +229,7 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest) $ldap->ldapErrorText = ldap_error($ldap->connection); dol_syslog("functions_ldap::check_user_password_ldap ".$ldap->ldapErrorCode." ".$ldap->ldapErrorText); } - sleep(1); + sleep(2); // Anti brut force protection $langs->load('main'); $langs->load('other'); $langs->load('errors'); From 77e20371954c33105b6a7c1f4aa0743bfd41b833 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Sep 2016 02:02:45 +0200 Subject: [PATCH 29/37] NEW Add REST API to read, create and delete agenda events --- htdocs/api/index.php | 5 +- htdocs/comm/action/class/api_events.class.php | 292 ++++++++++++++++++ htdocs/core/lib/functions.lib.php | 2 +- 3 files changed, 297 insertions(+), 2 deletions(-) create mode 100644 htdocs/comm/action/class/api_events.class.php diff --git a/htdocs/api/index.php b/htdocs/api/index.php index 31f3a97ff68..bfb9fca54b8 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -84,6 +84,9 @@ foreach ($modulesdir as $dir) { $module = $part = strtolower($reg[1]); + if ($module == 'agenda') { + $part = 'comm/action'; + } if ($module == 'categorie') { $part = 'categories'; } @@ -120,7 +123,7 @@ foreach ($modulesdir as $dir) if (class_exists($classname)) { dol_syslog("Found deprecated API classname=".$classname." into ".$dir); - $api->r->addAPIClass($classname, ''); + $api->r->addAPIClass($classname, '/'); } } elseif (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$reg)) diff --git a/htdocs/comm/action/class/api_events.class.php b/htdocs/comm/action/class/api_events.class.php new file mode 100644 index 00000000000..3fdbb4cf727 --- /dev/null +++ b/htdocs/comm/action/class/api_events.class.php @@ -0,0 +1,292 @@ + + * Copyright (C) 2016 Laurent Destailleur + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + use Luracast\Restler\RestException; + + require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; + +/** + * API class for Agenda Events + * + * @access protected + * @class DolibarrApiAccess {@requires user,external} + */ +class Events extends DolibarrApi +{ + + /** + * @var array $FIELDS Mandatory fields, checked when create and update object + */ + static $FIELDS = array( + ); + + /** + * @var Event $actioncomm {@type ActionComm} + */ + public $actioncomm; + + + /** + * Constructor + */ + function __construct() + { + global $db, $conf; + $this->db = $db; + $this->actioncomm = new ActionComm($this->db); + } + + /** + * Get properties of a Agenda Events object + * + * Return an array with Agenda Events informations + * + * @param int $id ID of Agenda Events + * @return array|mixed Data without useless information + * + * @throws RestException + */ + function get($id) + { + if(! DolibarrApiAccess::$user->rights->agenda->myactions->read) { + throw new RestException(401, "Insuffisant rights to read an event"); + } + + $result = $this->actioncomm->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Agenda Events not found'); + } + + if(! DolibarrApiAccess::$user->rights->agenda->allactions->read && $this->actioncomm->ownerid != DolibarrApiAccess::$user->id) { + throw new RestException(401, "Insuffisant rights to read event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id); + } + + if( ! DolibarrApi::_checkAccessToResource('agenda',$this->actioncomm->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $this->actioncomm->fetchObjectLinked(); + return $this->_cleanObjectDatas($this->actioncomm); + } + + /** + * List Agenda Events + * + * Get a list of Agenda Events + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $user_ids User ids filter field (owners of event). Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} + * + * @return array Array of Agenda Events objects + */ + function index($sortfield = "t.id", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0) { + global $db, $conf; + + $obj_ret = array(); + + // case of external user, $societe param is ignored and replaced by user's socid + //$socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $societe; + + $sql = "SELECT t.id as rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as t"; + $sql.= ' WHERE t.entity IN ('.getEntity('actioncomm', 1).')'; + if ($user_ids) $sql.=" AND ar.fk_user_action IN (".$user_ids.")"; + + // Insert sale filter + if ($search_sale > 0) + { + $sql .= " AND sc.fk_user = ".$search_sale; + } + + $nbtotalofrecords = 0; + if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) + { + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); + } + + $sql.= $db->order($sortfield, $sortorder); + if ($limit) { + if ($page < 0) + { + $page = 0; + } + $offset = $limit * $page; + + $sql.= $db->plimit($limit + 1, $offset); + } + + $result = $db->query($sql); + + if ($result) + { + $num = $db->num_rows($result); + while ($i < $num) + { + $obj = $db->fetch_object($result); + $actioncomm_static = new ActionComm($db); + if($actioncomm_static->fetch($obj->rowid)) { + $obj_ret[] = parent::_cleanObjectDatas($actioncomm_static); + } + $i++; + } + } + else { + throw new RestException(503, 'Error when retrieve Agenda Event list'); + } + if( ! count($obj_ret)) { + throw new RestException(404, 'No Agenda Event found'); + } + return $obj_ret; + } + + /** + * Create Agenda Event object + * + * @param array $request_data Request data + * @return int ID of Agenda Event + */ + function post($request_data = NULL) + { + if(! DolibarrApiAccess::$user->rights->agenda->myactions->create) { + throw new RestException(401, "Insuffisant rights to create your event"); + } + if(! DolibarrApiAccess::$user->rights->agenda->allactions->create && DolibarrApiAccess::$user->id != $request_data['userownerid']) { + throw new RestException(401, "Insuffisant rights to create an event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id); + } + + // Check mandatory fields + $result = $this->_validate($request_data); + + foreach($request_data as $field => $value) { + $this->actioncomm->$field = $value; + } + /*if (isset($request_data["lines"])) { + $lines = array(); + foreach ($request_data["lines"] as $line) { + array_push($lines, (object) $line); + } + $this->expensereport->lines = $lines; + }*/ + if ($this->actioncomm->create(DolibarrApiAccess::$user) <= 0) { + $errormsg = $this->actioncomm->error; + throw new RestException(500, $errormsg ? $errormsg : "Error while creating actioncomm"); + } + + return $this->actioncomm->id; + } + + + /** + * Update Agenda Event general fields (won't touch lines of expensereport) + * + * @param int $id Id of Agenda Event to update + * @param array $request_data Datas + * + * @return int + */ + /* + function put($id, $request_data = NULL) { + if(! DolibarrApiAccess::$user->rights->agenda->myactions->create) { + throw new RestException(401, "Insuffisant rights to create your event"); + } + if(! DolibarrApiAccess::$user->rights->agenda->allactions->create && DolibarrApiAccess::$user->id != $request_data['userownerid']) { + throw new RestException(401, "Insuffisant rights to create an event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id); + } + + $result = $this->expensereport->fetch($id); + if( ! $result ) { + throw new RestException(404, 'expensereport not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('expensereport',$this->expensereport->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + foreach($request_data as $field => $value) { + $this->expensereport->$field = $value; + } + + if($this->expensereport->update($id, DolibarrApiAccess::$user,1,'','','update')) + return $this->get($id); + + return false; + } + */ + + /** + * Delete Agenda Event + * + * @param int $id Agenda Event ID + * + * @return array + */ + function delete($id) + { + if(! DolibarrApiAccess::$user->rights->agenda->myactions->delete) { + throw new RestException(401, "Insuffisant rights to delete your event"); + } + + $result = $this->actioncomm->fetch($id); + + if(! DolibarrApiAccess::$user->rights->agenda->allactions->delete && DolibarrApiAccess::$user->id != $this->actioncomm->userownerid) { + throw new RestException(401, "Insuffisant rights to delete an event of owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id); + } + + if( ! $result ) { + throw new RestException(404, 'Agenda Event not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('actioncomm',$this->actioncomm->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + if( ! $this->actioncomm->delete(DolibarrApiAccess::$user)) { + throw new RestException(500, 'Error when delete Agenda Event : '.$this->actioncomm->error); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Agenda event deleted' + ) + ); + + } + + /** + * Validate fields before create or update object + * + * @param array $data Array with data to verify + * @return array + * @throws RestException + */ + function _validate($data) + { + $event = array(); + foreach (Events::$FIELDS as $field) { + if (!isset($data[$field])) + throw new RestException(400, "$field field missing"); + $event[$field] = $data[$field]; + + } + return $event; + } +} diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8159c0b86a5..68087c31e80 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -102,7 +102,7 @@ function getDoliDBInstance($type, $host, $user, $pass, $name, $port) /** * Get list of entity id to use * - * @param string $element Current element + * @param string $element Current element ('actioncomm', ...) * @param int $shared 0=Return id of entity, 1=Return id entity + shared entities * @return mixed Entity id(s) to use */ From 6cae631a4fd24e5a865ba5e82a725fd0988b986b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Sep 2016 02:13:16 +0200 Subject: [PATCH 30/37] NEW Add REST API to read users --- htdocs/user/class/api_users.class.php | 73 +++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index a9eb7771d9d..bf75758fe5c 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -49,6 +49,79 @@ class Users extends DolibarrApi $this->useraccount = new User($this->db); } + + /** + * List Users + * + * Get a list of Users + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $user_ids User ids filter field. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} + * + * @return array Array of User objects + */ + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $user_ids = 0) { + global $db, $conf; + + $obj_ret = array(); + + if(! DolibarrApiAccess::$user->rights->user->user->lire) { + throw new RestException(401, "You are not allowed to read list of users"); + } + + // case of external user, $societe param is ignored and replaced by user's socid + //$socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $societe; + + $sql = "SELECT t.rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."user as t"; + $sql.= ' WHERE t.entity IN ('.getEntity('user', 1).')'; + if ($user_ids) $sql.=" AND t.rowid IN (".$user_ids.")"; + + $nbtotalofrecords = 0; + if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) + { + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); + } + + $sql.= $db->order($sortfield, $sortorder); + if ($limit) { + if ($page < 0) + { + $page = 0; + } + $offset = $limit * $page; + + $sql.= $db->plimit($limit + 1, $offset); + } + + $result = $db->query($sql); + + if ($result) + { + $num = $db->num_rows($result); + while ($i < $num) + { + $obj = $db->fetch_object($result); + $user_static = new User($db); + if($user_static->fetch($obj->rowid)) { + $obj_ret[] = parent::_cleanObjectDatas($user_static); + } + $i++; + } + } + else { + throw new RestException(503, 'Error when retrieve User list'); + } + if( ! count($obj_ret)) { + throw new RestException(404, 'No User found'); + } + return $obj_ret; + } + /** * Get properties of an user object * From af28a6780380b87a075c18c13255c6f00a5597b6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Sep 2016 10:43:30 +0200 Subject: [PATCH 31/37] Uniformize look using dol_banner --- htdocs/comm/action/card.php | 92 ++++----- htdocs/comm/action/class/actioncomm.class.php | 21 +- htdocs/comm/action/document.php | 99 ++++------ htdocs/comm/action/info.php | 34 +++- htdocs/comm/propal/card.php | 111 ++++++----- htdocs/commande/card.php | 185 ++++++++++++------ htdocs/commande/class/commande.class.php | 3 +- htdocs/core/class/html.formmargin.class.php | 2 +- htdocs/core/lib/functions.lib.php | 10 +- htdocs/core/tpl/resource_add.tpl.php | 2 +- htdocs/core/tpl/resource_view.tpl.php | 9 +- htdocs/resource/element_resource.php | 171 +++++++++++----- htdocs/theme/eldy/style.css.php | 3 + htdocs/theme/md/style.css.php | 3 + 14 files changed, 455 insertions(+), 290 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index cd1c9ecfd1b..80cfce40c32 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -98,9 +98,11 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('actioncard','globalcard')); + /* * Actions */ + $listUserAssignedUpdated = false; // Remove user to assigned list if (GETPOST('removedassigned') || GETPOST('removedassigned') == '0') @@ -644,8 +646,8 @@ if ($action == 'create') if ($backtopage) print ''; if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) print ''; - if (GETPOST("actioncode") == 'AC_RDV') print load_fiche_titre($langs->trans("AddActionRendezVous")); - else print load_fiche_titre($langs->trans("AddAnAction")); + if (GETPOST("actioncode") == 'AC_RDV') print load_fiche_titre($langs->trans("AddActionRendezVous"), '', 'title_agenda'); + else print load_fiche_titre($langs->trans("AddAnAction"), '', 'title_agenda'); dol_fiche_head(); @@ -1183,33 +1185,51 @@ if ($id > 0) print $formconfirm; } + $linkback =img_picto($langs->trans("BackToList"),'object_list','class="hideonsmartphone pictoactionview"'); + $linkback.= ''.$langs->trans("BackToList").''; + + // Link to other agenda views + $out=''; + $out.=img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"'); + $out.=''.$langs->trans("ViewPerUser").''; + $out.='
'; + $out.=img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"'); + $out.=''.$langs->trans("ViewCal").''; + $out.=img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"'); + $out.=''.$langs->trans("ViewWeek").''; + $out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"'); + $out.=''.$langs->trans("ViewDay").''; + $linkback.=$out; + + dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', ''); + + print '
'; + // Affichage fiche action en mode visu print '
'.$langs->trans("BankName").'
'.$langs->trans("BankName").'
'; if (!empty($conf->accounting->enabled)) { print $formaccountancy->select_account($account->account_number, 'account_number', 1, '', 1, 1); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4e4f027ae12..8f1e40db48f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -433,7 +433,7 @@ abstract class CommonObject /** - * Return full address of contact + * Return full address for banner * * @param string $htmlkey HTML id to make banner content unique * @param Object $object Object (thirdparty, thirdparty of contact for contact, null for a member) @@ -476,7 +476,7 @@ abstract class CommonObject $out.=img_picto($langs->trans("Address"), 'object_address.png'); $out.=' '; } - $out.=dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1); $outdone++; + $out.=dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', '); $outdone++; $outdone++; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 0369bd76789..c8ae8dd8b6b 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3540,30 +3540,33 @@ class Form * @param int $discard_closed Discard closed projects (0=Keep,1=hide completely except $selected,2=Disable) * @param int $maxlength Max length * @param int $forcefocus Force focus on field (works with javascript only) - * @return void + * @param int $nooutput No print is done. String is returned. + * @return string Return html content */ - function form_project($page, $socid, $selected='', $htmlname='projectid', $discard_closed=0, $maxlength=20, $forcefocus=0) + function form_project($page, $socid, $selected='', $htmlname='projectid', $discard_closed=0, $maxlength=20, $forcefocus=0, $nooutput=0) { global $langs; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + $out=''; + $formproject=new FormProjets($this->db); $langs->load("project"); if ($htmlname != "none") { - print "\n"; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus); - print '
'; + $out.="\n"; + $out.='
'; + $out.=''; + $out.=''; + $out.=''; + $out.=''; + $out.=''; + $out.='
'; + $out.=$formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1); + $out.='
'; } else { @@ -3572,13 +3575,20 @@ class Form $projet = new Project($this->db); $projet->fetch($selected); //print ''.$projet->title.''; - print $projet->getNomUrl(0,'',1); + $out.=$projet->getNomUrl(0,'',1); } else { - print " "; + $out.=" "; } } + + if (empty($nooutput)) + { + print $out; + return ''; + } + return $out; } /** @@ -5738,7 +5748,7 @@ class Form } } - else dol_print_error('','Call of showphoto with wrong parameters'); + else dol_print_error('','Call of showphoto with wrong parameters modulepart='.$modulepart); return $ret; } diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 4c4c1486d51..f1ec7edae73 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -48,7 +48,7 @@ class FormProjets * * @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id) * @param int $selected Id project preselected - * @param string $htmlname Nom de la zone html + * @param string $htmlname Name of HTML field * @param int $maxlength Maximum length of label * @param int $option_only Return only html options lines without the select tag * @param int $show_empty Add an empty line @@ -57,12 +57,15 @@ class FormProjets * @param int $disabled Disabled * @param int $mode 0 for HTML mode and 1 for JSON mode * @param string $filterkey Key to filter - * @return int Nber of project if OK, <0 if KO + * @param int $nooutput No print output. Return it only. + * @return string Return html content */ - function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlength=16, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0, $mode = 0, $filterkey = '') + function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlength=16, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0, $mode = 0, $filterkey = '', $nooutput=0) { global $langs,$conf,$form; + $out=''; + if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PROJECT_USE_SEARCH_TO_SELECT)) { $placeholder=''; @@ -75,26 +78,33 @@ class FormProjets $selected_input_value=$project->ref; } $urloption='socid='.$socid.'&htmlname='.$htmlname; - print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array( + $out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array( // 'update' => array( // 'projectid' => 'id' // ) )); - print ''; + $out.=''; } else { - print $this->select_projects_list($socid, $selected, $htmlname, $maxlength, $option_only, $show_empty, $discard_closed, $forcefocus, $disabled, 0, $filterkey); + $out.=$this->select_projects_list($socid, $selected, $htmlname, $maxlength, $option_only, $show_empty, $discard_closed, $forcefocus, $disabled, 0, $filterkey, 1); if ($discard_closed) { if (class_exists('Form')) { if (empty($form)) $form=new Form($this->db); - print $form->textwithpicto('', $langs->trans("ClosedProjectsAreHidden")); + $out.=$form->textwithpicto('', $langs->trans("ClosedProjectsAreHidden")); } } } + + if (empty($nooutput)) + { + print $out; + return ''; + } + else return $out; } /** @@ -111,9 +121,10 @@ class FormProjets * @param int $disabled Disabled * @param int $mode 0 for HTML mode and 1 for array return (to be used by json_encode for example) * @param string $filterkey Key to filter + * @param int $nooutput No print output. Return it only. * @return int Nb of project if OK, <0 if KO */ - function select_projects_list($socid=-1, $selected='', $htmlname='projectid', $maxlength=24, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0, $mode=0, $filterkey = '') + function select_projects_list($socid=-1, $selected='', $htmlname='projectid', $maxlength=24, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0, $mode=0, $filterkey = '', $nooutput=0) { global $user,$conf,$langs; @@ -250,10 +261,13 @@ class FormProjets $this->db->free($resql); if (!$mode) { - if (empty($option_only)) { - $out.= ''; + if (empty($option_only)) $out.= ''; + if (empty($nooutput)) + { + print $out; + return ''; } - print $out; + else return $out; } else { return $outarray; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 88423aac279..8159c0b86a5 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -920,8 +920,8 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r $modulepart='unknown'; if ($object->element == 'societe') $modulepart='societe'; if ($object->element == 'contact') $modulepart='contact'; - if ($object->element == 'member') $modulepart='memberphoto'; - if ($object->element == 'user') $modulepart='userphoto'; + if ($object->element == 'member') $modulepart='memberphoto'; + if ($object->element == 'user') $modulepart='userphoto'; if ($object->element == 'product') $modulepart='product'; print '
'; @@ -947,7 +947,18 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r } else { - if ($showimage) $morehtmlleft.='
'.$form->showphoto($modulepart,$object,0,0,0,'photoref','small',1,0,$maxvisiblephotos).'
'; + if ($showimage) + { + $morehtmlleft.='
'; + if ($modulepart != 'unknown') $morehtmlleft.=$form->showphoto($modulepart,$object,0,0,0,'photoref','small',1,0,$maxvisiblephotos); + else + { + $width=14; $cssclass='photorefcenter'; + $nophoto=img_picto('', 'object_'.$object->picto, '', false, 1); + $morehtmlleft.='
No photo
'; + } + $morehtmlleft.='
'; + } } if ($showbarcode) $morehtmlleft.='
'.$form->showbarcode($object).'
'; if ($object->element == 'societe' && ! empty($conf->use_javascript_ajax) && $user->rights->societe->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { @@ -970,7 +981,9 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r } } else { - $morehtmlright.=$object->getLibStatut(5); + $tmptxt=$object->getLibStatut(6); + if (empty($tmptxt)) $tmptxt=$object->getLibStatut(5); + $morehtmlright.=$tmptxt; } if (! empty($object->name_alias)) $morehtmlref.='
'.$object->name_alias.'
'; // For thirdparty if (! empty($object->label)) $morehtmlref.='
'.$object->label.'
'; // For product @@ -1793,10 +1806,11 @@ function dol_user_country() * @param int $mode 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) +function dol_print_address($address, $htmlid, $mode, $id, $noprint=0, $charfornl='') { global $conf, $user, $langs, $hookmanager; @@ -1811,7 +1825,9 @@ function dol_print_address($address, $htmlid, $mode, $id, $noprint=0) } if (empty($reshook)) { - $out.=nl2br($address); + if (empty($charfornl)) $out.=nl2br($address); + else $out.=preg_replace('/[\r\n]+/', $charfornl, $address); + $showgmap=$showomap=0; // TODO Add a hook here diff --git a/htdocs/product/note.php b/htdocs/product/note.php index b3f2fa1c01c..9a914527a83 100644 --- a/htdocs/product/note.php +++ b/htdocs/product/note.php @@ -93,23 +93,20 @@ if ($id > 0 || ! empty($ref)) dol_fiche_head($head, 'note', $titre, 0, $picto); - - print '
'; - print ''; - $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); - - print '
'; + + $cssclass='titlefield'; + //if ($action == 'editnote_public') $cssclass='titlefieldcreate'; + //if ($action == 'editnote_private') $cssclass='titlefieldcreate'; + + //print '
'; print '
'; - $cssclass='titlefield'; - if ($action == 'editnote') $cssclass='titlefieldcreate'; - if ($action == 'editnote_private') $cssclass='titlefieldcreate'; + include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; - dol_fiche_end(); } diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php index ac441f52938..27eb643bc16 100644 --- a/htdocs/societe/note.php +++ b/htdocs/societe/note.php @@ -73,10 +73,6 @@ if ($id > 0) dol_fiche_head($head, 'note', $langs->trans("ThirdParty"),0,'company'); - - print ''; - print ''; - dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); $cssclass='titlefield'; @@ -120,7 +116,6 @@ if ($id > 0) //print '
'; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; - dol_fiche_end(); } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index bf5a0e66085..3d39cea9f62 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -913,7 +913,7 @@ div.statusref { margin-bottom: 10px; clear: both; } -img.photoref { +img.photoref, div.photoref { border: 1px solid #CCC; -moz-box-shadow: 3px 3px 4px #DDD; -webkit-box-shadow: 3px 3px 4px #DDD; @@ -923,6 +923,12 @@ img.photoref { width: 80px; object-fit: contain; } +div.photoref { + display:table-cell; + vertical-align:middle; + text-align:center; +} + img.photorefnoborder { padding: 2px; height: 48px; @@ -2444,6 +2450,7 @@ div.refidno { font-weight: normal; color: #444; font-size: px; + line-height: 21px; } div.pagination { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 4c790b20d44..3b8c7f38097 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2340,6 +2340,7 @@ div.refidno { font-weight: normal; color: #444; font-size: px; + line-height: 21px; } div.pagination { From c4626b08268020ca8ae9f6f85fd7ab8a9b3477b9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Sep 2016 21:48:00 +0200 Subject: [PATCH 24/37] CSS --- htdocs/theme/eldy/style.css.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 3d39cea9f62..e8692055b31 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -101,7 +101,7 @@ $usegradienttop=(isset($conf->global->THEME_ELDY_TOPMENU_BACK1)?0:1); $usegradienttitle=(isset($conf->global->THEME_ELDY_BACKTITLE1)?0:1); $useboldtitle=(isset($conf->global->THEME_ELDY_USEBOLDTITLE)?$conf->global->THEME_ELDY_USEBOLDTITLE:1); $borderwith=2; -$noborderline=1; +$noborderline=0; // Case of option always editable if (! isset($conf->global->THEME_ELDY_BACKBODY)) $conf->global->THEME_ELDY_BACKBODY=$colorbackbody; From 5fb55cc9de9af9b8125201c97162acc5d1d8cfdd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Sep 2016 22:00:59 +0200 Subject: [PATCH 25/37] Fix css --- htdocs/contrat/card.php | 2 +- htdocs/core/tpl/objectline_create.tpl.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index ef257c348aa..c323fbf5cc5 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1452,7 +1452,7 @@ else { $total = 0; - print '
'.$langs->trans("ServiceNb",$cursorline).''.$langs->trans("VAT").''.$langs->trans("PriceUHT").'
global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
trans('AddNewLine'); ?>trans("FreeZone"); ?>
RUM'.$langs->trans("WithdrawMode").''.$rib->frstrecur.''; + //var_dump($modellist); + print 'RUM'.$langs->trans("WithdrawMode").'
'.$rib->frstrecur.''; - //var_dump($modellist); - print ''; + if (is_array($modellist) && count($modellist) == 1) // If there is only one element + { + $arraykeys=array_keys($modellist); + $modelselected=$arraykeys[0]; + } + $out.= $form->selectarray('model', $modellist, $modelselected, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100'); + $out.= ajax_combobox('model'); + //print $out; + $buttonlabel=$langs->trans("Generate"); + $genbutton = ''; // TODO Add link to generate doc + } + print '
'; - $linkback = ''.$langs->trans("BackToList").''; - // Ref - print ''; + print '';*/ // Type if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { - print ''; + print ''; } // Title - print ''; + //print ''; // Full day event - print ''; + print ''; $rowspan=4; if (empty($conf->global->AGENDA_DISABLE_LOCATION)) $rowspan++; // Date start - print ''; // Status - print ''; + print '';*/ // Location if (empty($conf->global->AGENDA_DISABLE_LOCATION)) @@ -1235,7 +1255,7 @@ if ($id > 0) } // Assigned to - print ''; @@ -1432,46 +1452,6 @@ if ($id > 0) if ($action != 'edit') { - // Link to agenda views - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"').' '; - print ''."\n"; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"').' '; - print ''."\n"; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"').' '; - print ''."\n"; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"').' '; - print ''."\n"; - print '
'; - if (empty($conf->global->AGENDA_DISABLE_BUILDDOC)) { print '
 

'; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index c4739845042..b190047bac7 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -37,7 +37,8 @@ class ActionComm extends CommonObject public $table_element = 'actioncomm'; public $table_rowid = 'id'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - + public $picto='action'; + /** * Id of the event * @var int @@ -1024,7 +1025,7 @@ class ActionComm extends CommonObject * Return label of action status * * @param int $percent Percent - * @param int $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Very short label+Picto + * @param int $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Picto+Long label, 7=Very short label+Picto * @param int $hidenastatus 1=Show nothing if status is "Not applicable" * @return string Label */ @@ -1076,11 +1077,19 @@ class ActionComm extends CommonObject } else if ($mode == 6) { - if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9'); - else if ($percent==0) return '0% '.img_picto($langs->trans('StatusActionToDo'),'statut1'); - else if ($percent > 0 && $percent < 100) return $percent.'% '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3'); - else if ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6'); + if ($percent==-1 && ! $hidenastatus) return $langs->trans('StatusNotApplicable').' '.img_picto($langs->trans('StatusNotApplicable'),'statut9'); + else if ($percent==0) return $langs->trans('StatusActionToDo').'0% '.img_picto($langs->trans('StatusActionToDo'),'statut1'); + else if ($percent > 0 && $percent < 100) return $langs->trans('StatusActionInProcess').' ('.$percent.'%) '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3'); + else if ($percent >= 100) return $langs->trans('StatusActionDone').' (100%) '.img_picto($langs->trans('StatusActionDone'),'statut6'); } + else if ($mode == 7) + { + if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9'); + else if ($percent==0) return '0% '.img_picto($langs->trans('StatusActionToDo'),'statut1'); + else if ($percent > 0 && $percent < 100) return $percent.'% '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3'); + else if ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6'); + } + return ''; } diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index e8e5c388eb4..4691673a831 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -123,30 +123,49 @@ if ($object->id > 0) dol_fiche_head($head, 'documents', $langs->trans("Action"),0,'action'); + $linkback = img_picto($langs->trans("BackToList"),'object_list','class="hideonsmartphone pictoactionview"'); + $linkback.= ''.$langs->trans("BackToList").''; + + // Link to other agenda views + $out=''; + $out.=img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"'); + $out.=''.$langs->trans("ViewPerUser").''; + $out.='
'; + $out.=img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"'); + $out.=''.$langs->trans("ViewCal").''; + $out.=img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"'); + $out.=''.$langs->trans("ViewWeek").''; + $out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"'); + $out.=''.$langs->trans("ViewDay").''; + + $linkback.=$out; + + dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', ''); + + print '
'; + // Affichage fiche action en mode visu print '
'.$langs->trans("Ref").''; + /*print '
'.$langs->trans("Ref").''; print $form->showrefnav($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', ''); - print '
'.$langs->trans("Type").''.$object->type.'
'.$langs->trans("Type").''.$object->type.'
'.$langs->trans("Title").''.dol_htmlentities($object->label).'
'.$langs->trans("Title").''.dol_htmlentities($object->label).'
'.$langs->trans("EventOnFullDay").''.yn($object->fulldayevent, 3).'
'.$langs->trans("EventOnFullDay").''.yn($object->fulldayevent, 3).'
'.$langs->trans("DateActionStart").''; + print '
'.$langs->trans("DateActionStart").''; if (! $object->fulldayevent) print dol_print_date($object->datep,'dayhour'); else print dol_print_date($object->datep,'day'); if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late")); @@ -1224,9 +1244,9 @@ if ($id > 0) print '
'.$langs->trans("Status").' / '.$langs->trans("Percentage").''; + /*print '
'.$langs->trans("Status").' / '.$langs->trans("Percentage").''; print $object->getLibStatut(4); - print '
'.$langs->trans("ActionAssignedTo").''; + print '
'.$langs->trans("ActionAssignedTo").''; $listofuserid=array(); if (empty($donotclearsession)) { @@ -1291,7 +1311,7 @@ if ($id > 0) // Third party - Contact if ($conf->societe->enabled) { - print '
'.$langs->trans("ActionOnCompany").''.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):$langs->trans("None")); + print '
'.$langs->trans("ActionOnCompany").''.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):$langs->trans("None")); if (is_object($object->thirdparty) && $object->thirdparty->id > 0 && $object->type_code == 'AC_TEL') { if ($object->thirdparty->fetch($object->thirdparty->id)) @@ -1323,7 +1343,7 @@ if ($id > 0) // Project if (! empty($conf->projet->enabled)) { - print '
'.$langs->trans("Project").''; + print '
'.$langs->trans("Project").''; if ($object->fk_project) { $project=new Project($db); @@ -1334,7 +1354,7 @@ if ($id > 0) } // Priority - print '
'.$langs->trans("Priority").''; + print '
'.$langs->trans("Priority").''; print ($object->priority?$object->priority:''); print '
'; - $linkback = ''.$langs->trans("BackToList").''; - // Ref - print ''; + print '';*/ // Type if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { - print ''; + print ''; } // Title - print ''; + //print ''; // Full day event - print ''; + print ''; // Date start - print ''; // Status - print ''; + print '';*/ // Location if (empty($conf->global->AGENDA_DISABLE_LOCATION)) @@ -172,7 +191,7 @@ if ($object->id > 0) } // Assigned to - print ''; - print '
'.$langs->trans("Ref").''; + /*print '
'.$langs->trans("Ref").''; print $form->showrefnav($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', ''); - print '
'.$langs->trans("Type").''.$object->type.'
'.$langs->trans("Type").''.$object->type.'
'.$langs->trans("Title").''.$object->label.'
'.$langs->trans("Title").''.$object->label.'
'.$langs->trans("EventOnFullDay").''.yn($object->fulldayevent, 3).'
'.$langs->trans("EventOnFullDay").''.yn($object->fulldayevent, 3).'
'.$langs->trans("DateActionStart").''; + print '
'.$langs->trans("DateActionStart").''; if (! $object->fulldayevent) print dol_print_date($object->datep,'dayhour'); else print dol_print_date($object->datep,'day'); if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late")); @@ -161,9 +180,9 @@ if ($object->id > 0) print '
'.$langs->trans("Status").' / '.$langs->trans("Percentage").''; + /*print '
'.$langs->trans("Status").' / '.$langs->trans("Percentage").''; print $object->getLibStatut(4); - print '
'.$langs->trans("ActionAffectedTo").''; + print '
'.$langs->trans("ActionAffectedTo").''; $listofuserid=array(); if (empty($donotclearsession)) { @@ -206,11 +225,15 @@ if ($object->id > 0) } print '


'; + print '
'; + + print '

'; + + print ''; // Third party - Contact - print ''; + print ''; print ''; print '
'.$langs->trans("ActionOnCompany").''.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):$langs->trans("None")); + print '
'.$langs->trans("ActionOnCompany").''.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):$langs->trans("None")); if (is_object($object->thirdparty) && $object->thirdparty->id > 0 && $object->type_code == 'AC_TEL') { if ($object->thirdparty->fetch($object->thirdparty->id)) @@ -281,7 +304,7 @@ if ($object->id > 0) } - print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; @@ -289,54 +312,6 @@ if ($object->id > 0) dol_fiche_end(); - - if ($action != 'edit') - { - // Link to agenda views - print '
'; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"').' '; - print '
'."\n"; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone pictoactionview"').' '; - print '
'."\n"; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone pictoactionview"').' '; - print '
'."\n"; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone pictoactionview"').' '; - print '
'."\n"; - print '
'; - - print '
'; - print "

"; - } - - $modulepart = 'actions'; $permission = $user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create; $param = '&id=' . $object->id; diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php index 7c2001d925d..d1338142173 100644 --- a/htdocs/comm/action/info.php +++ b/htdocs/comm/action/info.php @@ -50,19 +50,41 @@ $result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions| $help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda'; llxHeader('',$langs->trans("Agenda"),$help_url); -$act = new ActionComm($db); -$act->fetch($id); -$act->info($act->id); +$object = new ActionComm($db); +$object->fetch($id); +$object->info($object->id); -$head=actions_prepare_head($act); +$head=actions_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans("Action"),0,'action'); +$linkback = img_picto($langs->trans("BackToList"),'object_list','class="hideonsmartphone pictoactionview"'); +$linkback.= ''.$langs->trans("BackToList").''; + +// Link to other agenda views +$out=''; +$out.=img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"'); +$out.=''.$langs->trans("ViewPerUser").''; +$out.='
'; +$out.=img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"'); +$out.=''.$langs->trans("ViewCal").''; +$out.=img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"'); +$out.=''.$langs->trans("ViewWeek").''; +$out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"'); +$out.=''.$langs->trans("ViewDay").''; + +$linkback.=$out; + +dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', ''); + +print '
'; + +print '
'; print '
'; -dol_print_object_info($act); +dol_print_object_info($object); print '
'; -print '
'; +dol_fiche_end(); llxFooter(); $db->close(); diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 90fdc246be6..b0ea8a9f4ba 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1661,6 +1661,8 @@ if ($action == 'create') print $formconfirm; + // Proposal card + $linkback = '' . $langs->trans("BackToList") . ''; @@ -1669,7 +1671,10 @@ if ($action == 'create') // Ref customer $morehtmlref.=$langs->trans('RefCustomer').' '; if ($action != 'refclient' && ! empty($object->brouillon)) - $morehtmlref.='' . img_edit($langs->trans('Modify')) . ' : '; + { + $morehtmlref.='' . img_edit($langs->trans('Modify')) . ' '; + } + $morehtmlref.=' : '; if ($user->rights->propal->creer && $action == 'refclient') { $morehtmlref.='
'; $morehtmlref.=''; @@ -1719,8 +1724,12 @@ if ($action == 'create') $morehtmlref.='
'; + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + print '
'; + print '
'; print '
'; print ''; @@ -1927,7 +1936,7 @@ if ($action == 'create') // Payment mode print ''; - print ''; print '
'; + print ''; print ''; @@ -1947,7 +1956,7 @@ if ($action == 'create') { // Multicurrency code print ''; - print ''; // Delivery date planed - print ''; print '
'; print $langs->trans('PaymentMode'); print '
'; + print ''; print ''; @@ -1964,7 +1973,7 @@ if ($action == 'create') // Multicurrency rate print ''; - print '
'; print fieldLabel('Currency','multicurrency_code'); print '
'; + print ''; print ''; @@ -2073,71 +2082,81 @@ if ($action == 'create') } // Other attributes - $cols = 5; + $cols = 2; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + print '
'; print fieldLabel('CurrencyRate','multicurrency_tx'); print '
'; + + print ''; + print '
'; + print '
'; + print '
'; + + print ''; + // Amount HT print ''; - print ''; - - // Margin Infos - if (! empty($conf->margin->enabled)) - { - $rowspan=4; - if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) $rowspan++; - if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) $rowspan++; - print ''; - } + print ''; print ''; - + // Amount VAT print ''; - print ''; + print ''; print ''; - + // Amount Local Taxes if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1 { - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2 { - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } - + // Amount TTC print ''; - print ''; + print ''; print ''; - + if (!empty($conf->multicurrency->enabled)) { - // Multicurrency Amount HT - print ''; - print ''; - print ''; - - // Multicurrency Amount VAT - print ''; - print ''; - print ''; - - // Multicurrency Amount TTC - print ''; - print ''; - print ''; + // Multicurrency Amount HT + print ''; + print ''; + print ''; + + // Multicurrency Amount VAT + print ''; + print ''; + print ''; + + // Multicurrency Amount TTC + print ''; + print ''; + print ''; } - + // Statut //print ''; - - print '
' . $langs->trans('AmountHT') . '' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . ''; - $formmargin->displayMarginInfos($object); - print '' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->trans('AmountVAT') . '' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($object->total_localtax1, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($object->total_localtax1, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->trans('AmountTTC') . '' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . $langs->trans('Status') . '' . $object->getLibStatut(4) . '

'; + + print '
'; + + // Margin Infos + if (! empty($conf->margin->enabled)) + { + $formmargin->displayMarginInfos($object); + } + + print ''; + print ''; + print ''; + + print '

'; if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { $blocname = 'contacts'; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 00eac5dce6f..7431ee9ca79 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1434,7 +1434,6 @@ if ($action == 'create' && $user->rights->commande->creer) } $absolute_discount=$soc->getAvailableDiscounts(); - $nbrow = 10; print ''; print ''; @@ -1911,24 +1910,82 @@ if ($action == 'create' && $user->rights->commande->creer) // Print form confirm print $formconfirm; - /* - * Commande - */ - $nbrow = 9; - if (! empty($conf->projet->enabled)) - $nbrow ++; - - // Local taxes - if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) - $nbrow++; - if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0 ) - $nbrow++; - - print ''; + // Order card + $linkback = '' . $langs->trans("BackToList") . ''; + + $morehtmlref='
'; + + // Ref customer + $morehtmlref.=$langs->trans('RefCustomer').' '; + if ($action != 'refclient' && ! empty($object->brouillon)) + { + $morehtmlref.='' . img_edit($langs->trans('Modify')) . ' '; + } + $morehtmlref.=' : '; + if ($user->rights->commande->creer && $action == 'refclient') { + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=' '; + $morehtmlref.=''; + } else { + $morehtmlref.=$object->ref_client; + } + + // Thirdparty + $morehtmlref.='
'.$langs->trans('Company') . ' : ' . $soc->getNomUrl(1); + + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->commande->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + + print '
'; + // Ref + /* print ''; print ''; + print '';*/ if ($soc->outstanding_limit) { // Outstanding Bill print ''; @@ -1999,7 +2056,7 @@ if ($action == 'create' && $user->rights->commande->creer) $addabsolutediscount = '' . $langs->trans("EditGlobalDiscounts") . ''; $addcreditnote = '' . $langs->trans("AddCreditNote") . ''; - print ''; print '
' . $langs->trans('Ref') . ''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); @@ -1971,14 +2028,14 @@ if ($action == 'create' && $user->rights->commande->creer) } else { print $soc->getNomUrl(1, 'compta'); } - print '
'; print $langs->trans('OutstandingBill'); - print ''; + print ''; print price($soc->get_OutstandingBill()) . ' / '; print price($soc->outstanding_limit, 0, '', 1, - 1, - 1, $conf->currency); print '
' . $langs->trans('Discounts') . ''; + print '
' . $langs->trans('Discounts') . ''; if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent); else @@ -2034,7 +2091,7 @@ if ($action == 'create' && $user->rights->commande->creer) if ($action != 'editdate' && $object->brouillon) print 'id . '">' . img_edit($langs->trans('SetDate'), 1) . '
'; - print '
'; + print ''; if ($action == 'editdate') { print '
'; print ''; @@ -2052,14 +2109,14 @@ if ($action == 'create' && $user->rights->commande->creer) print '
'; + print '
'; print ''; if ($action != 'editdate_livraison') print ''; print '
'; print $langs->trans('DateDeliveryPlanned'); print 'id . '">' . img_edit($langs->trans('SetDeliveryDate'), 1) . '
'; - print '
'; + print ''; if ($action == 'editdate_livraison') { print ''; print ''; @@ -2085,7 +2142,7 @@ if ($action == 'create' && $user->rights->commande->creer) if ($action != 'editshippingmethod' && $user->rights->commande->creer) print 'id.'">'.img_edit($langs->trans('SetShippingMode'),1).'
'; - print '
'; + print ''; if ($action == 'editshippingmethod') { $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1); } else { @@ -2106,7 +2163,7 @@ if ($action == 'create' && $user->rights->commande->creer) if ($action != 'editwarehouse' && $user->rights->commande->creer) print 'id.'">'.img_edit($langs->trans('SetWarehouse'),1).'
'; - print ''; + print ''; if ($action == 'editwarehouse') { $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1); } else { @@ -2117,14 +2174,14 @@ if ($action == 'create' && $user->rights->commande->creer) } // Terms of payment - print ''; + print ''; print ''; if ($action != 'editconditions') print ''; print '
'; print $langs->trans('PaymentConditionsShort'); print 'id . '">' . img_edit($langs->trans('SetConditions'), 1) . '
'; - print ''; + print ''; if ($action == 'editconditions') { $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id', 1); } else { @@ -2135,14 +2192,14 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; // Mode of payment - print ''; + print ''; print ''; if ($action != 'editmode') print ''; print '
'; print $langs->trans('PaymentMode'); print 'id . '">' . img_edit($langs->trans('SetMode'), 1) . '
'; - print ''; + print ''; if ($action == 'editmode') { $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id'); } else { @@ -2155,14 +2212,14 @@ if ($action == 'create' && $user->rights->commande->creer) { // Multicurrency code print ''; - print ''; + print ''; print ''; if ($action != 'editmulticurrencycode' && ! empty($object->brouillon)) print ''; print '
'; print fieldLabel('Currency','multicurrency_code'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; - print ''; + print ''; if ($action == 'editmulticurrencycode') { $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'multicurrency_code'); } else { @@ -2172,14 +2229,14 @@ if ($action == 'create' && $user->rights->commande->creer) // Multicurrency rate print ''; - print ''; + print ''; print ''; if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) print ''; print '
'; print fieldLabel('CurrencyRate','multicurrency_tx'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; - print ''; + print ''; if ($action == 'editmulticurrencyrate') { $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { @@ -2196,7 +2253,7 @@ if ($action == 'create' && $user->rights->commande->creer) if ($action != 'editavailability') print 'id . '">' . img_edit($langs->trans('SetAvailability'), 1) . ''; print ''; - print ''; + print ''; if ($action == 'editavailability') { $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'availability_id', 1); } else { @@ -2212,7 +2269,7 @@ if ($action == 'create' && $user->rights->commande->creer) if ($action != 'editdemandreason') print 'id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . ''; print ''; - print ''; + print ''; if ($action == 'editdemandreason') { $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1); } else { @@ -2230,7 +2287,7 @@ if ($action == 'create' && $user->rights->commande->creer) if ($totalWeight || $totalVolume) { print ''.$langs->trans("CalculatedWeight").' / '.$langs->trans("CalculatedVolume").''; - print ''; + print ''; print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no'); print ' / '; print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no'); @@ -2240,6 +2297,7 @@ if ($action == 'create' && $user->rights->commande->creer) // TODO How record was recorded OrderMode (llx_c_input_method) // Project + /* if (! empty($conf->projet->enabled)) { $langs->load('projects'); @@ -2259,7 +2317,8 @@ if ($action == 'create' && $user->rights->commande->creer) } print ''; } - + */ + // Incoterms if (!empty($conf->incoterm->enabled)) { @@ -2283,16 +2342,6 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; } - // Other attributes - $cols = 3; - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; - - $rowspan = 4; - if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) - $rowspan ++; - if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) - $rowspan ++; - // Bank Account if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled)) { @@ -2313,20 +2362,23 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; } + // Other attributes + $cols = 2; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + + print ''; + + print '
'; + print '
'; + print '
'; + print '
'; + + print ''; + // Total HT print ''; print ''; - // Margin Infos - if (! empty($conf->margin->enabled)) { - print ''; - } else - print ''; - - print ''; - // Total VAT print ''; @@ -2349,25 +2401,36 @@ if ($action == 'create' && $user->rights->commande->creer) { // Multicurrency Amount HT print ''; - print ''; + print ''; print ''; // Multicurrency Amount VAT print ''; - print ''; + print ''; print ''; // Multicurrency Amount TTC print ''; - print ''; + print ''; print ''; } // Statut - print ''; + //print ''; + + print '
' . $langs->trans('AmountHT') . '' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . ''; - $formmargin->displayMarginInfos($object); - print '
' . $langs->trans('AmountVAT') . '' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . $langs->trans('Status') . '' . $object->getLibStatut(4) . '
' . $langs->trans('Status') . '' . $object->getLibStatut(4) . '
'; + + // Margin Infos + if (! empty($conf->margin->enabled)) { + $formmargin->displayMarginInfos($object); + } + - print '
'; - print "\n"; + print '
'; + print '
'; + print '
'; + + print '

'; if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { $blocname = 'contacts'; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index d9dfb2f5c17..f30318d2fb8 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -47,7 +47,8 @@ class Commande extends CommonOrder public $class_element_line = 'OrderLine'; public $fk_element = 'fk_commande'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - + public $picto = 'order'; + /** * {@inheritdoc} */ diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index 6678d87ca60..99159f62561 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -209,7 +209,7 @@ class FormMargin if (!empty($hidemargininfos)) print ''; } - print ''; + print '
'; print ''; print ''; print ''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 68087c31e80..dfa724e7c64 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -951,7 +951,13 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r { $morehtmlleft.='
'; if ($modulepart != 'unknown') $morehtmlleft.=$form->showphoto($modulepart,$object,0,0,0,'photoref','small',1,0,$maxvisiblephotos); - else + else if ($object->element == 'action') + { + $cssclass='photorefcenter'; + $nophoto=img_picto('', 'title_agenda', '', false, 1); + $morehtmlleft.='
No photo
'; + } + else { $width=14; $cssclass='photorefcenter'; $nophoto=img_picto('', 'object_'.$object->picto, '', false, 1); @@ -982,7 +988,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r } else { $tmptxt=$object->getLibStatut(6); - if (empty($tmptxt)) $tmptxt=$object->getLibStatut(5); + if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) $tmptxt=$object->getLibStatut(5); $morehtmlright.=$tmptxt; } if (! empty($object->name_alias)) $morehtmlref.='
'.$object->name_alias.'
'; // For thirdparty diff --git a/htdocs/core/tpl/resource_add.tpl.php b/htdocs/core/tpl/resource_add.tpl.php index 482dad50085..97cb933bcf7 100644 --- a/htdocs/core/tpl/resource_add.tpl.php +++ b/htdocs/core/tpl/resource_add.tpl.php @@ -6,7 +6,7 @@ require_once(DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php'); $form = new Form($db); $formresources = new FormResource($db); -$out .= '
'; +$out = '
'; $out .= ''; $out .= ''; diff --git a/htdocs/core/tpl/resource_view.tpl.php b/htdocs/core/tpl/resource_view.tpl.php index 7b2a6f43f4d..6f88d8bb5f8 100644 --- a/htdocs/core/tpl/resource_view.tpl.php +++ b/htdocs/core/tpl/resource_view.tpl.php @@ -96,8 +96,13 @@ if( (array) $linked_resources && count($linked_resources) > 0) } else { - print '
'.$langs->trans('NoResourceLinked').'
'; - + print '
'; + print '
'.$langs->trans('NoResourceLinked').'
'; + print '
'; + print '
'; + print '
'; + print '
'; + print '
'; } print '
'; diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index f8e9e052995..27451b07973 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -51,7 +51,7 @@ $hookmanager->initHooks(array('element_resource')); $object->available_resources = array('dolresource'); // Get parameters -$id = GETPOST('id','int'); +$id = GETPOST('id','int'); $action = GETPOST('action','alpha'); $mode = GETPOST('mode','alpha'); $lineid = GETPOST('lineid','int'); @@ -196,24 +196,105 @@ else dol_fiche_head($head, 'resources', $langs->trans("Action"),0,'action'); + $linkback =img_picto($langs->trans("BackToList"),'object_list','class="hideonsmartphone pictoactionview"'); + $linkback.= ''.$langs->trans("BackToList").''; + + // Link to other agenda views + $out=''; + $out.=img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"'); + $out.=''.$langs->trans("ViewPerUser").''; + $out.='
'; + $out.=img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"'); + $out.=''.$langs->trans("ViewCal").''; + $out.=img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"'); + $out.=''.$langs->trans("ViewWeek").''; + $out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"'); + $out.=''.$langs->trans("ViewDay").''; + + $linkback.=$out; + + dol_banner_tab($act, 'element_id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '', "&element=".$element); + + print '
'; + + // Ref + /*print '
';*/ + // Affichage fiche action en mode visu print '
'.$langs->trans('Margins').''.$langs->trans('SellingPrice').'
'.$langs->trans("Ref").''; + print $form->showrefnav($act, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', ''); + print '
'; - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - // Type if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { - print ''; + print ''; } - // Title - print ''; + // Full day event + print ''; + + // Date start + print ''; + print ''; + + // Date end + print ''; + + // Status + /*print '';*/ + + // Location + if (empty($conf->global->AGENDA_DISABLE_LOCATION)) + { + print ''; + } + + // Assigned to + print ''; + print '
'.$langs->trans("Ref").''; - print $form->showrefnav($act, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', ''); - print '
'.$langs->trans("Type").''.$act->type.'
'.$langs->trans("Type").''.$act->type.'
'.$langs->trans("Title").''.$act->label.'
'.$langs->trans("EventOnFullDay").''.yn($act->fulldayevent, 3).'
'.$langs->trans("DateActionStart").''; + if (! $act->fulldayevent) print dol_print_date($act->datep,'dayhour'); + else print dol_print_date($act->datep,'day'); + if ($act->percentage == 0 && $act->datep && $act->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late")); + print '
'.$langs->trans("DateActionEnd").''; + if (! $act->fulldayevent) print dol_print_date($act->datef,'dayhour'); + else print dol_print_date($act->datef,'day'); + if ($act->percentage > 0 && $act->percentage < 100 && $act->datef && $act->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late")); + print '
'.$langs->trans("Status").' / '.$langs->trans("Percentage").''; + print $act->getLibStatut(4); + print '
'.$langs->trans("Location").''.$act->location.'
'.$langs->trans("ActionAffectedTo").''; + $listofuserid=array(); + if (empty($donotclearsession)) + { + if ($act->userownerid > 0) $listofuserid[$act->userownerid]=array('id'=>$act->userownerid,'transparency'=>$act->transparency); // Owner first + if (! empty($act->userassigned)) // Now concat assigned users + { + // Restore array with key with same value than param 'id' + $tmplist1=$act->userassigned; $tmplist2=array(); + foreach($tmplist1 as $key => $val) + { + if ($val['id'] && $val['id'] != $act->userownerid) $listofuserid[$val['id']]=$val; + } + } + $_SESSION['assignedtouser']=json_encode($listofuserid); + } + else + { + if (!empty($_SESSION['assignedtouser'])) + { + $listofuserid=json_decode($_SESSION['assignedtouser'], true); + } + } + print '
'; + print $form->select_dolusers_forevent('view', 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); + print '
'; + if (in_array($user->id,array_keys($listofuserid))) + { + print '
'; + print $langs->trans("MyAvailability").': '.(($act->userassigned[$user->id]['transparency'] > 0)?$langs->trans("Busy"):$langs->trans("Available")); // We show nothing if event is assigned to nobody + print '
'; + } + print '
'; dol_fiche_end(); @@ -225,38 +306,37 @@ else */ if ($element_id && $element == 'societe') { - $socstatic = fetchObjectByElement($element_id,$element); - if (is_object($socstatic)) - { - $savobject = $object; - - $object = $socstatic; - - require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; - $head = societe_prepare_head($socstatic); - - dol_fiche_head($head, 'resources', $langs->trans("ThirdParty"),0,'company'); - - dol_banner_tab($socstatic, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); - + $socstatic = fetchObjectByElement($element_id, $element); + if (is_object($socstatic)) { + $savobject = $object; + + $object = $socstatic; + + require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; + $head = societe_prepare_head($socstatic); + + dol_fiche_head($head, 'resources', $langs->trans("ThirdParty"), 0, 'company'); + + dol_banner_tab($socstatic, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom'); + print '
'; - - print '
'; + + print '
'; print ''; - + // Alias name (commercial, trademark or alias name) - print '"; - - print '
'.$langs->trans('AliasNames').''; + print '
' . $langs->trans('AliasNames') . ''; print $socstatic->name_alias; print "
'; - - print '
'; - - dol_fiche_end(); - - $object = $savobject; - } + + print ''; + + print '
'; + + dol_fiche_end(); + + $object = $savobject; + } } /* @@ -303,13 +383,13 @@ else if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - //print load_fiche_titre($langs->trans('ResourcesLinkedToElement'),'',''); - - + //print load_fiche_titre($langs->trans('ResourcesLinkedToElement'),'',''); + print '
'; + // Show list of resource links - foreach ($object->available_resources as $modresources => $resources) - { + foreach ($object->available_resources as $modresources => $resources) + { $resources=(array) $resources; // To be sure $resources is an array foreach($resources as $resource_obj) { @@ -327,13 +407,12 @@ else // If we have a specific template we use it if(file_exists(dol_buildpath($path.'/core/tpl/resource_'.$element_prop['element'].'_add.tpl.php'))) { - $res=include dol_buildpath($path.'/core/tpl/resource_'.$element_prop['element'].'_add.tpl.php'); + $res=include dol_buildpath($path.'/core/tpl/resource_'.$element_prop['element'].'_add.tpl.php'); } else { - $res=include DOL_DOCUMENT_ROOT . '/core/tpl/resource_add.tpl.php'; + $res=include DOL_DOCUMENT_ROOT . '/core/tpl/resource_add.tpl.php'; } - //var_dump($element_id); if ($mode != 'add' || $resource_obj != $resource_type) { diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index e8692055b31..1d860f5f378 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2452,6 +2452,9 @@ div.refidno { font-size: px; line-height: 21px; } +div.refidno form { + display: inline-block; +} div.pagination { float: right; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 3b8c7f38097..1db2b6fe7a3 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2342,6 +2342,9 @@ div.refidno { font-size: px; line-height: 21px; } +div.refidno form { + display: inline-block; +} div.pagination { float: right; From 5602bcd44005077b387a9fd5dd2a674cdfa12cd0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Sep 2016 13:09:50 +0200 Subject: [PATCH 32/37] NEW Add status Done on interventions --- htdocs/fichinter/card.php | 144 +++++++++++++++++---- htdocs/fichinter/class/fichinter.class.php | 23 ++-- htdocs/fichinter/list.php | 1 + 3 files changed, 128 insertions(+), 40 deletions(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index a2e43570545..b8b9b4fe6a6 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -34,13 +34,11 @@ require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/fichinter/modules_fichinter.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } - if ($conf->contrat->enabled) { require_once DOL_DOCUMENT_ROOT."/core/class/html.formcontract.class.php"; @@ -612,6 +610,21 @@ if (empty($reshook)) } } + // Classify Billed + else if ($action == 'classifydone' && $user->rights->ficheinter->creer) + { + $result=$object->setStatut(3); + if ($result > 0) + { + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + /* * Mise a jour d'une ligne d'intervention */ @@ -842,8 +855,8 @@ if (empty($reshook)) $form = new Form($db); $formfile = new FormFile($db); -if ($conf->contrat->enabled) - $formcontract = new FormContract($db); +if ($conf->contrat->enabled) $formcontract = new FormContract($db); +if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } llxHeader('',$langs->trans("Intervention")); @@ -1090,7 +1103,7 @@ else if ($id > 0 || ! empty($ref)) { /* * Affichage en mode visu - */ + */ $object->fetch($id, $ref); $object->fetch_thirdparty(); @@ -1172,59 +1185,104 @@ else if ($id > 0 || ! empty($ref)) // Print form confirm print $formconfirm; - print ''; - + + // Intervention card $linkback = ''.$langs->trans("BackToList").''; - + + + $morehtmlref='
'; + // Ref customer + //$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1); + //$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->commande->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + + print '
'; + // Ref + /* print ''; // Third party print ""; - - if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) - { - // Duration - print ''; - print ''; - print ''; - } - + */ + if (! empty($conf->global->FICHINTER_USE_PLANNED_AND_DONE_DATES)) { // Date Start - print ''; - print ''; + print ''; print ''; // Date End print ''; - print ''; print ''; // Date Terminate/close print ''; - print ''; print ''; } // Description (must be a textarea and not html must be allowed (used in list view) - print ''; print ''; // Project + /* if (! empty($conf->projet->enabled)) { $langs->load('projects'); @@ -1252,7 +1310,7 @@ else if ($id > 0 || ! empty($ref)) } print ''; print ''; - } + }*/ // Contrat if ($conf->contrat->enabled) @@ -1271,7 +1329,7 @@ else if ($id > 0 || ! empty($ref)) print ''; } print '
'.$langs->trans("Ref").''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); print '
".$langs->trans("Company").''.$object->thirdparty->getNomUrl(1)."
'.$langs->trans("TotalDuration").''.convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'
'.$langs->trans("Dateo").''; + print '
'.$langs->trans("Dateo").''; print $object->dateo ? dol_print_date($object->dateo, 'daytext') : ' '; print '
'.$langs->trans("Datee").''; + print ''; print $object->datee ? dol_print_date($object->datee, 'daytext') : ' '; print '
'.$langs->trans("Datet").''; + print ''; print $object->datet ? dol_print_date($object->datet, 'daytext') : ' '; print '
'; + print '
'; print $form->editfieldkey("Description",'description',$object->description,$object,$user->rights->ficheinter->creer,'textarea'); - print ''; + print ''; print $form->editfieldval("Description",'description',$object->description,$object,$user->rights->ficheinter->creer,'textarea:8:80'); print '
'; - print ''; + print ''; if ($action == 'contrat') { $formcontract= new Formcontract($db); @@ -1296,13 +1354,37 @@ else if ($id > 0 || ! empty($ref)) } // Statut - print ''.$langs->trans("Status").''.$object->getLibStatut(4).''; + //print ''.$langs->trans("Status").''.$object->getLibStatut(4).''; // Other attributes - $cols = 3; + $cols = 2; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + print ''; + + print '
'; + print '
'; + print '
'; + print '
'; + + print ''; + + if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) + { + // Duration + print ''; + print ''; + print ''; + } + print "
'.$langs->trans("TotalDuration").''.convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'
"; + + print '
'; + print '
'; + print '
'; + + print '

'; + if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { @@ -1635,7 +1717,7 @@ else if ($id > 0 || ! empty($ref)) else print ''; } - if (! empty($conf->global->FICHINTER_CLASSIFY_BILLED)) + if (! empty($conf->global->FICHINTER_CLASSIFY_BILLED)) // Option deprecated. In a future, billed must be managed with a dedicated field to 0 or 1 { if ($object->statut != 2) { @@ -1648,6 +1730,12 @@ else if ($id > 0 || ! empty($ref)) } } + // Done + if (empty($conf->global->FICHINTER_CLASSIFY_BILLED) && $object->statut > 0 && $object->statut < 3) + { + print ''; + } + // Clone if ($user->rights->ficheinter->creer) { print ''; diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 54d5dc05c33..acbc6b24083 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -38,7 +38,8 @@ class Fichinter extends CommonObject public $table_element='fichinter'; public $fk_element='fk_fichinter'; public $table_element_line='fichinterdet'; - + public $picto = 'intervention'; + /** * {@inheritdoc} */ @@ -78,15 +79,15 @@ class Fichinter extends CommonObject $this->statuts[0]='Draft'; $this->statuts[1]='Validated'; $this->statuts[2]='StatusInterInvoiced'; - $this->statuts[3]='Close'; + $this->statuts[3]='Done'; $this->statuts_short[0]='Draft'; $this->statuts_short[1]='Validated'; $this->statuts_short[2]='StatusInterInvoiced'; - $this->statuts_short[3]='Close'; + $this->statuts_short[3]='Done'; $this->statuts_logo[0]='statut0'; $this->statuts_logo[1]='statut1'; $this->statuts_logo[2]='statut6'; - $this->statuts_logo[3]='statut4'; + $this->statuts_logo[3]='statut6'; } /** @@ -552,7 +553,7 @@ class Fichinter extends CommonObject * Returns the label of a statut * * @param int $statut id statut - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ function LibStatut($statut,$mode=0) @@ -561,22 +562,20 @@ class Fichinter extends CommonObject if ($mode == 0) return $langs->trans($this->statuts[$statut]); - if ($mode == 1) return $langs->trans($this->statuts_short[$statut]); - if ($mode == 2) return img_picto($langs->trans($this->statuts_short[$statut]), $this->statuts_logo[$statut]).' '.$langs->trans($this->statuts_short[$statut]); - if ($mode == 3) return img_picto($langs->trans($this->statuts_short[$statut]), $this->statuts_logo[$statut]); - if ($mode == 4) return img_picto($langs->trans($this->statuts_short[$statut]),$this->statuts_logo[$statut]).' '.$langs->trans($this->statuts[$statut]); - if ($mode == 5) - return ''.$langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),$this->statuts_logo[$statut]); - + return ''.$langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),$this->statuts_logo[$statut]); + if ($mode == 6) + return ''.$langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),$this->statuts_logo[$statut]); + + return ''; } /** diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 3118bb819cf..86d9902954c 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -356,6 +356,7 @@ if ($result) { print ''; $liststatus=$objectstatic->statuts_short; + if (empty($conf->global->FICHINTER_CLASSIFY_BILLED)) unset($liststatus[2]); // Option deprecated. In a future, billed must be managed with a dedicated field to 0 or 1 print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 1); print ''; } From 079ed8811963945ea8df2d8572121603c51dfa17 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Sep 2016 13:57:18 +0200 Subject: [PATCH 33/37] Fix missing css --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 152cc0502dd..ce0458dead4 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1125,7 +1125,7 @@ class Form $resql=$this->db->query($sql); if ($resql) { - print ''; $num = $this->db->num_rows($resql); $qualifiedlines=$num; From 4f842fd2cb38e802f52e99701e1ac02b82eb3685 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Sep 2016 13:57:50 +0200 Subject: [PATCH 34/37] Uniformize look and feel --- htdocs/comm/propal/card.php | 76 ++++----- htdocs/commande/card.php | 53 +++--- htdocs/commande/class/commande.class.php | 1 - htdocs/compta/facture/class/facture.class.php | 3 +- htdocs/core/class/commonobject.class.php | 1 + htdocs/core/class/html.form.class.php | 32 ++-- htdocs/expedition/card.php | 131 ++++++++++++--- htdocs/expedition/class/expedition.class.php | 3 +- .../class/fournisseur.commande.class.php | 3 +- .../fourn/class/fournisseur.facture.class.php | 3 +- htdocs/fourn/commande/card.php | 158 +++++++++++++----- htdocs/product/stock/card.php | 141 ++++++++++++---- htdocs/product/stock/class/entrepot.class.php | 1 + htdocs/supplier_proposal/card.php | 124 ++++++++++---- .../class/supplier_proposal.class.php | 3 +- 15 files changed, 506 insertions(+), 227 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index b0ea8a9f4ba..379cca8c9b8 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -245,9 +245,13 @@ if (empty($reshook)) } // Positionne ref client - else if ($action == 'set_ref_client' && $user->rights->propal->creer) + else if ($action == 'setref_client' && $user->rights->propal->creer) { - $object->set_ref_client($user, $_POST['ref_client']); + $result = $object->set_ref_client($user, GETPOST('ref_client')); + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + } } // Set incoterm @@ -1667,28 +1671,11 @@ if ($action == 'create') $morehtmlref='
'; - // Ref customer - $morehtmlref.=$langs->trans('RefCustomer').' '; - if ($action != 'refclient' && ! empty($object->brouillon)) - { - $morehtmlref.='' . img_edit($langs->trans('Modify')) . ' '; - } - $morehtmlref.=' : '; - if ($user->rights->propal->creer && $action == 'refclient') { - $morehtmlref.='
'; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=' '; - $morehtmlref.='
'; - } else { - $morehtmlref.=$object->ref_client; - } - + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->propal->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->propal->creer, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref.='
'.$langs->trans('Company') . ' : ' . $soc->getNomUrl(1); - + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); // Project if (! empty($conf->projet->enabled)) { @@ -1721,7 +1708,6 @@ if ($action == 'create') } } } - $morehtmlref.='
'; @@ -1770,7 +1756,7 @@ if ($action == 'create') print '';*/ // Lin for thirdparty discounts - print '' . $langs->trans('Discounts') . ''; + print '' . $langs->trans('Discounts') . ''; if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent); else @@ -1806,7 +1792,7 @@ if ($action == 'create') if ($action != 'editdate' && ! empty($object->brouillon)) print 'id . '">' . img_edit($langs->trans('SetDate'), 1) . ''; print ''; - print ''; + print ''; if (! empty($object->brouillon) && $action == 'editdate') { print '
'; print ''; @@ -1832,7 +1818,7 @@ if ($action == 'create') if ($action != 'editecheance' && ! empty($object->brouillon)) print 'id . '">' . img_edit($langs->trans('SetConditions'), 1) . ''; print ''; - print ''; + print ''; if (! empty($object->brouillon) && $action == 'editecheance') { print ''; print ''; @@ -1860,7 +1846,7 @@ if ($action == 'create') if ($action != 'editconditions' && ! empty($object->brouillon)) print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetConditions'), 1) . ''; print ''; - print ''; + print ''; if ($action == 'editconditions') { $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id'); } else { @@ -1873,7 +1859,7 @@ if ($action == 'create') $langs->load('deliveries'); print ''; print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $user->rights->propal->creer, 'datepicker'); - print ''; + print ''; print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $user->rights->propal->creer, 'datepicker'); print ''; print ''; @@ -1888,7 +1874,7 @@ if ($action == 'create') if ($action != 'editavailability' && ! empty($object->brouillon)) print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1) . ''; print ''; - print ''; + print ''; if ($action == 'editavailability') { $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'availability_id', 1); } else { @@ -1907,7 +1893,7 @@ if ($action == 'create') if ($action != 'editshippingmethod' && $user->rights->propal->creer) print 'id.'">'.img_edit($langs->trans('SetShippingMode'),1).''; print ''; - print ''; + print ''; if ($action == 'editshippingmethod') { $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1); } else { @@ -1925,7 +1911,7 @@ if ($action == 'create') if ($action != 'editdemandreason' && ! empty($object->brouillon)) print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1) . ''; print ''; - print ''; + print ''; if ($action == 'editdemandreason') { $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1); } else { @@ -1943,7 +1929,7 @@ if ($action == 'create') if ($action != 'editmode' && ! empty($object->brouillon)) print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMode'), 1) . ''; print ''; - print ''; + print ''; if ($action == 'editmode') { $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id'); } else { @@ -1963,7 +1949,7 @@ if ($action == 'create') if ($action != 'editmulticurrencycode' && ! empty($object->brouillon)) print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . ''; print ''; - print ''; + print ''; if ($action == 'editmulticurrencycode') { $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'multicurrency_code'); } else { @@ -1980,7 +1966,7 @@ if ($action == 'create') if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . ''; print ''; - print ''; + print ''; if ($action == 'editmulticurrencyrate') { $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { @@ -2031,7 +2017,7 @@ if ($action == 'create') // Outstanding Bill print ''; print $langs->trans('OutstandingBill'); - print ''; + print ''; print price($soc->get_OutstandingBill()) . ' / '; print price($soc->outstanding_limit, 0, $langs, 1, - 1, - 1, $conf->currency); print ''; @@ -2048,7 +2034,7 @@ if ($action == 'create') if ($action != 'editbankaccount' && $user->rights->propal->creer) print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).''; print ''; - print ''; + print ''; if ($action == 'editbankaccount') { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); } else { @@ -2069,7 +2055,7 @@ if ($action == 'create') else print ' '; print ''; print ''; - print ''; + print ''; if ($action != 'editincoterm') { print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); @@ -2095,48 +2081,48 @@ if ($action == 'create') print ''; // Amount HT - print ''; + print ''; print ''; print ''; // Amount VAT - print ''; + print ''; print ''; print ''; // Amount Local Taxes if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1 { - print ''; + print ''; print ''; print ''; } if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2 { - print ''; + print ''; print ''; print ''; } // Amount TTC - print ''; + print ''; print ''; print ''; if (!empty($conf->multicurrency->enabled)) { // Multicurrency Amount HT - print ''; + print ''; print ''; print ''; // Multicurrency Amount VAT - print ''; + print ''; print ''; print ''; // Multicurrency Amount TTC - print ''; + print ''; print ''; print ''; } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 7431ee9ca79..bc59eff4079 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -474,19 +474,26 @@ if (empty($reshook)) else if ($action == 'classifyunbilled' && $user->rights->commande->creer) { $ret=$object->classifyUnBilled(); - if ($ret < 0) { setEventMessages($object->error, $object->errors, 'errors'); } } // Positionne ref commande client - else if ($action == 'set_ref_client' && $user->rights->commande->creer) { - $object->set_ref_client($user, GETPOST('ref_client')); + else if ($action == 'setref_client' && $user->rights->commande->creer) { + $result = $object->set_ref_client($user, GETPOST('ref_client')); + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + } } else if ($action == 'setremise' && $user->rights->commande->creer) { - $object->set_remise($user, GETPOST('remise')); + $result = $object->set_remise($user, GETPOST('remise')); + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + } } else if ($action == 'setabsolutediscount' && $user->rights->commande->creer) { @@ -1917,28 +1924,11 @@ if ($action == 'create' && $user->rights->commande->creer) $morehtmlref='
'; - // Ref customer - $morehtmlref.=$langs->trans('RefCustomer').' '; - if ($action != 'refclient' && ! empty($object->brouillon)) - { - $morehtmlref.='' . img_edit($langs->trans('Modify')) . ' '; - } - $morehtmlref.=' : '; - if ($user->rights->commande->creer && $action == 'refclient') { - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=' '; - $morehtmlref.=''; - } else { - $morehtmlref.=$object->ref_client; - } - + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref.='
'.$langs->trans('Company') . ' : ' . $soc->getNomUrl(1); - + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); // Project if (! empty($conf->projet->enabled)) { @@ -1971,7 +1961,6 @@ if ($action == 'create' && $user->rights->commande->creer) } } } - $morehtmlref.='
'; @@ -2286,10 +2275,12 @@ if ($action == 'create' && $user->rights->commande->creer) $totalVolume=$tmparray['volume']; if ($totalWeight || $totalVolume) { - print ''; + print ''; print ''; + print ''; + print ''; } @@ -2376,7 +2367,7 @@ if ($action == 'create' && $user->rights->commande->creer) print '
' . $langs->trans('AmountHT') . '
' . $langs->trans('AmountHT') . '' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->trans('AmountVAT') . '
' . $langs->trans('AmountVAT') . '' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($object->total_localtax1, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->trans('AmountTTC') . '
' . $langs->trans('AmountTTC') . '' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
'.$langs->trans("CalculatedWeight").' / '.$langs->trans("CalculatedVolume").'
'.$langs->trans("CalculatedWeight").''; print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no'); - print ' / '; + print '
'.$langs->trans("CalculatedVolume").''; print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no'); print '
'; // Total HT - print ''; + print ''; print ''; // Total VAT @@ -2400,17 +2391,17 @@ if ($action == 'create' && $user->rights->commande->creer) if (!empty($conf->multicurrency->enabled)) { // Multicurrency Amount HT - print ''; + print ''; print ''; print ''; // Multicurrency Amount VAT - print ''; + print ''; print ''; print ''; // Multicurrency Amount TTC - print ''; + print ''; print ''; print ''; } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index f30318d2fb8..108fcf90d84 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2558,7 +2558,6 @@ class Commande extends CommonOrder if ($result < 0) $error++; // End call triggers } - if (! $error) { $this->db->commit(); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index a0cd4de90e8..32e6ca242ca 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -53,7 +53,8 @@ class Facture extends CommonInvoice public $table_element_line = 'facturedet'; public $fk_element = 'fk_facture'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - + public $picto='bill'; + /** * {@inheritdoc} */ diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8f1e40db48f..5731ba7c63d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2780,6 +2780,7 @@ abstract class CommonObject $trigkey=''; if ($this->element == 'supplier_proposal' && $status == 2) $trigkey='SUPPLIER_PROPOSAL_CLOSE'; + if ($this->element == 'fichinter' && $status == 3) $trigkey='FICHINTER_CLASSIFY_DONE'; if ($this->element == 'fichinter' && $status == 2) $trigkey='FICHINTER_CLASSIFY_BILLED'; if ($this->element == 'fichinter' && $status == 1) $trigkey='FICHINTER_CLASSIFY_UNBILLED'; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c8ae8dd8b6b..da198027936 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -79,10 +79,11 @@ class Form * @param boolean $perm Permission to allow button to edit parameter. Set it to 0 to have a not edited field. * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...) * @param string $moreparam More param to add on a href URL* - * @param int $fieldrequired 1 if we want to show field as mandatory using the fieldrequired CSS. + * @param int $fieldrequired 1 if we want to show field as mandatory using the "fieldrequired" CSS. + * @param int $notabletag Do no output table tags * @return string HTML edit field */ - function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata='string', $moreparam='', $fieldrequired=0) + function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata='string', $moreparam='', $fieldrequired=0, $notabletag=0) { global $conf,$langs; @@ -109,13 +110,17 @@ class Form } else { - if (GETPOST('action') != 'edit'.$htmlname && $perm) $ret.='
' . $langs->trans('AmountHT') . '
' . $langs->trans('AmountHT') . '' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
'; + if (empty($notabletag) && GETPOST('action') != 'edit'.$htmlname && $perm) $ret.=''; + if (empty($notabletag) && GETPOST('action') != 'edit'.$htmlname && $perm) $ret.='
'; + if (empty($notabletag) && GETPOST('action') != 'edit'.$htmlname && $perm) $ret.=''; - if (GETPOST('action') != 'edit'.$htmlname && $perm) $ret.=''; - if (GETPOST('action') != 'edit'.$htmlname && $perm) $ret.='
'; if ($fieldrequired) $ret.=''; $ret.=$langs->trans($text); if ($fieldrequired) $ret.=''; - if (GETPOST('action') != 'edit'.$htmlname && $perm) $ret.='id.$moreparam.'">'.img_edit($langs->trans('Edit'),1).'
'; + if (! empty($notabletag)) $ret.=' '; + if (empty($notabletag) && GETPOST('action') != 'edit'.$htmlname && $perm) $ret.='
'; + if ($htmlname && GETPOST('action') != 'edit'.$htmlname && $perm) $ret.='id.$moreparam.'">'.img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)).''; + if (! empty($notabletag)) $ret.=' : '; + if (empty($notabletag) && GETPOST('action') != 'edit'.$htmlname && $perm) $ret.='
'; } return $ret; @@ -134,9 +139,10 @@ class Form * @param object $extObject External object * @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage') * @param string $moreparam More param to add on a href URL + * @param int $notabletag Do no output table tags * @return string HTML edit field */ - function editfieldval($text, $htmlname, $value, $object, $perm, $typeofdata='string', $editvalue='', $extObject=null, $custommsg=null, $moreparam='') + function editfieldval($text, $htmlname, $value, $object, $perm, $typeofdata='string', $editvalue='', $extObject=null, $custommsg=null, $moreparam='', $notabletag=0) { global $conf,$langs,$db; @@ -159,8 +165,8 @@ class Form $ret.=''; $ret.=''; $ret.=''; - $ret.=''; - $ret.='
'; + if (empty($notabletag)) $ret.=''; + if (empty($notabletag)) $ret.=''; + if (empty($notabletag)) $ret.=''; - $ret.=''; + if (empty($notabletag)) $ret.=''; - $ret.='
'; if (preg_match('/^(string|email)/',$typeofdata)) { $tmp=explode(':',$typeofdata); @@ -202,15 +208,15 @@ class Form $doleditor=new DolEditor($htmlname, ($editvalue?$editvalue:$value), ($tmp[2]?$tmp[2]:''), ($tmp[3]?$tmp[3]:'100'), ($tmp[1]?$tmp[1]:'dolibarr_notes'), 'In', ($tmp[5]?$tmp[5]:0), true, true, ($tmp[6]?$tmp[6]:'20'), ($tmp[7]?$tmp[7]:'100')); $ret.=$doleditor->Create(1); } - $ret.=''; + if (empty($notabletag)) $ret.=''; $ret.=''; if (preg_match('/ckeditor|textarea/',$typeofdata)) $ret.='
'."\n"; $ret.=''; - $ret.='
'."\n"; + if (empty($notabletag)) $ret.='
'."\n"; $ret.=''."\n"; } else diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 0fd78495ddd..53bd4f469f0 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2013 Laurent Destailleur + * Copyright (C) 2005-2016 Laurent Destailleur * Copyright (C) 2005 Simon TOSSER * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent @@ -39,12 +39,16 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/expedition/modules_expedition.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; if (! empty($conf->stock->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; if (! empty($conf->productbatch->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php'; +if (! empty($conf->projet->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; +} $langs->load("sendings"); $langs->load("companies"); @@ -562,6 +566,7 @@ $form = new Form($db); $formfile = new FormFile($db); $formproduct = new FormProduct($db); $product_static = new Product($db); +if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } if ($action == 'create2') { @@ -1224,18 +1229,19 @@ else if ($id || $ref) $head=shipping_prepare_head($object); dol_fiche_head($head, 'shipping', $langs->trans("Shipment"), 0, 'sending'); + $formconfirm=''; + /* * Confirmation de la suppression */ if ($action == 'delete') { - print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('DeleteSending'),$langs->trans("ConfirmDeleteSending",$object->ref),'confirm_delete','',0,1); - + $formconfirm=$form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('DeleteSending'),$langs->trans("ConfirmDeleteSending",$object->ref),'confirm_delete','',0,1); } /* * Confirmation de la validation - */ + */ if ($action == 'valid') { $objectref = substr($object->ref, 1, 4); @@ -1258,7 +1264,7 @@ else if ($id || $ref) $text.=$notify->confirmMessage('SHIPPING_VALIDATE',$object->socid, $object); } - print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('ValidateSending'),$text,'confirm_valid','',0,1); + $formconfirm=$form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('ValidateSending'),$text,'confirm_valid','',0,1); } /* @@ -1266,10 +1272,20 @@ else if ($id || $ref) */ if ($action == 'annuler') { - print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('CancelSending'),$langs->trans("ConfirmCancelSending",$object->ref),'confirm_cancel','',0,1); + $formconfirm=$form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('CancelSending'),$langs->trans("ConfirmCancelSending",$object->ref),'confirm_cancel','',0,1); } + if (! $formconfirm) { + $parameters = array(); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; + } + + // Print form confirm + print $formconfirm; + // Calculate totalWeight and totalVolume for all products // by adding weight and volume of each product line. @@ -1277,11 +1293,62 @@ else if ($id || $ref) $totalWeight=$tmparray['weight']; $totalVolume=$tmparray['volume']; + + // Warehouse card + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + // Ref customer shipment + $morehtmlref.=$form->editfieldkey("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + /* + if (! empty($conf->projet->enabled)) { + $langs->load("projects"); + $morehtmlref .= '
' . $langs->trans('Project') . ' '; + if ($user->rights->supplier_proposal->creer) { + if ($action != 'classify') { + $morehtmlref .= '' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + } + if ($action == 'classify') { + // $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref .= '
'; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref .= ''; + $morehtmlref .= '
'; + } else { + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= ''; + $morehtmlref .= $proj->ref; + $morehtmlref .= ''; + } else { + $morehtmlref .= ''; + } + } + }*/ + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + print ''; - $linkback = ''.$langs->trans("BackToList").''; - // Ref + /* print ''; print ''; print ''; - print ""; + print "";*/ // Linked documents if ($typeobject == 'commande' && $object->$typeobject->id && ! empty($conf->commande->enabled)) @@ -1316,13 +1383,8 @@ else if ($id || $ref) print ''; } - // Ref customer - print ''; - print '\n"; - print ''; - // Date creation - print ''; + print ''; print '\n"; print ''; @@ -1455,9 +1517,22 @@ else if ($id || $ref) print ''; // Status - print ''; + /*print ''; print '\n"; - print ''; + print '';*/ + + // Other attributes + $cols = 2; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + + print '
'.$langs->trans("Ref").''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); @@ -1290,7 +1357,7 @@ else if ($id || $ref) // Customer print '
'.$langs->trans("Customer").''.$soc->getNomUrl(1).'
'.$langs->trans("RefCustomer").''.$object->ref_customer."
'.$langs->trans("DateCreation").'
'.$langs->trans("DateCreation").''.dol_print_date($object->date_creation,"day")."
'.$langs->trans("Status").'
'.$langs->trans("Status").''.$object->getLibStatut(4)."
'; + + print '
'; + print '
'; + print '
'; + print '
'; + + print ''; // Sending method print ''; print ''; - + // Tracking Number - print ''; @@ -1519,11 +1594,14 @@ else if ($id || $ref) print ''; } - // Other attributes - $cols = 3; - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + print "
'; @@ -1490,9 +1565,9 @@ else if ($id || $ref) } print '
'.$form->editfieldkey("TrackingNumber",'trackingnumber',$object->tracking_number,$object,$user->rights->expedition->creer).''; + print '
'.$form->editfieldkey("TrackingNumber",'trackingnumber',$object->tracking_number,$object,$user->rights->expedition->creer).''; print $form->editfieldval("TrackingNumber",'trackingnumber',$object->tracking_url,$object,$user->rights->expedition->creer,'string',$object->tracking_number); print '
"; - print "\n"; + print '
'; + print '
'; + print '
'; + + print '
'; + /* * Lines of products @@ -1719,11 +1797,12 @@ else if ($id || $ref) $var=!$var; } + + print "\n"; } - print "\n"; - print "\n
\n"; + dol_fiche_end(); $object->fetchObjectLinked($object->id,$object->element); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index d6aa7f89b15..3341befe89a 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -48,7 +48,8 @@ class Expedition extends CommonObject public $table_element="expedition"; public $table_element_line="expeditiondet"; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - + public $picto = 'sending'; + var $socid; var $ref_customer; var $ref_int; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index ff2665ece46..a8a7c6e930f 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -44,7 +44,8 @@ class CommandeFournisseur extends CommonOrder public $table_element_line = 'commande_fournisseurdet'; public $fk_element = 'fk_commande'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - + public $picto='order'; + /** * {@inheritdoc} */ diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 8a814c492d0..4a9960d49a4 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -44,7 +44,8 @@ class FactureFournisseur extends CommonInvoice public $table_element_line='facture_fourn_det'; public $fk_element='fk_facture_fourn'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - + public $picto='bill'; + /** * {@inheritdoc} */ diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 3c710461b06..135aaebb706 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1311,6 +1311,7 @@ $form = new Form($db); $formfile = new FormFile($db); $formorder = new FormOrder($db); $productstatic = new Product($db); +if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } /* *************************************************************************** */ @@ -1739,50 +1740,96 @@ elseif (! empty($object->id)) // Print form confirm print $formconfirm; - /* - * Commande - */ - $nbrow=8; - if (! empty($conf->projet->enabled)) $nbrow++; - - //Local taxes - if($mysoc->localtax1_assuj=="1") $nbrow++; - if($mysoc->localtax2_assuj=="1") $nbrow++; - - print ''; + + // Supplier order card $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + // Ref supplier + $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->fournisseur->commande->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + + print '
'; // Ref + /* print ''; print ''; - print ''; + print '';*/ // Ref supplier + /* print ''; - + // Fournisseur print '"; print ''; print ''; - + */ + // Statut + /* print ''; print ''; print '"; + */ // Date if ($object->methode_commande_id > 0) { - print ''; + print ''; } } // Author - print ''; - print ''; + print ''; + print ''; print ''; // Conditions de reglement par defaut @@ -1808,7 +1855,7 @@ elseif (! empty($object->id)) print ''; print '
'.$langs->trans("Ref").''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); print '
'; print $form->editfieldkey("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->fournisseur->commande->creer); print ''; print $form->editfieldval("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->fournisseur->commande->creer); print '
'.$langs->trans("Supplier")."'.$object->thirdparty->getNomUrl(1,'supplier').'
'.$langs->trans("Status").''; print $object->getLibStatut(4); print "
'.$langs->trans("Date").''; + print '
'.$langs->trans("Date").''; if ($object->date_commande) { print dol_print_date($object->date_commande,"dayhourtext")."\n"; @@ -1791,13 +1838,13 @@ elseif (! empty($object->id)) if ($object->methode_commande) { - print '
'.$langs->trans("Method").''.$object->getInputMethod().'
'.$langs->trans("Method").''.$object->getInputMethod().'
'.$langs->trans("AuthorRequest").''.$author->getNomUrl(1).'
'.$langs->trans("AuthorRequest").''.$author->getNomUrl(1).'
'; if ($action != 'editconditions') print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; - print ''; + print ''; if ($action == 'editconditions') { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id,'cond_reglement_id'); @@ -1828,7 +1875,7 @@ elseif (! empty($object->id)) print ''; if ($action != 'editmode') print 'id.'">'.img_edit($langs->trans('SetMode'),1).''; print ''; - print ''; + print ''; if ($action == 'editmode') { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'mode_reglement_id'); @@ -1844,14 +1891,14 @@ elseif (! empty($object->id)) { // Multicurrency code print ''; - print ''; + print ''; print ''; if ($action != 'editmulticurrencycode' && ! empty($object->brouillon)) print ''; print '
'; print fieldLabel('Currency','multicurrency_code'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; - print ''; + print ''; if ($action == 'editmulticurrencycode') { $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'multicurrency_code'); } else { @@ -1861,14 +1908,14 @@ elseif (! empty($object->id)) // Multicurrency rate print ''; - print ''; + print ''; print ''; if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) print ''; print '
'; print fieldLabel('CurrencyRate','multicurrency_tx'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; - print ''; + print ''; if ($action == 'editmulticurrencyrate') { $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); } else { @@ -1887,7 +1934,7 @@ elseif (! empty($object->id)) if ($action != 'editbankaccount' && $user->rights->fournisseur->commande->creer) print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).''; print ''; - print ''; + print ''; if ($action == 'editbankaccount') { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); } else { @@ -1904,7 +1951,7 @@ elseif (! empty($object->id)) print ''; if ($action != 'editdate_livraison') print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).''; print ''; - print ''; + print ''; if ($action == 'editdate_livraison') { print '
'; @@ -1927,7 +1974,6 @@ elseif (! empty($object->id)) } print ''; - // Delivery delay (in days) print ''; print ''.$langs->trans('NbDaysToDelivery').' '.img_picto($langs->trans('DescNbDaysToDelivery'), 'info', 'style="cursor:help"').''; @@ -1935,6 +1981,7 @@ elseif (! empty($object->id)) print ''; // Project + /* if (! empty($conf->projet->enabled)) { $langs->load('projects'); @@ -1944,7 +1991,7 @@ elseif (! empty($object->id)) print ''; if ($action != 'classify') print ''.img_edit($langs->trans('SetProject')).''; print ''; - print ''; + print ''; //print "$object->id, $object->socid, $object->fk_project"; if ($action == 'classify') { @@ -1956,7 +2003,7 @@ elseif (! empty($object->id)) } print ''; print ''; - } + }*/ // Incoterms if (!empty($conf->incoterm->enabled)) @@ -1969,7 +2016,7 @@ elseif (! empty($object->id)) else print ' '; print ''; print ''; - print ''; + print ''; if ($action != 'editincoterm') { print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); @@ -1982,56 +2029,77 @@ elseif (! empty($object->id)) } // Other attributes - $cols = 3; + $cols = 2; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + print ''; + + print '
'; + print '
'; + print '
'; + print '
'; + + print ''; + // Total - print ''; - print ''; + print ''; + print ''; print ''; // Total VAT - print ''; + print ''; print ''; // Amount Local Taxes if ($mysoc->localtax1_assuj=="1" || $object->total_localtax1 != 0) //Localtax1 { print ''; - print ''; + print ''; print ''; } if ($mysoc->localtax2_assuj=="1" || $object->total_localtax2 != 0) //Localtax2 { print ''; - print ''; + print ''; print ''; } // Total TTC - print ''; + print ''; print ''; if (!empty($conf->multicurrency->enabled)) { // Multicurrency Amount HT - print ''; - print ''; + print ''; + print ''; print ''; // Multicurrency Amount VAT - print ''; - print ''; + print ''; + print ''; print ''; // Multicurrency Amount TTC - print ''; - print ''; + print ''; + print ''; print ''; } - print "
'.$langs->trans("AmountHT").''.price($object->total_ht,'',$langs,1,-1,-1,$conf->currency).'
'.$langs->trans("AmountHT").''.price($object->total_ht,'',$langs,1,-1,-1,$conf->currency).'
'.$langs->trans("AmountVAT").''.price($object->total_tva,'',$langs,1,-1,-1,$conf->currency).'
'.$langs->trans("AmountVAT").''.price($object->total_tva,'',$langs,1,-1,-1,$conf->currency).'
'.$langs->transcountry("AmountLT1",$mysoc->country_code).''.price($object->total_localtax1,'',$langs,1,-1,-1,$conf->currency).''.price($object->total_localtax1,'',$langs,1,-1,-1,$conf->currency).'
'.$langs->transcountry("AmountLT2",$mysoc->country_code).''.price($object->total_localtax2,'',$langs,1,-1,-1,$conf->currency).''.price($object->total_localtax2,'',$langs,1,-1,-1,$conf->currency).'
'.$langs->trans("AmountTTC").''.price($object->total_ttc,'',$langs,1,-1,-1,$conf->currency).'
'.$langs->trans("AmountTTC").''.price($object->total_ttc,'',$langs,1,-1,-1,$conf->currency).'
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '

"; - + print ''; + + // Margin Infos + /*if (! empty($conf->margin->enabled)) { + $formmargin->displayMarginInfos($object); + }*/ + + + print '
'; + print '
'; + print '
'; + + print '

'; + if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { $blocname = 'contacts'; diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index d9381af9b5e..1c5fd795d15 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -175,7 +175,7 @@ if ($action == 'create') { print load_fiche_titre($langs->trans("NewWarehouse")); - print "\n"; + print ''."\n"; print ''; print ''; print ''; @@ -263,66 +263,141 @@ else dol_fiche_head($head, 'card', $langs->trans("Warehouse"), 0, 'stock'); + $formconfirm = ''; + // Confirm delete third party if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("DeleteAWarehouse"),$langs->trans("ConfirmDeleteWarehouse",$object->libelle),"confirm_delete",'',0,2); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("DeleteAWarehouse"),$langs->trans("ConfirmDeleteWarehouse",$object->libelle),"confirm_delete",'',0,2); } - print ''; - + if (! $formconfirm) { + $parameters = array(); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; + } + + // Print form confirm + print $formconfirm; + + // Warehouse card $linkback = ''.$langs->trans("BackToList").''; + + + $morehtmlref='
'; + $morehtmlref.=$langs->trans("LocationSummary").' : '.$object->lieu; + /* + // Ref supplier + //$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1); + //$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', null, null, '', 1); + // Thirdparty + //$morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->supplier_proposal->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + }*/ + $morehtmlref.='
'; + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'libelle', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + + print '
'; + // Ref + /* print ''; + print '';*/ - print ''; + //print ''; // Description - print ''; + print ''; // Address - print ''; // Town - print ''; - print ''; + print ''; + print ''; // Country - print ''; + print '';*/ // Status - print ''; + //print ''; - $calcproductsunique=$object->nb_different_products(); + $calcproductsunique=$object->nb_different_products(); $calcproducts=$object->nb_products(); - - // Total nb of different products - print '"; - + + // Total nb of different products + print '"; + // Nb of products - print '"; - + + print '
'.$langs->trans("Ref").''; print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'libelle'); - print '
'.$langs->trans("LocationSummary").''.$object->lieu.'
'.$langs->trans("LocationSummary").''.$object->lieu.'
'.$langs->trans("Description").''.nl2br($object->description).'
'.$langs->trans("Description").''.nl2br($object->description).'
'.$langs->trans('Address').''; + /* + print '
'.$langs->trans('Address').''; print $object->address; print '
'.$langs->trans('Zip').''.$object->zip.''.$langs->trans('Town').''.$object->town.'
'.$langs->trans('Zip').''.$object->zip.'
'.$langs->trans('Town').''.$object->town.'
'.$langs->trans('Country').''; + print '
'.$langs->trans('Country').''; if (! empty($object->country_code)) { $img=picto_from_langcode($object->country_code); print ($img?$img.' ':''); } print $object->country; - print '
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("NumberOfDifferentProducts").''; - print empty($calcproductsunique['nb'])?'0':$calcproductsunique['nb']; - print "
'.$langs->trans("NumberOfDifferentProducts").''; + print empty($calcproductsunique['nb'])?'0':$calcproductsunique['nb']; + print "
'.$langs->trans("NumberOfProducts").''; + print '
'.$langs->trans("NumberOfProducts").''; print empty($calcproducts['nb'])?'0':$calcproducts['nb']; print "
'; + + print '
'; + print '
'; + print '
'; + print '
'; + + print ''; + // Value - print '"; - + // Last movement $sql = "SELECT max(m.datem) as datem"; $sql .= " FROM ".MAIN_DB_PREFIX."stock_mouvement as m"; @@ -330,14 +405,14 @@ else $resqlbis = $db->query($sql); if ($resqlbis) { - $obj = $db->fetch_object($resqlbis); - $lastmovementdate=$db->jdate($obj->datem); + $obj = $db->fetch_object($resqlbis); + $lastmovementdate=$db->jdate($obj->datem); } else { - dol_print_error($db); + dol_print_error($db); } - print '"; - + print "
'.$langs->trans("EstimatedStockValueShort").''; + print '
'.$langs->trans("EstimatedStockValueShort").''; print price((empty($calcproducts['value'])?'0':price2num($calcproducts['value'],'MT')), 0, $langs, 0, -1, -1, $conf->currency); print "
'.$langs->trans("LastMovement").''; + print '
'.$langs->trans("LastMovement").''; if ($lastmovementdate) { print dol_print_date($lastmovementdate,'dayhour').' '; @@ -345,13 +420,19 @@ else } else { - print $langs->trans("None"); + print $langs->trans("None"); } print "
"; print '
'; + print '
'; + print '
'; + + print '
'; + + dol_fiche_end(); /* ************************************************************************** */ diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index dce8620d182..d01d1709335 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -35,6 +35,7 @@ class Entrepot extends CommonObject { public $element='stock'; public $table_element='entrepot'; + public $picto='stock'; /** * Warehouse closed, inactive diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index a06cb497777..91a4ca81855 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -999,6 +999,7 @@ $formfile = new FormFile($db); $formsupplier_proposal = new FormSupplierProposal($db); $formmargin = new FormMargin($db); $companystatic = new Societe($db); +if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } $now = dol_now(); @@ -1353,11 +1354,63 @@ if ($action == 'create') // Print form confirm print $formconfirm; + + // Supplier proposal card + $linkback = '' . $langs->trans("BackToList") . ''; + + + $morehtmlref='
'; + // Ref supplier + //$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1); + //$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->supplier_proposal->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + print ''; - $linkback = '' . $langs->trans("BackToList") . ''; - // Ref + /* print ''; @@ -1365,9 +1418,10 @@ if ($action == 'create') // Company print ''; print ''; - + */ + // Payment term - print '
' . $langs->trans('Ref') . ''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); print '
' . $langs->trans('Supplier') . '' . $soc->getNomUrl(1) . '
'; + print '
'; print ''; @@ -1424,6 +1478,7 @@ if ($action == 'create') print ''; // Project + /* if (! empty($conf->projet->enabled)) { $langs->load("projects"); print ''; - } + }*/ // Multicurrency if (! empty($conf->multicurrency->enabled)) @@ -1529,73 +1584,80 @@ if ($action == 'create') // Other attributes $cols = 2; - if (empty($conf->margin->enabled)) $cols++; - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + print '
'; print $langs->trans('PaymentConditionsShort'); print '
'; @@ -1455,7 +1510,7 @@ if ($action == 'create') } } print '
'; + + print ''; + print '
'; + print '
'; + print '
'; + + print ''; + // Amount HT - print ''; - print ''; - - // Margin Infos - if (! empty($conf->margin->enabled)) { - $rowspan=4; - if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) $rowspan++; - if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) $rowspan++; - if (!empty($conf->multicurrency->enabled)) $rowspan+=3; - print ''; - } + print ''; + print ''; print ''; // Amount VAT - print ''; - print ''; + print ''; + print ''; print ''; // Amount Local Taxes if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1 { - print ''; - print ''; + print ''; + print ''; print ''; } if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2 { print ''; - print ''; + print ''; print ''; } // Amount TTC print ''; - print ''; + print ''; print ''; if (!empty($conf->multicurrency->enabled)) { // Multicurrency Amount HT print ''; - print ''; + print ''; print ''; // Multicurrency Amount VAT print ''; - print ''; + print ''; print ''; // Multicurrency Amount TTC print ''; - print ''; + print ''; print ''; } // Statut - print ''; + //print ''; - print '
' . $langs->trans('AmountHT') . '' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . ''; - $formmargin->displayMarginInfos($object); - print '
' . $langs->trans('AmountHT') . '' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->trans('AmountVAT') . '' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->trans('AmountVAT') . '' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($object->total_localtax1, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($object->total_localtax1, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, '', $langs, 0, - 1, - 1, $conf->currency) . '' . price($object->total_localtax2, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . $langs->trans('AmountTTC') . '' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . $langs->trans('Status') . '' . $object->getLibStatut(4) . '
' . $langs->trans('Status') . '' . $object->getLibStatut(4) . '

'; + print '
'; + + // Margin Infos + /*if (! empty($conf->margin->enabled)) { + $formmargin->displayMarginInfos($object); + }*/ + print '
'; + print '
'; + print '
'; + + print '

'; + if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { $blocname = 'contacts'; $title = $langs->trans('ContactsAddresses'); diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 09fa2dc69e9..14fbcb3110a 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -48,7 +48,8 @@ class SupplierProposal extends CommonObject public $table_element_line='supplier_proposaldet'; public $fk_element='fk_supplier_proposal'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - + public $picto='propal'; + /** * {@inheritdoc} */ From 10e9f4372b012ef40dfe6095b9cee1f62ecadcb7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Sep 2016 16:42:45 +0200 Subject: [PATCH 35/37] NEW Show total line (planned workload and time spent) on on list of tasks. --- htdocs/projet/tasks/list.php | 71 +++++++++++++++++++++++++++++++----- 1 file changed, 61 insertions(+), 10 deletions(-) diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 47083e9032d..dd97f0a7a15 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -545,7 +545,15 @@ if ($resql) print ''; - $i = 0; + $plannedworkloadoutputformat='allhourmin'; + $timespentoutputformat='allhourmin'; + if (! empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) $plannedworkloadoutputformat=$conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT; + if (! empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) $timespentoutputformat=$conf->global->PROJECT_TIME_SPENT_FORMAT; + + $now = dol_now(); + $i=0; + $var=true; + $totalarray=array(); while ($i < min($num,$limit)) { $obj = $db->fetch_object($resql); @@ -578,6 +586,7 @@ if ($resql) print $projectstatic->getNomUrl(1, 'task'); if ($projectstatic->hasDelay()) print img_warning("Late"); print ''; + if (! $i) $totalarray['nbfield']++; } // Title if (! empty($arrayfields['p.title']['checked'])) @@ -585,6 +594,7 @@ if ($resql) print ''; print dol_trunc($obj->projecttitle,80); print ''; + if (! $i) $totalarray['nbfield']++; } // Company if (! empty($arrayfields['s.nom']['checked'])) @@ -601,6 +611,7 @@ if ($resql) print ' '; } print ''; + if (! $i) $totalarray['nbfield']++; } // Status if (! empty($arrayfields['p.fk_statut']['checked'])) @@ -608,6 +619,7 @@ if ($resql) print ''; print $projectstatic->getLibStatut(1); print ''; + if (! $i) $totalarray['nbfield']++; } // Ref if (! empty($arrayfields['t.ref']['checked'])) @@ -616,6 +628,7 @@ if ($resql) print $taskstatic->getNomUrl(1,'withproject'); if ($taskstatic->hasDelay()) print img_warning("Late"); print ''; + if (! $i) $totalarray['nbfield']++; } // Label if (! empty($arrayfields['t.label']['checked'])) @@ -623,6 +636,7 @@ if ($resql) print ''; print $taskstatic->label; print ''; + if (! $i) $totalarray['nbfield']++; } // Date start if (! empty($arrayfields['t.dateo']['checked'])) @@ -630,20 +644,17 @@ if ($resql) print ''; print dol_print_date($db->jdate($obj->date_start),'day'); print ''; - } + if (! $i) $totalarray['nbfield']++; + } // Date end if (! empty($arrayfields['t.datee']['checked'])) { print ''; print dol_print_date($db->jdate($obj->date_end),'day'); print ''; + if (! $i) $totalarray['nbfield']++; } - $plannedworkloadoutputformat='allhourmin'; - $timespentoutputformat='allhourmin'; - if (! empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) $plannedworkloadoutputformat=$conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT; - if (! empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) $timespentoutputformat=$conf->global->PROJECT_TIME_SPENT_FORMAT; - // Planned workload if (! empty($arrayfields['t.planned_workload']['checked'])) { @@ -658,6 +669,9 @@ if ($resql) } //else print '--:--'; print ''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalplannedworkloadfield']=$totalarray['nbfield']; + $totalarray['totalplannedworkload'] += $obj->planned_workload; } // Time spent if (! empty($arrayfields['t.duration_effective']['checked'])) @@ -671,6 +685,9 @@ if ($resql) if ($showlineingray) print ''; else print ''; print ''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totaldurationeffectivefield']=$totalarray['nbfield']; + $totalarray['totaldurationeffective'] += $obj->duration_effective; } // Calculated progress if (! empty($arrayfields['t.progress_calculated']['checked'])) @@ -682,6 +699,7 @@ if ($resql) else print $langs->trans('WorkloadNotDefined'); } print ''; + if (! $i) $totalarray['nbfield']++; } // Declared progress if (! empty($arrayfields['t.progress']['checked'])) @@ -692,6 +710,7 @@ if ($resql) print $obj->progress.' %'; } print ''; + if (! $i) $totalarray['nbfield']++; } // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) @@ -707,6 +726,7 @@ if ($resql) $tmpkey='options_'.$key; print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); print ''; + if (! $i) $totalarray['nbfield']++; } } } @@ -720,6 +740,7 @@ if ($resql) print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); print ''; + if (! $i) $totalarray['nbfield']++; } // Date modification if (! empty($arrayfields['t.tms']['checked'])) @@ -727,6 +748,7 @@ if ($resql) print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour'); print ''; + if (! $i) $totalarray['nbfield']++; } // Status /*if (! empty($arrayfields['p.fk_statut']['checked'])) @@ -734,9 +756,17 @@ if ($resql) $projectstatic->statut = $obj->fk_statut; print ''.$projectstatic->getLibStatut(5).''; }*/ - // Action column - print ''; - + // Action column + print ''; + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + { + $selected=0; + if (in_array($obj->rowid, $arrayofselected)) $selected=1; + print ''; + } + print ''; + if (! $i) $totalarray['nbfield']++; + print "\n"; //print projectLinesa(); @@ -744,6 +774,27 @@ if ($resql) $i++; } + + // Show total line + if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['totalplannedworkloadfield'])) + { + print ''; + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if ($i == 1) + { + if ($num < $limit) print ''.$langs->trans("Total").''; + else print ''.$langs->trans("Totalforthispage").''; + } + elseif ($totalarray['totalplannedworkloadfield'] == $i) print ''.convertSecondToTime($totalarray['totalplannedworkload'],$plannedworkloadoutputformat).''; + elseif ($totalarray['totaldurationeffectivefield'] == $i) print ''.convertSecondToTime($totalarray['totaldurationeffective'],$timespentoutputformat).''; + else print ''; + } + print ''; + } + $db->free($resql); $parameters=array('sql' => $sql); From c2f4bc90abf38638d253d0032a081271a6b33cda Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Sep 2016 16:52:33 +0200 Subject: [PATCH 36/37] NEW Can sort on status reccurin invoice in list of template invoices. --- htdocs/compta/facture/fiche-rec.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 1dc9198051f..8ed4f7241ef 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -837,7 +837,7 @@ if ($action == 'create') { $result = $object->getLinesArray(); - print '
'; + print ''; print ''; print ''; print ''; @@ -1394,6 +1394,9 @@ else if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1); if ($search_montant_vat != '') $sql.= natural_search('f.tva', $search_montant_vat, 1); if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); + if ($search_frequency == '1') $sql.= ' AND f.frequency > 0'; + if ($search_frequency == '0') $sql.= ' AND (f.frequency IS NULL or f.frequency = 0)'; + if ($month > 0) { if ($year > 0 && empty($day)) @@ -1528,8 +1531,8 @@ else if (! empty($arrayfields['f.frequency']['checked'])) { // Amount - print ''; - //print ''; + print ''; + print $form->selectyesno('search_frequency', $search_frequency, 1, false, 1); print ''; } // Date invoice From ead3990171442bbd14bfd16e88c7c053d245f7cd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Sep 2016 17:40:40 +0200 Subject: [PATCH 37/37] Better size of filter --- htdocs/comm/propal/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 8ad2a4fbfcc..7441fb751b9 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -607,11 +607,11 @@ if ($resql) if (! empty($arrayfields['s.nom']['checked'])) { print ''; - print ''; + print ''; print ''; } if (! empty($arrayfields['s.town']['checked'])) print ''; - if (! empty($arrayfields['s.zip']['checked'])) print ''; + if (! empty($arrayfields['s.zip']['checked'])) print ''; // State if (! empty($arrayfields['state.nom']['checked'])) {