diff --git a/.tx/config b/.tx/config index c20f75769ae..d6e339462e3 100644 --- a/.tx/config +++ b/.tx/config @@ -260,6 +260,12 @@ source_file = htdocs/langs/en_US/propal.lang source_lang = en_US type = MOZILLAPROPERTIES +[dolibarr.resource] +file_filter = htdocs/langs//resource.lang +source_file = htdocs/langs/en_US/resource.lang +source_lang = en_US +type = MOZILLAPROPERTIES + [dolibarr.salaries] file_filter = htdocs/langs//salaries.lang source_file = htdocs/langs/en_US/salaries.lang diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index 05d6a0b4843..6f3b306af72 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -136,9 +136,11 @@ if ($action == 'create') print '
'."\n"; print ''; print ''; - + print_fiche_titre($langs->trans("NewBookmark")); + dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark'); + print ''; print ''; @@ -159,8 +161,10 @@ if ($action == 'create') print 'position).'">'; print ''; - print '
'.$langs->trans("BookmarkTitle").''.$langs->trans("SetHereATitleForLink").'
 

'; - + print ''; + + dol_fiche_end(); + print '
'; print '   '; print ''; @@ -186,8 +190,6 @@ if ($id > 0 && ! preg_match('/^add/i',$action)) ) ); - dol_fiche_head($head, 'card', $langs->trans("Bookmark"),0,'bookmark'); - if ($action == 'edit') { print ''; @@ -198,6 +200,8 @@ if ($id > 0 && ! preg_match('/^add/i',$action)) print ''; } + dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark'); + print ''; print ''; @@ -275,12 +279,14 @@ if ($id > 0 && ! preg_match('/^add/i',$action)) print '
'.$langs->trans("Ref").''.$bookmark->ref.'
'; - if ($action == 'edit') print '
   
'; - - if ($action == 'edit') print ''; - dol_fiche_end(); + if ($action == 'edit') + { + print '
   
'; + print ''; + } + print "
\n"; diff --git a/htdocs/comm/propal/apercu.php b/htdocs/comm/propal/apercu.php index e575c8f27fc..87281e7ea63 100644 --- a/htdocs/comm/propal/apercu.php +++ b/htdocs/comm/propal/apercu.php @@ -3,7 +3,8 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2014 Frederic France * * 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 @@ -22,14 +23,13 @@ /** * \file htdocs/comm/propal/apercu.php * \ingroup propal - * \brief Page de l'onglet apercu d'une propal + * \brief Preview tab of propal */ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $langs->load('propal'); $langs->load("bills"); @@ -44,18 +44,11 @@ $result = restrictedArea($user, 'propal', $id); /* - * View + * View Mode */ llxHeader(); -$form = new Form($db); - -/* *************************************************************************** */ -/* */ -/* Mode fiche */ -/* */ -/* *************************************************************************** */ if ($id > 0 || ! empty($ref)) { @@ -73,29 +66,30 @@ if ($id > 0 || ! empty($ref)) /* * Propal */ - print ''; + print '
'; - // Ref - print ''; + // Ref + print ''; + print ''; + print ''; - // Ref client - print ''; - print ''; + // Ref client + print ''; + print ''; + print ''; - $rowspan=2; - // Tiers - print ''; - print ''; + // Thirdparty + print ''; + print ''; + print ''; - // Ligne info remises tiers + // Status + print ''; + print ''; + print ''; + + // Discount print ''; + print '.'; + print ''; - // ligne - // partie Gauche - print ''; + // Date + print ''; + print ''; - // partie Droite sur $rowspan lignes - print ''; + print ''; + print ''; + + // Total VAT - left part + print ''; + print ''; + print ''; + + // Total TTC - left part + print ''; + print ''; + print ''; + + print '
'.$langs->trans('Ref').''.$object->ref.'
'.$langs->trans('Ref').''.$object->ref.'
'; - print ''; - print '
'; - print $langs->trans('RefCustomer').''; - print '
'; - print '
'; - print $object->ref_client; - print '
'.$langs->trans('RefCustomer').''.$object->ref_client.'
'.$langs->trans('Company').''.$soc->getNomUrl(1).'
'.$langs->trans('Company').''.$soc->getNomUrl(1).'
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans('Discounts').''; if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent); else print $langs->trans("CompanyHasNoRelativeDiscount"); @@ -103,44 +97,43 @@ if ($id > 0 || ! empty($ref)) print '. '; if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->currency)); else print $langs->trans("CompanyHasNoAbsoluteDiscount"); - print '.'; - print '
'.$langs->trans('Date').''; - print dol_print_date($object->date,'daytext'); - print '
'.$langs->trans('Date').''.dol_print_date($object->date,'daytext').''; + // Right part with $rowspan lines + $rowspan=4; + print ''; - /* - * Documents - */ - $objectref = dol_sanitizeFileName($object->ref); - $dir_output = $conf->propal->dir_output . "/"; - $filepath = $dir_output . $objectref . "/"; - $file = $filepath . $objectref . ".pdf"; - $filedetail = $filepath . $objectref . "-detail.pdf"; + /* + * Documents + */ + $objectref = dol_sanitizeFileName($object->ref); + $dir_output = $conf->propal->dir_output . "/"; + $filepath = $dir_output . $objectref . "/"; + $file = $filepath . $objectref . ".pdf"; + $filedetail = $filepath . $objectref . "-detail.pdf"; $relativepath = $objectref.'/'.$objectref.'.pdf'; $relativepathdetail = $objectref.'/'.$objectref.'-detail.pdf'; // Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png") - $fileimage = $file.'_preview.png'; // If PDF has 1 page + $fileimage = $file.'_preview.png'; // If PDF has 1 page $fileimagebis = $file.'_preview-0.pdf.png'; // If PDF has more than one page $relativepathimage = $relativepath.'_preview.png'; - $var=true; + $var=true; // Si fichier PDF existe if (file_exists($file)) { $encfile = urlencode($file); - print_titre($langs->trans("Documents")); - print ''; + print '
'; + print ''; - print ""; + print ''; print ''; @@ -166,13 +159,25 @@ if ($id > 0 || ! empty($ref)) } } - print ""; - print ''; + print ''; + print ''; - print ''; - print ''; - print ''; - print '
'.$langs->trans("Documents").'
".$langs->trans("Propal")." PDF
'.$langs->trans("Proposal").' PDF'.$object->ref.'.pdf
'.$langs->trans('AmountHT').''.price($object->price).''.$langs->trans("Currency".$conf->currency).'
'; + // Total HT - left part + 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('AmountTTC').'' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '
'; dol_fiche_end(); } @@ -183,10 +188,13 @@ if ($id > 0 || ! empty($ref)) } } +print ''; +print ''; +print '
'; +print '
'; // Si fichier png PDF d'1 page trouve if (file_exists($fileimage)) { - print ''; + print ''; } // Si fichier png PDF de plus d'1 page trouve elseif (file_exists($fileimagebis)) @@ -199,10 +207,13 @@ elseif (file_exists($fileimagebis)) if (file_exists($dir_output.$preview)) { - print '

'; + print '

'; } } } +print '

'; +print '
'; llxFooter(); diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 978fc2b3838..4343e2cb921 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -220,7 +220,7 @@ class Account extends CommonObject /** * Add an entry into table ".MAIN_DB_PREFIX."bank * - * @param timsestmap $date Date operation + * @param timestamp $date Date operation * @param string $oper 1,2,3,4... (deprecated) or TYP,VIR,PRE,LIQ,VAD,CB,CHQ... * @param string $label Descripton * @param float $amount Amount diff --git a/htdocs/compta/dons/card.php b/htdocs/compta/dons/card.php index e453ef623c3..5a4170e74fe 100644 --- a/htdocs/compta/dons/card.php +++ b/htdocs/compta/dons/card.php @@ -76,7 +76,7 @@ if ($action == 'update') if (empty($amount)) { - $setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Amount")), 'errors'); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Amount")), 'errors'); $action = "create"; $error++; } diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index c2918ddf1ee..c6b6dad7acb 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -228,7 +228,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" print ''; // The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object print img_picto($langs->trans("MoveBox",$this->box_id),'grip_title','class="boxhandle hideonsmartphone" style="cursor:move;"'); - print img_picto($langs->trans("Close",$this->box_id),'close_title','class="boxclose" rel="x:y" style="cursor:pointer;" id="imgclose'.$this->box_id.'"'); + print img_picto($langs->trans("Close2",$this->box_id),'close_title','class="boxclose" rel="x:y" style="cursor:pointer;" id="imgclose'.$this->box_id.'"'); $label=$head['text']; if (! empty($head['graph'])) $label.=' ('.$langs->trans("Graph").')'; print ''; diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php index ab26ee68317..14d1bec0841 100644 --- a/htdocs/core/class/infobox.class.php +++ b/htdocs/core/class/infobox.class.php @@ -40,14 +40,14 @@ class InfoBox /** * Return array of boxes qualified for area and user * - * @param DoliDB $db Database handler - * @param string $mode 'available' or 'activated' - * @param string $zone Name or area (-1 for all, 0 for Homepage, 1 for xxx, ...) - * @param User $user Object user to filter - * @param array $excludelist Array of box id (box.box_id = boxes_def.rowid) to exclude - * @return array Array of boxes + * @param DoliDB $db Database handler + * @param string $mode 'available' or 'activated' + * @param string $zone Name or area (-1 for all, 0 for Homepage, 1 for xxx, ...) + * @param User|null $user Object user to filter + * @param array $excludelist Array of box id (box.box_id = boxes_def.rowid) to exclude + * @return array Array of boxes */ - static function listBoxes($db, $mode, $zone, $user, $excludelist=array()) + static function listBoxes($db, $mode, $zone, $user=null, $excludelist=array()) { global $conf; diff --git a/htdocs/core/tpl/resource_view.tpl.php b/htdocs/core/tpl/resource_view.tpl.php index ef2963b28c1..d57b66cc331 100644 --- a/htdocs/core/tpl/resource_view.tpl.php +++ b/htdocs/core/tpl/resource_view.tpl.php @@ -32,7 +32,7 @@ if( (array) $linked_resources && count($linked_resources) > 0) print '
'.$langs->trans('Resource').'
'; print '
'.$langs->trans('Busy').'
'; print '
'.$langs->trans('Mandatory').'
'; - print '
'.$langs->trans('Edit').'
'; + print '
'.$langs->trans('Action').'
'; print ''; //print '
'; @@ -86,8 +86,13 @@ if( (array) $linked_resources && count($linked_resources) > 0) print '
'; print ''; print ''; @@ -105,4 +110,4 @@ else { print '
'.$langs->trans('NoResourceLinked').'
'; } -// FIN DU TPL +// FIN DU TPL \ No newline at end of file diff --git a/htdocs/fourn/paiement/card.php b/htdocs/fourn/paiement/card.php index 824919400a2..179e810d182 100644 --- a/htdocs/fourn/paiement/card.php +++ b/htdocs/fourn/paiement/card.php @@ -107,7 +107,7 @@ if ($action == 'setnum_paiement' && ! empty($_POST['num_paiement'])) $res = $object->update_num($_POST['num_paiement']); if ($res === 0) { - $setEventMessage($langs->trans('PaymentNumberUpdateSucceeded')); + setEventMessage($langs->trans('PaymentNumberUpdateSucceeded')); } else { diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index c8553f29291..cf01d5d0364 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1810,13 +1810,13 @@ function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinput $ret=''; $ret.='
'; - $ret.=''; + $ret.=''; $ret.=''; $ret.=''; $ret.=''; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 92d588d19fe..529f812d8c4 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1419,7 +1419,7 @@ else // Status (to sell) print ''.$langs->trans("Status").' ('.$langs->trans("Sell").')'; - if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer) { + if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { print ajax_object_onoff($object, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell'); } else { print $object->getLibStatut(2,0); @@ -1428,7 +1428,7 @@ else // Status (to buy) print ''.$langs->trans("Status").' ('.$langs->trans("Buy").')'; - if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer) { + if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { print ajax_object_onoff($object, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy'); } else { print $object->getLibStatut(2,1); @@ -1438,7 +1438,7 @@ else // Batch number management (to batch) if ($conf->productbatch->enabled) { print ''.$langs->trans("Status").' ('.$langs->trans("Lot").')'; - if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer) { + if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { print ajax_object_onoff($object, 'status_batch', 'tobatch', 'ProductStatusOnBatch', 'ProductStatusNotOnBatch'); } else { print $object->getLibStatut(2,2); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 907181634ee..a5cc97defa7 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -511,7 +511,7 @@ else $product_static->status = $objp->tosell; // Status (to sell) print ''; - if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer) { + if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { print ajax_object_onoff($product_static, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell'); } else { print $product_static->LibStatut($objp->tosell,5,0); @@ -520,7 +520,7 @@ else // Status (to buy) print ''; - if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer) { + if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { print ajax_object_onoff($product_static, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy'); } else { print $product_static->LibStatut($objp->tobuy,5,1); diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 96ecdb1d95d..5bd7999e2e3 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -279,7 +279,7 @@ if ($id > 0 || $ref) // Status (to sell) print ''.$langs->trans("Status").' ('.$langs->trans("Sell").')'; - if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer) { + if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { print ajax_object_onoff($product, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell'); } else { print $product->getLibStatut(2,0); @@ -288,7 +288,7 @@ if ($id > 0 || $ref) // Status (to buy) print ''.$langs->trans("Status").' ('.$langs->trans("Buy").')'; - if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer) { + if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { print ajax_object_onoff($product, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy'); } else { print $product->getLibStatut(2,1); @@ -340,7 +340,7 @@ if ($id > 0 || $ref) } print ''; print ''; - + print ''; $text_stock_options = ''; $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)?$langs->trans("DeStockOnShipment").'
':''); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 676b17a5951..6e7ab74b941 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -296,22 +296,22 @@ if ($id > 0 || ! empty($ref)) print ''.$langs->trans("DateStart").''; print dol_print_date($object->date_start,'dayhour'); print ''; - + // Date end print ''.$langs->trans("DateEnd").''; print dol_print_date($object->date_end,'dayhour'); print ''; - + // Planned workload print ''.$langs->trans("PlannedWorkload").''; print convertSecondToTime($object->planned_workload,'allhourmin'); print ''; - + // Progress declared print ''.$langs->trans("ProgressDeclared").''; print $object->progress.' %'; print ''; - + // Progress calculated print ''.$langs->trans("ProgressCalculated").''; if ($object->planned_workload) @@ -322,7 +322,7 @@ if ($id > 0 || ! empty($ref)) } else print ''; print ''; - + // Project if (empty($withproject)) { @@ -400,11 +400,11 @@ if ($id > 0 || ! empty($ref)) // Contributor print ''; - print img_object('','user'); + print img_object('','user','class="hideonsmartphone"'); $contactsoftask=$object->getListContactId('internal'); if (count($contactsoftask)>0) { $userid=$contactsoftask[0]; - $form->select_users($userid,'userid',0,'',0,'',$contactsoftask); + print $form->select_dolusers($userid,'userid',0,'',0,'',$contactsoftask); }else { print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); } @@ -506,7 +506,7 @@ if ($id > 0 || ! empty($ref)) $contactsoftask[]=$task_time->fk_user; } if (count($contactsoftask)>0) { - $form->select_users($task_time->fk_user,'userid_line',0,'',0,'',$contactsoftask); + print $form->select_dolusers($task_time->fk_user,'userid_line',0,'',0,'',$contactsoftask); }else { print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); } diff --git a/htdocs/resource/add.php b/htdocs/resource/add.php index fde152b6185..679644ac9e0 100644 --- a/htdocs/resource/add.php +++ b/htdocs/resource/add.php @@ -32,7 +32,7 @@ if (! $res) die("Include of main fails"); require_once 'class/resource.class.php'; require_once 'class/html.formresource.class.php'; -// Load traductions files requiredby by page +// Load traductions files required by page $langs->load("resource"); $langs->load("companies"); $langs->load("other"); @@ -41,6 +41,7 @@ $langs->load("resource@resource"); // Get parameters $id = GETPOST('id','int'); $action = GETPOST('action','alpha'); +$cancel = GETPOST('cancel','alpha'); if (empty($sortorder)) $sortorder="DESC"; if (empty($sortfield)) $sortfield="t.rowid"; if (empty($arch)) $arch = 0; @@ -65,57 +66,64 @@ $object = new Resource($db); if ($action == 'confirm_add_resource') { - $error=''; - - $ref=GETPOST('ref','alpha'); - $description=GETPOST('description','alpha'); - $fk_code_type_resource=GETPOST('fk_code_type_resource','alpha'); - - if (empty($ref)) + if (! $cancel) { - $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")); - setEventMessage($mesg, 'errors'); - $error++; - } - - if (! $error) - { - $object=new Resource($db); - $object->ref=$ref; - $object->description=$description; - $object->fk_code_type_resource=$fk_code_type_resource; + $error=''; - $result=$object->create($user); - if ($result > 0) + $ref=GETPOST('ref','alpha'); + $description=GETPOST('description','alpha'); + $fk_code_type_resource=GETPOST('fk_code_type_resource','alpha'); + + if (empty($ref)) { - // Creation OK - $db->commit(); - setEventMessage($langs->trans('ResourceCreatedWithSuccess')); - Header("Location: card.php?id=" . $object->id); - return; + $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")); + setEventMessage($mesg, 'errors'); + $error++; + } + + if (! $error) + { + $object=new Resource($db); + $object->ref=$ref; + $object->description=$description; + $object->fk_code_type_resource=$fk_code_type_resource; + + $result=$object->create($user); + if ($result > 0) + { + // Creation OK + $db->commit(); + setEventMessage($langs->trans('ResourceCreatedWithSuccess')); + Header("Location: card.php?id=" . $object->id); + return; + } + else + { + // Creation KO + setEventMessage($object->error, 'errors'); + $action = ''; + } } else { - // Creation KO - setEventMessage($object->error, 'errors'); $action = ''; } } else { - $action = ''; + Header("Location: list.php"); } } -/*************************************************** -* VIEW -* -****************************************************/ +/* + * View + * + */ $form=new Form($db); $formresource = new FormResource($db); -if ( !$action ) +if (! $action) { $pagetitle=$langs->trans('AddResource'); llxHeader('',$pagetitle,''); @@ -161,8 +169,10 @@ if ( !$action ) print ''; - echo '
', - ' ', + echo '
', + '', + ' ', + '', '
'; print ''; diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php index b2ee3ae1814..33a27796aaf 100644 --- a/htdocs/resource/card.php +++ b/htdocs/resource/card.php @@ -139,7 +139,7 @@ if ( $object->fetch($id) > 0 ) /*--------------------------------------- * Edit object - */ + */ print '
'; print ''; print ''; @@ -171,7 +171,7 @@ if ( $object->fetch($id) > 0 ) } else { - // Confirmation suppression resource line + // Confirm deleting resource line if ($action == 'delete') { print $form->formconfirm("card.php?&id=".$id,$langs->trans("DeleteResource"),$langs->trans("ConfirmDeleteResource"),"confirm_delete_resource",'','',1); @@ -228,9 +228,9 @@ if ( $object->fetch($id) > 0 ) print '
'; } } - if ($action != "delete" ) + if ($action != "delete" && $action != "edit") { - // Edit resource + // Delete resource if($user->rights->resource->delete) { print '
'; diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index 02a24735454..d50c9a4ec6f 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -1,6 +1,5 @@ +/* Copyright (C) 2013 Jean-François Ferry * * 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 @@ -32,7 +31,7 @@ require 'class/resource.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // Load traductions files requiredby by page -$langs->load("resource@resource"); +$langs->load("resource"); $langs->load("other"); // Get parameters @@ -70,8 +69,9 @@ $resource_id = GETPOST('fk_resource','int'); $resource_type = GETPOST('resource_type','alpha'); $busy = GETPOST('busy','int'); $mandatory = GETPOST('mandatory','int'); +$cancel = GETPOST('cancel','alpha'); -if($action == 'add_element_resource' && !GETPOST('cancel')) +if($action == 'add_element_resource' && ! $cancel) { $objstat = fetchObjectByElement($element_id,$element); $res = $objstat->add_element_resource($resource_id,$resource_type,$busy,$mandatory); @@ -251,9 +251,6 @@ else foreach ($object->available_resources as $modresources => $resources) { - $langs->load($resources); - //print '

'.$modresources.'

'; - $resources=(array) $resources; // To be sure $resources is an array foreach($resources as $resource_obj) { @@ -301,7 +298,7 @@ else { print '
'; print '
'; - print 'Add resource'; + print ''.$langs->trans('AddResource').''; print '
'; print '
'; } diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 9a0fca19781..ab70bc9a338 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -1,6 +1,5 @@ +/* Copyright (C) 2013-2014 Jean-François Ferry * * 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 @@ -116,7 +115,7 @@ else print_liste_field_titre($langs->trans('Id'),$_SERVER['PHP_SELF'],'t.rowid','',$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'t.ref','',$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans('ResourceType'),$_SERVER['PHP_SELF'],'ty.code','',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Edit')); + print_liste_field_titre($langs->trans('Action'),"","","","",'width="60" align="center"',"",""); print ''; foreach ($object->lines as $resource) @@ -128,7 +127,7 @@ else $style='style="background: orange;"'; print ''; - print $resource->id; + print ''.$resource->id.''; print ''; print ''; @@ -139,9 +138,14 @@ else print $resource->type_label; print ''; - print ''; - print ''.$langs->trans('View').' '; - print ''.$langs->trans('Edit').''; + print ''; + print ''; + print img_edit(); + print ''; + print ' '; + print ''; + print img_delete(); + print ''; print ''; print ''; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 62869daf366..701efe742eb 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1727,7 +1727,7 @@ else // Status print ''.$langs->trans("Status").''; print ''; - if (! empty($conf->use_javascript_ajax) && $user->rights->societe->creer) { + if (! empty($conf->use_javascript_ajax) && $user->rights->societe->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { print ajax_object_onoff($object, 'status', 'status', 'InActivity', 'ActivityCeased'); } else { print $object->getLibStatut(2); diff --git a/htdocs/user/document.php b/htdocs/user/document.php index b18424625ce..2659b9427c8 100644 --- a/htdocs/user/document.php +++ b/htdocs/user/document.php @@ -88,10 +88,11 @@ if ($id > 0 || ! empty($ref)) { $result = $object->fetch($id, $ref); - $upload_dir = $conf->user->multidir_output[$object->entity] . "/" . $object->id ; + $entitytouseforuserdir = $object->entity; + if (empty($entitytouseforuserdir)) $entitytouseforuserdir=1; + $upload_dir = $conf->user->multidir_output[$entitytouseforuserdir] . "/" . $object->id ; } - /* * Actions */ @@ -159,8 +160,8 @@ if ($object->id) print '
'; - $modulepart = 'societe'; - $permission = $user->rights->societe->creer; + $modulepart = 'user'; + $permission = $user->rights->user->user->creer; $param = '&id=' . $object->id; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; } diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 9903c6b4ed9..2318780608c 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -29,6 +29,7 @@ set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); require_once '../master.inc.php'; require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP require_once DOL_DOCUMENT_ROOT.'/core/lib/ws.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php"); @@ -84,6 +85,52 @@ $server->wsdl->addComplexType( ) ); +$line_fields = array( + 'id' => array('name'=>'id','type'=>'xsd:string'), + 'type' => array('name'=>'type','type'=>'xsd:int'), + 'fk_commande' => array('name'=>'fk_commande','type'=>'xsd:int'), + 'fk_parent_line' => array('name'=>'fk_parent_line','type'=>'xsd:int'), + 'desc' => array('name'=>'desc','type'=>'xsd:string'), + 'qty' => array('name'=>'qty','type'=>'xsd:double'), + 'price' => array('name'=>'price','type'=>'xsd:double'), + 'unitprice' => array('name'=>'unitprice','type'=>'xsd:double'), + 'vat_rate' => array('name'=>'vat_rate','type'=>'xsd:double'), + + 'remise' => array('name'=>'remise','type'=>'xsd:double'), + 'remise_percent' => array('name'=>'remise_percent','type'=>'xsd:double'), + + 'total_net' => array('name'=>'total_net','type'=>'xsd:double'), + 'total_vat' => array('name'=>'total_vat','type'=>'xsd:double'), + 'total' => array('name'=>'total','type'=>'xsd:double'), + + 'date_start' => array('name'=>'date_start','type'=>'xsd:date'), + 'date_end' => array('name'=>'date_end','type'=>'xsd:date'), + + // From product + 'product_id' => array('name'=>'product_id','type'=>'xsd:int'), + 'product_ref' => array('name'=>'product_ref','type'=>'xsd:string'), + 'product_label' => array('name'=>'product_label','type'=>'xsd:string'), + 'product_desc' => array('name'=>'product_desc','type'=>'xsd:string') +); + + +//Retreive all extrafield for thirdsparty +// fetch optionals attributes and labels +$extrafields=new ExtraFields($db); +$extralabels=$extrafields->fetch_name_optionals_label('commandedet',true); +if (count($extrafields)>0) { + $extrafield_line_array = array(); +} +foreach($extrafields->attribute_label as $key=>$label) +{ + //$value=$object->array_options["options_".$key]; + $type =$extrafields->attribute_type[$key]; + if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';} + else {$type='xsd:string';} + $extrafield_line_array['options_'.$key]=array('name'=>'options_'.$key,'type'=>$type); +} +$line_fields=array_merge($line_fields,$extrafield_line_array); + // Define other specific objects $server->wsdl->addComplexType( 'line', @@ -91,33 +138,7 @@ $server->wsdl->addComplexType( 'struct', 'all', '', - array( - 'id' => array('name'=>'id','type'=>'xsd:string'), - 'type' => array('name'=>'type','type'=>'xsd:int'), - 'fk_commande' => array('name'=>'fk_commande','type'=>'xsd:int'), - 'fk_parent_line' => array('name'=>'fk_parent_line','type'=>'xsd:int'), - 'desc' => array('name'=>'desc','type'=>'xsd:string'), - 'qty' => array('name'=>'qty','type'=>'xsd:double'), - 'price' => array('name'=>'price','type'=>'xsd:double'), - 'unitprice' => array('name'=>'unitprice','type'=>'xsd:double'), - 'vat_rate' => array('name'=>'vat_rate','type'=>'xsd:double'), - - 'remise' => array('name'=>'remise','type'=>'xsd:double'), - 'remise_percent' => array('name'=>'remise_percent','type'=>'xsd:double'), - - 'total_net' => array('name'=>'total_net','type'=>'xsd:double'), - 'total_vat' => array('name'=>'total_vat','type'=>'xsd:double'), - 'total' => array('name'=>'total','type'=>'xsd:double'), - - 'date_start' => array('name'=>'date_start','type'=>'xsd:date'), - 'date_end' => array('name'=>'date_end','type'=>'xsd:date'), - - // From product - 'product_id' => array('name'=>'product_id','type'=>'xsd:int'), - 'product_ref' => array('name'=>'product_ref','type'=>'xsd:string'), - 'product_label' => array('name'=>'product_label','type'=>'xsd:string'), - 'product_desc' => array('name'=>'product_desc','type'=>'xsd:string') - ) + $line_fields ); /*$server->wsdl->addComplexType( @@ -151,53 +172,73 @@ $server->wsdl->addComplexType( ) ); +$order_fields = array( + 'id' => array('name'=>'id','type'=>'xsd:string'), + 'ref' => array('name'=>'ref','type'=>'xsd:string'), + 'ref_client' => array('name'=>'ref_client','type'=>'xsd:string'), + 'ref_ext' => array('name'=>'ref_ext','type'=>'xsd:string'), + 'ref_int' => array('name'=>'ref_int','type'=>'xsd:string'), + 'thirdparty_id' => array('name'=>'thirdparty_id','type'=>'xsd:int'), + 'status' => array('name'=>'status','type'=>'xsd:int'), + 'facturee' => array('name'=>'facturee','type'=>'xsd:string'), + 'total_net' => array('name'=>'total_net','type'=>'xsd:double'), + 'total_vat' => array('name'=>'total_vat','type'=>'xsd:double'), + 'total_localtax1' => array('name'=>'total_localtax1','type'=>'xsd:double'), + 'total_localtax2' => array('name'=>'total_localtax2','type'=>'xsd:double'), + 'total' => array('name'=>'total','type'=>'xsd:double'), + 'date' => array('name'=>'date','type'=>'xsd:date'), + 'date_creation' => array('name'=>'date_creation','type'=>'xsd:dateTime'), + 'date_validation' => array('name'=>'date_validation','type'=>'xsd:dateTime'), + 'date_modification' => array('name'=>'date_modification','type'=>'xsd:dateTime'), + 'remise' => array('name'=>'remise','type'=>'xsd:string'), + 'remise_percent' => array('name'=>'remise_percent','type'=>'xsd:string'), + 'remise_absolue' => array('name'=>'remise_absolue','type'=>'xsd:string'), + 'source' => array('name'=>'source','type'=>'xsd:string'), + 'note_private' => array('name'=>'note_private','type'=>'xsd:string'), + 'note_public' => array('name'=>'note_public','type'=>'xsd:string'), + 'project_id' => array('name'=>'project_id','type'=>'xsd:string'), + + 'mode_reglement_id' => array('name'=>'mode_reglement_id','type'=>'xsd:string'), + 'mode_reglement_code' => array('name'=>'mode_reglement_code','type'=>'xsd:string'), + 'mode_reglement' => array('name'=>'mode_reglement','type'=>'xsd:string'), + 'cond_reglement_id' => array('name'=>'cond_reglement_id','type'=>'xsd:string'), + 'cond_reglement_code' => array('name'=>'cond_reglement_code','type'=>'xsd:string'), + 'cond_reglement' => array('name'=>'cond_reglement','type'=>'xsd:string'), + 'cond_reglement_doc' => array('name'=>'cond_reglement_doc','type'=>'xsd:string'), + + 'date_livraison' => array('name'=>'date_livraison','type'=>'xsd:date'), + 'fk_delivery_address' => array('name'=>'fk_delivery_address','type'=>'xsd:int'), + 'demand_reason_id' => array('name'=>'demand_reason_id','type'=>'xsd:string'), + + 'lines' => array('name'=>'lines','type'=>'tns:LinesArray2') +); + +//Retreive all extrafield for thirdsparty +// fetch optionals attributes and labels +$extrafields=new ExtraFields($db); +$extralabels=$extrafields->fetch_name_optionals_label('commande',true); +if (count($extrafields)>0) { + $extrafield_array = array(); +} +foreach($extrafields->attribute_label as $key=>$label) +{ + //$value=$object->array_options["options_".$key]; + $type =$extrafields->attribute_type[$key]; + if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';} + else {$type='xsd:string';} + $extrafield_array['options_'.$key]=array('name'=>'options_'.$key,'type'=>$type); +} +$order_fields=array_merge($order_fields,$extrafield_array); + $server->wsdl->addComplexType( 'order', 'complexType', 'struct', 'all', '', - array( - 'id' => array('name'=>'id','type'=>'xsd:string'), - 'ref' => array('name'=>'ref','type'=>'xsd:string'), - 'ref_client' => array('name'=>'ref_client','type'=>'xsd:string'), - 'ref_ext' => array('name'=>'ref_ext','type'=>'xsd:string'), - 'ref_int' => array('name'=>'ref_int','type'=>'xsd:string'), - 'thirdparty_id' => array('name'=>'thirdparty_id','type'=>'xsd:int'), - 'status' => array('name'=>'status','type'=>'xsd:int'), - 'facturee' => array('name'=>'facturee','type'=>'xsd:string'), - 'total_net' => array('name'=>'total_net','type'=>'xsd:double'), - 'total_vat' => array('name'=>'total_vat','type'=>'xsd:double'), - 'total_localtax1' => array('name'=>'total_localtax1','type'=>'xsd:double'), - 'total_localtax2' => array('name'=>'total_localtax2','type'=>'xsd:double'), - 'total' => array('name'=>'total','type'=>'xsd:double'), - 'date' => array('name'=>'date','type'=>'xsd:date'), - 'date_creation' => array('name'=>'date_creation','type'=>'xsd:dateTime'), - 'date_validation' => array('name'=>'date_validation','type'=>'xsd:dateTime'), - 'date_modification' => array('name'=>'date_modification','type'=>'xsd:dateTime'), - 'remise' => array('name'=>'remise','type'=>'xsd:string'), - 'remise_percent' => array('name'=>'remise_percent','type'=>'xsd:string'), - 'remise_absolue' => array('name'=>'remise_absolue','type'=>'xsd:string'), - 'source' => array('name'=>'source','type'=>'xsd:string'), - 'note_private' => array('name'=>'note_private','type'=>'xsd:string'), - 'note_public' => array('name'=>'note_public','type'=>'xsd:string'), - 'project_id' => array('name'=>'project_id','type'=>'xsd:string'), - - 'mode_reglement_id' => array('name'=>'mode_reglement_id','type'=>'xsd:string'), - 'mode_reglement_code' => array('name'=>'mode_reglement_code','type'=>'xsd:string'), - 'mode_reglement' => array('name'=>'mode_reglement','type'=>'xsd:string'), - 'cond_reglement_id' => array('name'=>'cond_reglement_id','type'=>'xsd:string'), - 'cond_reglement_code' => array('name'=>'cond_reglement_code','type'=>'xsd:string'), - 'cond_reglement' => array('name'=>'cond_reglement','type'=>'xsd:string'), - 'cond_reglement_doc' => array('name'=>'cond_reglement_doc','type'=>'xsd:string'), - - 'date_livraison' => array('name'=>'date_livraison','type'=>'xsd:date'), - 'fk_delivery_address' => array('name'=>'fk_delivery_address','type'=>'xsd:int'), - 'demand_reason_id' => array('name'=>'demand_reason_id','type'=>'xsd:string'), - - 'lines' => array('name'=>'lines','type'=>'tns:LinesArray2') - ) + $order_fields ); + /* $server->wsdl->addComplexType( 'OrdersArray', @@ -643,6 +684,16 @@ function createOrder($authentication,$order) $newobject->cond_reglement_id=$order['cond_reglement_id']; $newobject->demand_reason_id=$order['demand_reason_id']; $newobject->date_creation=$now; + + // Retrieve all extrafield for order + // fetch optionals attributes and labels + $extrafields=new ExtraFields($db); + $extralabels=$extrafields->fetch_name_optionals_label('commandet',true); + foreach($extrafields->attribute_label as $key=>$label) + { + $key='options_'.$key; + $newobject->array_options[$key]=$order[$key]; + } // Trick because nusoap does not store data with same structure if there is one or several lines $arrayoflines=array(); @@ -666,6 +717,17 @@ function createOrder($authentication,$order) $newline->total_ttc=$line['total']; $newline->date_start=$line['date_start']; $newline->date_end=$line['date_end']; + + // Retrieve all extrafield for lines + // fetch optionals attributes and labels + $extrafields=new ExtraFields($db); + $extralabels=$extrafields->fetch_name_optionals_label('commandedet',true); + foreach($extrafields->attribute_label as $key=>$label) + { + $key='options_'.$key; + $newline->array_options[$key]=$line[$key]; + } + $newobject->lines[]=$newline; }