diff --git a/ChangeLog b/ChangeLog index 5377a690e1f..af001a3c0ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -40,23 +40,27 @@ For users: - New: Add Maghreb regions and departments. - New: A more responsive desgin for statistic box of home page. - Qual: Implement same rule for return value of all command line scripts (0 when success, <>0 if error). -- New: [ task #1005 ] Adapting to Spanish legislation bill numbering. -- New: [ task #1011 ] Now supplier order and invoice deal with payment terms and mode. -- New: [ task #1014 ] Add option to recursivly add parent category. -- New: [ task #1016 ] Can define a specific numbering for deposits. -- New: [ task #918 ] Stock replenishment. -- Fix: [ bug #992 ] Proforma invoices don't have a separated numeric count. -- New: Add pdf link into supplier invoice list and supplier order list. -- New: Genrate auto the PDF for supplier invoice. -- New: Add category into filter webservice thirdparty method getListOfThirdParties. -- New: Allow to define margin or mark rate during quoting, ordering, invoicing. -- New: User permissions on margin module. -- New: Add ref supplier into muscadet model. +- New: [ task #1005 ] Adapting to Spanish legislation bill numbering +- New: [ task #1011 ] Now supplier order and invoice deal with payment terms and mode +- New: [ task #1014 ] Add option to recursivly add parent category +- New: [ task #1016 ] Can define a specific numbering for deposits +- New: [ task #918 ] Stock replenishment +- Fix: [ bug #992 ] Proforma invoices don't have a separated numeric count +- New : Add pdf link into supplier invoice list and supplier order list +- New : Genrate auto the PDF for supplier invoice +- New : Add category into filter webservice thirdparty method getListOfThirdParties +- New : Allow to define margin or mark rate during quoting, ordering, invoicing +- New : User permissions on margin module +- New : Add ref supplier into muscadet model +- New : Add ability to copy contact address to clipboard - New: Can use tag {mm} before {yy} even when there is a reset into numbering masks. - New: [ task #1060 ] Register fields localtax(1|2)_type into details tables. - New: [ task #923 ] Localtax support for ODT templates. - New: [ task #90 ] Barcode search. - New: Add hidden option MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS. +- New: Can send an email from thirdparty card. +- New: Can cancel holidays that were previously validated. +- Fix: [bug #1022] correct margin calculation for credit notes. For translators: - Qual: Normalized sort order of all languages files with english reference files. @@ -109,6 +113,8 @@ parameter. All methods addline in this case were modified to remove this paramet 4) Method ->classer_facturee() is deprecated. It must be replace with ->classifyBilled(). +5) Property ->tel on objects is now ->phone + ***** ChangeLog for 3.4.1 compared to 3.4.0 ***** Fix: Display buying price on line edit when no supplier price is defined diff --git a/htdocs/adherents/admin/adherent_extrafields.php b/htdocs/adherents/admin/adherent_extrafields.php index 34420ee0121..25139697955 100644 --- a/htdocs/adherents/admin/adherent_extrafields.php +++ b/htdocs/adherents/admin/adherent_extrafields.php @@ -50,7 +50,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/adherents/admin/adherent_type_extrafields.php b/htdocs/adherents/admin/adherent_type_extrafields.php index ce2787752a7..5fdd9ff2a39 100644 --- a/htdocs/adherents/admin/adherent_type_extrafields.php +++ b/htdocs/adherents/admin/adherent_type_extrafields.php @@ -51,7 +51,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 2dae974d9c1..255eb1533d9 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -564,7 +564,7 @@ class Adherent extends CommonObject $lthirdparty->zip=$this->zip; $lthirdparty->town=$this->town; $lthirdparty->email=$this->email; - $lthirdparty->tel=$this->phone; + $lthirdparty->phone=$this->phone; $lthirdparty->state_id=$this->state_id; $lthirdparty->country_id=$this->country_id; $lthirdparty->country_id=$this->country_id; diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index e3bbe5b55a9..2648a8ae721 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -691,7 +691,7 @@ else /* */ /* ************************************************************************** */ $object->canvas=$canvas; - $object->state_id = GETPOST('departement_id', 'int'); + $object->state_id = GETPOST('state_id', 'int'); // We set country_id, country_code and country for the selected country $object->country_id=GETPOST('country_id','int')?GETPOST('country_id','int'):$mysoc->country_id; diff --git a/htdocs/admin/agenda_extrafields.php b/htdocs/admin/agenda_extrafields.php index a7763893bb5..64f793cc761 100644 --- a/htdocs/admin/agenda_extrafields.php +++ b/htdocs/admin/agenda_extrafields.php @@ -56,7 +56,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/admin/confexped.php b/htdocs/admin/confexped.php index d9be768461f..de10a5b8e4f 100644 --- a/htdocs/admin/confexped.php +++ b/htdocs/admin/confexped.php @@ -87,7 +87,7 @@ $h++; if (! empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) { $head[$h][0] = DOL_URL_ROOT."/admin/expedition.php"; - $head[$h][1] = $langs->trans("Sending"); + $head[$h][1] = $langs->trans("Shipment"); $h++; } diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index d0d21e43e64..0e0008a54b7 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -210,7 +210,7 @@ $head[$h][1] = $langs->trans("Setup"); $h++; $head[$h][0] = DOL_URL_ROOT."/admin/expedition.php"; -$head[$h][1] = $langs->trans("Sending"); +$head[$h][1] = $langs->trans("Shipment"); $hselected=$h; $h++; @@ -225,7 +225,7 @@ dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup")); /* * Expedition numbering model - */ + */ print_titre($langs->trans("SendingsNumberingModules")); @@ -260,13 +260,13 @@ foreach ($dirmodels as $reldir) require_once $dir.$file.'.php'; $module = new $file; - + if ($module->isEnabled()) { // Show modules according to features level if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; - + $var=!$var; print ''.$module->nom."\n"; print ''; @@ -276,8 +276,8 @@ foreach ($dirmodels as $reldir) // Show example of numbering module print ''; $tmp=$module->getExample(); - if (preg_match('/^Error/',$tmp)) { - $langs->load("errors"); print '
'.$langs->trans($tmp).'
'; + if (preg_match('/^Error/',$tmp)) { + $langs->load("errors"); print '
'.$langs->trans($tmp).'
'; } elseif ($tmp=='NotConfigured') print $langs->trans($tmp); else print $tmp; diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index 96e84af3d58..56602508777 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -192,7 +192,7 @@ $h++; if (! empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) { $head[$h][0] = DOL_URL_ROOT."/admin/expedition.php"; - $head[$h][1] = $langs->trans("Sending"); + $head[$h][1] = $langs->trans("Shipment"); $h++; } @@ -207,7 +207,7 @@ dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup")); /* * Livraison numbering model */ - + print_titre($langs->trans("DeliveryOrderNumberingModules")); print ''; @@ -240,13 +240,13 @@ foreach ($dirmodels as $reldir) require_once $dir.$file.'.php'; $module = new $file; - + if ($module->isEnabled()) { // Show modules according to features level if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; - + $var=!$var; print '
'.$module->nom."\n"; print $module->info(); @@ -255,8 +255,8 @@ foreach ($dirmodels as $reldir) // Show example of numbering module print ''; $tmp=$module->getExample(); - if (preg_match('/^Error/',$tmp)) { - $langs->load("errors"); print '
'.$langs->trans($tmp).'
'; + if (preg_match('/^Error/',$tmp)) { + $langs->load("errors"); print '
'.$langs->trans($tmp).'
'; } elseif ($tmp=='NotConfigured') print $langs->trans($tmp); else print $tmp; @@ -315,7 +315,7 @@ print '
'; print '
'; print_titre($langs->trans("DeliveryOrderModel")); -// Defini tableau def de modele +// Defini tableau def de modele $type="delivery"; $def = array(); diff --git a/htdocs/admin/order_extrafields.php b/htdocs/admin/order_extrafields.php index 7e748cdbc4a..88e3705c4e7 100644 --- a/htdocs/admin/order_extrafields.php +++ b/htdocs/admin/order_extrafields.php @@ -57,7 +57,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/admin/orderdet_extrafields.php b/htdocs/admin/orderdet_extrafields.php index 64eeb2f4b52..23e6166d1a4 100644 --- a/htdocs/admin/orderdet_extrafields.php +++ b/htdocs/admin/orderdet_extrafields.php @@ -58,7 +58,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/admin/supplierinvoice_extrafields.php b/htdocs/admin/supplierinvoice_extrafields.php index 8f9865981f5..02bedad307d 100644 --- a/htdocs/admin/supplierinvoice_extrafields.php +++ b/htdocs/admin/supplierinvoice_extrafields.php @@ -58,7 +58,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/admin/supplierorder_extrafields.php b/htdocs/admin/supplierorder_extrafields.php index 9aa7770f820..fea9656f146 100644 --- a/htdocs/admin/supplierorder_extrafields.php +++ b/htdocs/admin/supplierorder_extrafields.php @@ -57,7 +57,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index 0eba0baa68c..4fef3184c20 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -199,11 +199,11 @@ if (empty($reshook)) } else { - if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') + if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { setEventMessage($langs->trans("ObjectAlreadyLinkedToCategory"),'warnings'); } - else + else { setEventMessage($cat->error,'errors'); setEventMessage($cat->errors,'errors'); @@ -305,7 +305,7 @@ if ($socid) print ''; // Phone - print ''.$langs->trans('Phone').''.dol_print_phone($soc->tel,$soc->country_code,0,$soc->id,'AC_TEL').''; + print ''.$langs->trans('Phone').''.dol_print_phone($soc->phone,$soc->country_code,0,$soc->id,'AC_TEL').''; print ''.$langs->trans('Fax').''.dol_print_phone($soc->fax,$soc->country_code,0,$soc->id,'AC_FAX').''; // Assujeti a TVA ou pas diff --git a/htdocs/comm/action/contact.php b/htdocs/comm/action/contact.php index 6baafcaf036..642842ac568 100644 --- a/htdocs/comm/action/contact.php +++ b/htdocs/comm/action/contact.php @@ -43,23 +43,24 @@ $confirm = GETPOST('confirm'); $lineid = GETPOST('lineid','int'); // Security check +$socid = GETPOST('socid','int'); +if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id > 0) { unset($_GET["action"]); $action=''; - $socid = $user->societe_id; } +$result = restrictedArea($user, 'agenda', $objectid, 'actioncomm&societe', 'myactions&allactions', 'fk_soc', 'id'); + $object = new ActionComm($db); + /* * Actions */ -/* - * Ajout d'un nouveau contact - */ - +// Add new nouveau contact if ($action == 'addcontact') { $result = $object->fetch($id); diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 2bb710b310f..3b655f726f7 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -44,14 +44,14 @@ $objectid = GETPOST('id','int'); $action=GETPOST('action','alpha'); // Security check +$socid = GETPOST('socid','int'); +if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id > 0) { unset($_GET["action"]); $action=''; - $socid = $user->societe_id; } - -$result = restrictedArea($user, 'agenda', $objectid, 'actioncomm&societe', 'myactions&allactions', '', 'id'); +$result = restrictedArea($user, 'agenda', $objectid, 'actioncomm&societe', 'myactions&allactions', 'fk_soc', 'id'); $act = new ActionComm($db); @@ -208,7 +208,7 @@ if ($act->id > 0) { if ($act->societe->fetch($act->societe->id)) { - print "
".dol_print_phone($act->societe->tel); + print "
".dol_print_phone($act->societe->phone); } } print ''; diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 81723b8283d..0607fdd6e0e 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -51,12 +51,14 @@ $action=GETPOST('action','alpha'); $cancel=GETPOST('cancel','alpha'); $backtopage=GETPOST('backtopage','alpha'); $contactid=GETPOST('contactid','int'); +$origin=GETPOST('origin','alpha'); +$originid=GETPOST('originid','int'); // Security check $socid = GETPOST('socid','int'); $id = GETPOST('id','int'); if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', '', 'id'); +$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', 'fk_soc', 'id'); if ($user->societe_id && $socid) $result = restrictedArea($user,'societe',$socid); $error=GETPOST("error"); @@ -77,8 +79,10 @@ $hookmanager->initHooks(array('actioncard')); /* - * Action creation de l'action + * Actions */ + +// Add action if ($action == 'add_action') { $error=0; @@ -142,6 +146,8 @@ if ($action == 'add_action') $actioncomm->location = GETPOST("location"); $actioncomm->transparency = (GETPOST("transparency")=='on'?1:0); $actioncomm->label = trim(GETPOST('label')); + $actioncomm->fk_element = GETPOST("fk_element"); + $actioncomm->elementtype = GETPOST("elementtype"); if (! GETPOST('label')) { if (GETPOST('actioncode') == 'AC_RDV' && $contact->getFullName($langs)) @@ -327,7 +333,8 @@ if ($action == 'update') $actioncomm->fk_project = $_POST["projectid"]; $actioncomm->note = $_POST["note"]; $actioncomm->pnote = $_POST["note"]; - + $actioncomm->fk_element = $_POST["fk_element"]; + $actioncomm->elementtype = $_POST["elementtype"]; if (! $datef && $percentage == 100) { $error=$langs->trans("ErrorFieldRequired",$langs->trans("DateEnd")); @@ -476,7 +483,7 @@ if ($action == 'create') // Full day print ''.$langs->trans("EventOnFullDay").''; - + // Date start $datep=$actioncomm->datep; if (GETPOST('datep','int',1)) $datep=dol_stringtotime(GETPOST('datep','int',1),0); @@ -593,6 +600,11 @@ if ($action == 'create') } print ''; } + if(!empty($origin) && !empty($originid)) + { + print ''; + print ''; + } if (GETPOST("datep") && preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])$/',GETPOST("datep"),$reg)) { @@ -610,6 +622,7 @@ if ($action == 'create') $doleditor=new DolEditor('note',(GETPOST('note')?GETPOST('note'):$actioncomm->note),'',240,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_7,90); $doleditor->Create(); print ''; + // Other attributes $parameters=array(); @@ -971,7 +984,7 @@ if ($id > 0) { if ($act->societe->fetch($act->societe->id)) { - print "
".dol_print_phone($act->societe->tel); + print "
".dol_print_phone($act->societe->phone); } } print ''; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 7facb9b5459..5e38198ab60 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -84,7 +84,7 @@ $type=GETPOST("type"); $maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW); $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=="0"?'':(empty($conf->global->AGENDA_USE_EVENT_TYPE)?'AC_OTH':'')); -if (GETPOST('viewcal')) { +if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week') { $action='show_month'; $day=''; } // View by month if (GETPOST('viewweek')) { @@ -1140,7 +1140,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $cachethirdparties[$event->societe->id]=$thirdparty; } else $thirdparty=$cachethirdparties[$event->societe->id]; - $linerelatedto.=$thirdparty->getNomUrl(1,'',$length); + if (! empty($thirdparty->id)) $linerelatedto.=$thirdparty->getNomUrl(1,'',$length); } if (! empty($event->contact->id) && $event->contact->id > 0) { @@ -1152,7 +1152,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa } else $contact=$cachecontacts[$event->contact->id]; if ($linerelatedto) $linerelatedto.=' / '; - $linerelatedto.=$contact->getNomUrl(1,'',$length); + if (! empty($contact->id)) $linerelatedto.=$contact->getNomUrl(1,'',$length); } if ($linerelatedto) print '
'.$linerelatedto; } diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php index 66dc178d4b8..de41dc04483 100644 --- a/htdocs/comm/action/info.php +++ b/htdocs/comm/action/info.php @@ -40,7 +40,7 @@ if ($user->societe_id > 0) $socid = $user->societe_id; } -$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', '', 'id'); +$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', 'fk_soc', 'id'); /* diff --git a/htdocs/comm/admin/propal_extrafields.php b/htdocs/comm/admin/propal_extrafields.php index 28534e08140..75e994d281a 100644 --- a/htdocs/comm/admin/propal_extrafields.php +++ b/htdocs/comm/admin/propal_extrafields.php @@ -51,7 +51,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/comm/admin/propaldet_extrafields.php b/htdocs/comm/admin/propaldet_extrafields.php index 79509cc6593..f4a5226e1f0 100644 --- a/htdocs/comm/admin/propaldet_extrafields.php +++ b/htdocs/comm/admin/propaldet_extrafields.php @@ -59,7 +59,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 9021ad0acaf..1189b77ec57 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -254,7 +254,7 @@ if ($id > 0) print ''.$langs->trans("Web").''.dol_print_url($object->url,'_blank').''; // Phone - print ''.$langs->trans('Phone').''.dol_print_phone($object->tel,$object->country_code,0,$object->id,'AC_TEL').''; + print ''.$langs->trans('Phone').''.dol_print_phone($object->phone,$object->country_code,0,$object->id,'AC_TEL').''; // Fax print ''.$langs->trans('Fax').''.dol_print_phone($object->fax,$object->country_code,0,$object->id,'AC_FAX').''; diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index e2504eca6af..f6d082c763d 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1655,8 +1655,9 @@ else if ($absolute_discount) { if ($object->statut > 0) - { + { print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)); + } else { @@ -2105,7 +2106,11 @@ else if (count($object->lines) > 0) print '
'.$langs->trans('Validate').'
'; //else print ''.$langs->trans('Validate').''; } - + // Create event + if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page. + { + print ''.$langs->trans("AddAction").''; + } // Edit if ($object->statut == 1 && $user->rights->propal->creer) { diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 6bc2d02f25e..3016f5ac191 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -2386,13 +2386,16 @@ else { print '
'.$langs->trans('Validate').'
'; } - // Edit if ($object->statut == 1 && $user->rights->commande->creer) { print '
'.$langs->trans('Modify').'
'; } - + // Create event + if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page. + { + print ''.$langs->trans("AddAction").''; + } // Send if ($object->statut > 0) { diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 17796b6b35f..5a71d365ed1 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1296,7 +1296,7 @@ class AccountLine extends CommonObject // No error check. Can fail if category already affected } - $bankline->rappro=1; + $this->rappro=1; $this->db->commit(); return 1; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index e2da54015cc..31c69d93295 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1588,6 +1588,15 @@ else if ($action == 'down' && $user->rights->facture->creer) exit; } +// Link invoice to order +if (GETPOST('linkedOrder')) +{ + $object->fetch($id); + $object->fetch_thirdparty(); + $result=$object->add_object_linked('commande',GETPOST('linkedOrder')); +} + + /* * Add file in email form */ @@ -1960,6 +1969,16 @@ $now=dol_now(); llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes'); +print ' + +'; + /********************************************************************* * @@ -3727,74 +3746,64 @@ else if ($id > 0 || ! empty($ref)) // Linked object block $somethingshown=$object->showLinkedObjectBlock(); - if (empty($somethingshown) && $object->statut > 0) { + print '
'.$langs->trans('LinkedOrder').''; - print ''.$langs->trans('LinkedOrder').''; - - print ''; - } + // Link for paypal payment if (! empty($conf->paypal->enabled) && $object->statut != 0) { @@ -3946,20 +3955,4 @@ dol_htmloutput_mesg('',$mesgs); llxFooter(); $db->close(); -?> - - +?> \ No newline at end of file diff --git a/htdocs/compta/facture/admin/facture_cust_extrafields.php b/htdocs/compta/facture/admin/facture_cust_extrafields.php index 8d6fb63cf80..a44d67d87a9 100644 --- a/htdocs/compta/facture/admin/facture_cust_extrafields.php +++ b/htdocs/compta/facture/admin/facture_cust_extrafields.php @@ -52,7 +52,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/compta/facture/admin/facturedet_cust_extrafields.php b/htdocs/compta/facture/admin/facturedet_cust_extrafields.php index 6ec01f0ed6d..a0c560d52cb 100644 --- a/htdocs/compta/facture/admin/facturedet_cust_extrafields.php +++ b/htdocs/compta/facture/admin/facturedet_cust_extrafields.php @@ -53,7 +53,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 26d61d35919..6faeb1fa951 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -57,7 +57,12 @@ if ($user->societe_id > 0) $socid = $user->societe_id; } +// Initialize technical object to manage hooks of paiements. Note that conf->hooks_modules contains array array +$hookmanager = new HookManager($db); +$hookmanager->initHooks(array('paiementcard')); +$parameters=array('socid'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks /* * Action add_paiement et confirm_paiement @@ -579,6 +584,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } print ''; + $parameters=array(); + $reshook=$hookmanager->executeHooks('printObjectLine',$parameters,$objp,$action); // Note that $action and $object may have been modified by hook print "\n"; @@ -713,6 +720,10 @@ if (! GETPOST('action')) print ''.dol_print_date($db->jdate($objp->dp))."\n"; print ''.$objp->paiement_type.' '.$objp->num_paiement."\n"; print ''.price($objp->amount).' '; + + $parameters=array(); + $reshook=$hookmanager->executeHooks('printObjectLine',$parameters,$objp,$action); // Note that $action and $object may have been modified by hook + print ''; $i++; } diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index f86970afc0a..cd9169e1b2c 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -285,10 +285,10 @@ abstract class ActionsContactCardCommon } // Zip - $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip,'zipcode',array('town','selectcountry_id','departement_id'),6); + $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip,'zipcode',array('town','selectcountry_id','state_id'),6); // Town - $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town,'town',array('zipcode','selectcountry_id','departement_id')); + $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town,'town',array('zipcode','selectcountry_id','state_id')); if (dol_strlen(trim($this->object->country_id)) == 0) $this->object->country_id = $objsoc->country_id; @@ -432,9 +432,9 @@ abstract class ActionsContactCardCommon $this->object->address = $_POST["address"]; $this->object->zip = $_POST["zipcode"]; $this->object->town = $_POST["town"]; - $this->object->fk_departement = $_POST["departement_id"]; + $this->object->fk_departement = $_POST["state_id"]; $this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id; - $this->object->state_id = $_POST["departement_id"]; + $this->object->state_id = $_POST["state_id"]; $this->object->phone_pro = $_POST["phone_pro"]; $this->object->phone_perso = $_POST["phone_perso"]; $this->object->phone_mobile = $_POST["phone_mobile"]; diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index e044676a3bf..d00d789475e 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -130,7 +130,7 @@ if (empty($reshook)) $error=$object->error; $errors=$object->errors; } } - + /* * Confirmation desactivation @@ -152,7 +152,7 @@ if (empty($reshook)) $object->setstatus(1); header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); exit; - + } // Add contact if ($action == 'add' && $user->rights->societe->contact->creer) @@ -344,7 +344,7 @@ else if ($action == 'delete') { print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete",'',0,1); - + } } @@ -499,7 +499,7 @@ else } // Phone / Fax - if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->phone_pro)) == 0) $object->phone_pro = $objsoc->tel; // Predefined with third party + if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->phone_pro)) == 0) $object->phone_pro = $objsoc->phone; // Predefined with third party print ''.$langs->trans("PhonePro").'phone_pro).'">'; print ''.$langs->trans("PhonePerso").'phone_perso).'">'; @@ -735,7 +735,7 @@ else print ''; - + // Statut print ''.$langs->trans("Status").''; print ''; @@ -840,7 +840,7 @@ else else $text.=$langs->trans("UserWillBeInternalUser"); } print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("CreateDolibarrLogin"),$text,"confirm_create_user",$formquestion,'yes'); - + } print ''; @@ -945,7 +945,7 @@ else print ''; - + // Statut print ''; print '\n"; } diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 5045283abe3..cf47c22d1fa 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -210,7 +210,7 @@ function ajax_multiautocompleter($htmlname,$fields,$url,$option='',$minLength=2, jQuery("#'.$htmlname.'").val(item.value); // TODO move this to specific request if (item.states) { - jQuery("#departement_id").html(item.states); + jQuery("#state_id").html(item.states); } for (i=0;i 0) // Do not erase state if unknown { diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index f9c731c097a..5d57abe119c 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -5,7 +5,8 @@ * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Juanjo Menent - * + * Copyright (C) 2013 Christophe Battarel + * * * 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 @@ -546,7 +547,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print "\n".'
'.$langs->trans("Note").''; print nl2br($object->note); print '
'.$langs->trans("Status").''; diff --git a/htdocs/contact/vcard.php b/htdocs/contact/vcard.php index 48189eb60f6..76d73133e0f 100644 --- a/htdocs/contact/vcard.php +++ b/htdocs/contact/vcard.php @@ -70,7 +70,7 @@ $v->setTitle($contact->poste); if ($company->id) { $v->setURL($company->url, "WORK"); - if (! $contact->phone_pro) $v->setPhoneNumber($company->tel, "WORK;VOICE"); + if (! $contact->phone_pro) $v->setPhoneNumber($company->phone, "WORK;VOICE"); if (! $contact->fax) $v->setPhoneNumber($company->fax, "WORK;FAX"); if (! $contact->zip) $v->setAddress("", "", $company->address, $company->town, "", $company->zip, $company->country_code, "WORK;POSTAL"); if ($company->email != $contact->email) $v->setEmail($company->email,'internet'); diff --git a/htdocs/contrat/admin/contract_extrafields.php b/htdocs/contrat/admin/contract_extrafields.php index 22b07448462..c50872beee4 100644 --- a/htdocs/contrat/admin/contract_extrafields.php +++ b/htdocs/contrat/admin/contract_extrafields.php @@ -54,7 +54,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/core/admin_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php similarity index 99% rename from htdocs/core/admin_extrafields.inc.php rename to htdocs/core/actions_extrafields.inc.php index 0b608a1e736..4861ee6b856 100644 --- a/htdocs/core/admin_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -17,7 +17,7 @@ */ /** - * \file htdocs/core/admin_extrafields.inc.php + * \file htdocs/core/actions_extrafields.inc.php * \brief Code for actions on extrafields admin pages */ @@ -306,4 +306,4 @@ if ($action == 'delete') } } -?> +?> \ No newline at end of file diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php new file mode 100644 index 00000000000..f13113487c1 --- /dev/null +++ b/htdocs/core/actions_sendmails.inc.php @@ -0,0 +1,233 @@ + + * + * 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/actions_sendmails.inc.php + * \brief Code for actions on sending mails from object page + */ + + +// TODO Include this include file into all class objects + +// $id must be defined +// $actiontypecode must be defined + + +/* + * Add file in email form + */ +if (GETPOST('addfile')) +{ + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + // Set tmp user directory + $vardir=$conf->user->dir_output."/".$user->id; + $upload_dir_tmp = $vardir.'/temp'; + + dol_add_file_process($upload_dir_tmp,0,0); + $action='presend'; +} + +/* + * Remove file in email form + */ +if (! empty($_POST['removedfile'])) +{ + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + // Set tmp user directory + $vardir=$conf->user->dir_output."/".$user->id; + $upload_dir_tmp = $vardir.'/temp'; + + // TODO Delete only files that was uploaded from email form + dol_remove_file_process($_POST['removedfile'],0); + $action='presend'; +} + +/* + * Send mail + */ +if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel']) +{ + $langs->load('mails'); + + $subject='';$actionmsg='';$actionmsg2=''; + + $result=$object->fetch($id); + + $sendtosocid=0; + if (method_exists($object,"fetch_thirdparty") && $object->element != 'societe') + { + $result=$object->fetch_thirdparty(); + $thirdparty=$object->thirdparty; + $sendtosocid=$thirdparty->id; + } + else if ($object->element == 'societe') + { + $thirdparty=$object; + $sendtosocid=$thirdparty->id; + } + else dol_print_error('','Use actions_sendmails.in.php for a type that is not supported'); + + if ($result > 0) + { + if ($_POST['sendto']) + { + // Recipient is provided into free text + $sendto = $_POST['sendto']; + $sendtoid = 0; + } + elseif ($_POST['receiver'] != '-1') + { + // Recipient was provided from combo list + if ($_POST['receiver'] == 'thirdparty') // Id of third party + { + $sendto = $thirdparty->email; + $sendtoid = 0; + } + else // Id du contact + { + $sendto = $thirdparty->contact_get_property($_POST['receiver'],'email'); + $sendtoid = $_POST['receiver']; + } + } + + if (dol_strlen($sendto)) + { + $langs->load("commercial"); + + $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; + $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; + $message = $_POST['message']; + $sendtocc = $_POST['sendtocc']; + $deliveryreceipt = $_POST['deliveryreceipt']; + + if ($action == 'send' || $action == 'relance') + { + if (dol_strlen($_POST['subject'])) $subject = $_POST['subject']; + $actionmsg2=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; + if ($message) + { + $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; + $actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n"; + $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n"; + $actionmsg.=$message; + } + } + + // Create form object + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + + $attachedfiles=$formmail->get_attached_files(); + $filepath = $attachedfiles['paths']; + $filename = $attachedfiles['names']; + $mimetype = $attachedfiles['mimes']; + + // Send mail + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt,-1); + if ($mailfile->error) + { + $mesgs[]='
'.$mailfile->error.'
'; + } + else + { + $result=$mailfile->sendfile(); + if ($result) + { + $error=0; + + // Initialisation donnees + $object->socid = $sendtosocid; // To link to a company + $object->sendtoid = $sendtoid; // To link to a contact/address + $object->actiontypecode = $actiontypecode; + $object->actionmsg = $actionmsg; // Long text + $object->actionmsg2 = $actionmsg2; // Short text + $object->fk_element = $object->id; + $object->elementtype = $object->element; + + // Appel des triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($db); + $result=$interface->run_triggers('COMPANY_SENTBYMAIL',$object,$user,$langs,$conf); + if ($result < 0) { + $error++; $this->errors=$interface->errors; + } + // Fin appel triggers + + if ($error) + { + dol_print_error($db); + } + else + { + // Redirect here + // This avoid sending mail twice if going out and then back to page + $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); + setEventMessage($mesg); + header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.$object->id); + exit; + } + } + else + { + $langs->load("other"); + $mesg='
'; + if ($mailfile->error) + { + $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); + $mesg.='
'.$mailfile->error; + } + else + { + $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; + } + $mesg.='
'; + + setEventMessage($mesg,'warnings'); + $action = 'presend'; + } + } + /* } + else + { + $langs->load("other"); + $mesgs[]='
'.$langs->trans('ErrorMailRecipientIsEmpty').'
'; + dol_syslog('Recipient email is empty'); + }*/ + } + else + { + $langs->load("errors"); + setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("MailTo")),'warnings'); + dol_syslog('Try to send email with no recipiend defined', LOG_WARNING); + $action = 'presend'; + } + } + else + { + $langs->load("other"); + setEventMessage($langs->trans('ErrorFailedToReadEntity',$object->element),'errors'); + dol_syslog('Failed to read data of object id='.$object->id.' element='.$object->element); + $action = 'presend'; + } + +} + +?> \ No newline at end of file diff --git a/htdocs/core/ajax/ziptown.php b/htdocs/core/ajax/ziptown.php index 1f4b6acb6fb..294458d2352 100644 --- a/htdocs/core/ajax/ziptown.php +++ b/htdocs/core/ajax/ziptown.php @@ -116,7 +116,6 @@ if (! empty($_GET['zipcode']) || ! empty($_GET['town'])) $row_array['value'] = $row['town']; $row_array['zipcode'] = $row['zip']; } - $row_array['departement_id'] = $row['fk_county']; // deprecated $row_array['selectcountry_id'] = $row['fk_country']; $row_array['state_id'] = $row['fk_county']; diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index b0b9ad39317..2e0b41f9451 100644 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -79,7 +79,7 @@ class box_members extends ModeleBoxes $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedMembers",$max)); - if ($user->rights->societe->lire) + if ($user->rights->adherent->lire) { $sql = "SELECT a.rowid, a.lastname, a.firstname, a.societe as company, a.fk_soc,"; $sql.= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,"; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 6d89e18c77d..c6413b4beae 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -451,9 +451,10 @@ abstract class CommonObject * @param string $source 'internal', 'external' or 'all' * @param string $order Sort order by : 'code' or 'rowid' * @param string $option 0=Return array id->label, 1=Return array code->label + * @param string $activeonly 0=all type of contact, 1=only the active * @return array Array list of type of contacts (id->label if option=0, code->label if option=1) */ - function liste_type_contact($source='internal', $order='code', $option=0) + function liste_type_contact($source='internal', $order='code', $option=0, $activeonly=0) { global $langs; @@ -461,6 +462,9 @@ abstract class CommonObject $sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle"; $sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc"; $sql.= " WHERE tc.element='".$this->element."'"; + if ($activeonly == 1) + $sql.= " AND tc.active=1"; // only the active type + if (! empty($source)) $sql.= " AND tc.source='".$source."'"; $sql.= " ORDER by tc.".$order; @@ -2617,6 +2621,7 @@ abstract class CommonObject } } + /* This is to show add lines */ @@ -3129,53 +3134,80 @@ abstract class CommonObject // calcul des marges if (isset($line->fk_remise_except) && isset($conf->global->MARGIN_METHODE_FOR_DISCOUNT)) { // remise + $pa = $line->qty * $line->pa_ht; + $pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100); if ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '1') { // remise globale considérée comme produit - $marginInfos['pa_products'] += $line->pa_ht;// ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); - $marginInfos['pv_products'] += $line->subprice * (1 - $line->remise_percent / 100); - $marginInfos['pa_total'] += $line->pa_ht;// ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); - $marginInfos['pv_total'] += $line->subprice * (1 - $line->remise_percent / 100); + $marginInfos['pa_products'] += $pa; + $marginInfos['pv_products'] += $pv; + $marginInfos['pa_total'] += $pa; + $marginInfos['pv_total'] += $pv; + // if credit note, margin = -1 * (abs(selling_price) - buying_price) + if ($pv < 0) + $marginInfos['margin_on_products'] += -1 * (abs($pv) - $pa); + else + $marginInfos['margin_on_products'] += $pv - $pa; } elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '2') { // remise globale considérée comme service - $marginInfos['pa_services'] += $line->pa_ht;// ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); - $marginInfos['pv_services'] += $line->subprice * (1 - ($line->remise_percent / 100)); - $marginInfos['pa_total'] += $line->pa_ht;// ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); - $marginInfos['pv_total'] += $line->subprice * (1 - $line->remise_percent / 100); + $marginInfos['pa_services'] += $pa; + $marginInfos['pv_services'] += $pv; + $marginInfos['pa_total'] += $pa; + $marginInfos['pv_total'] += $pv; + // if credit note, margin = -1 * (abs(selling_price) - buying_price) + if ($pv < 0) + $marginInfos['margin_on_services'] += -1 * (abs($pv) - $pa); + else + $marginInfos['margin_on_services'] += $pv - $pa; } elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '3') { // remise globale prise en compte uniqt sur total - $marginInfos['pa_total'] += $line->pa_ht;// ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); - $marginInfos['pv_total'] += $line->subprice * (1 - ($line->remise_percent / 100)); + $marginInfos['pa_total'] += $pa; + $marginInfos['pv_total'] += $pv; } } else { $type=$line->product_type?$line->product_type:$line->fk_product_type; if ($type == 0) { // product - $marginInfos['pa_products'] += $line->qty * $line->pa_ht; - $marginInfos['pv_products'] += $line->qty * $line->subprice * (1 - $line->remise_percent / 100); - $marginInfos['pa_total'] += $line->qty * $line->pa_ht; - $marginInfos['pv_total'] += $line->qty * $line->subprice * (1 - $line->remise_percent / 100); + $pa = $line->qty * $line->pa_ht; + $pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100); + $marginInfos['pa_products'] += $pa; + $marginInfos['pv_products'] += $pv; + $marginInfos['pa_total'] += $pa; + $marginInfos['pv_total'] += $pv; + // if credit note, margin = -1 * (abs(selling_price) - buying_price) + if ($pv < 0) + $marginInfos['margin_on_products'] += -1 * (abs($pv) - $pa); + else + $marginInfos['margin_on_products'] += $pv - $pa; } elseif ($type == 1) { // service - $marginInfos['pa_services'] += $line->qty * $line->pa_ht; - $marginInfos['pv_services'] += $line->qty * $line->subprice * (1 - ($line->remise_percent / 100)); - $marginInfos['pa_total'] += $line->qty * $line->pa_ht; - $marginInfos['pv_total'] += $line->qty * $line->subprice * (1 - $line->remise_percent / 100); + $pa = $line->qty * $line->pa_ht; + $pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100); + $marginInfos['pa_services'] += $pa; + $marginInfos['pv_services'] += $pv; + $marginInfos['pa_total'] += $pa; + $marginInfos['pv_total'] += $pv; + // if credit note, margin = -1 * (abs(selling_price) - buying_price) + if ($pv < 0) + $marginInfos['margin_on_services'] += -1 * (abs($pv) - $pa); + else + $marginInfos['margin_on_services'] += $pv - $pa; } } } - - $marginInfos['margin_on_products'] = $marginInfos['pv_products'] - $marginInfos['pa_products']; if ($marginInfos['pa_products'] > 0) $marginInfos['margin_rate_products'] = 100 * round($marginInfos['margin_on_products'] / $marginInfos['pa_products'],5); if ($marginInfos['pv_products'] > 0) $marginInfos['mark_rate_products'] = 100 * round($marginInfos['margin_on_products'] / $marginInfos['pv_products'],5); - $marginInfos['margin_on_services'] = $marginInfos['pv_services'] - $marginInfos['pa_services']; if ($marginInfos['pa_services'] > 0) $marginInfos['margin_rate_services'] = 100 * round($marginInfos['margin_on_services'] / $marginInfos['pa_services'],5); if ($marginInfos['pv_services'] > 0) $marginInfos['mark_rate_services'] = 100 * round($marginInfos['margin_on_services'] / $marginInfos['pv_services'],5); - $marginInfos['total_margin'] = $marginInfos['pv_total'] - $marginInfos['pa_total']; + // if credit note, margin = -1 * (abs(selling_price) - buying_price) + if ($marginInfos['pv_total'] < 0) + $marginInfos['total_margin'] = -1 * (abs($marginInfos['pv_total']) - $marginInfos['pa_total']); + else + $marginInfos['total_margin'] = $marginInfos['pv_total'] - $marginInfos['pa_total']; if ($marginInfos['pa_total'] > 0) $marginInfos['total_margin_rate'] = 100 * round($marginInfos['total_margin'] / $marginInfos['pa_total'],5); if ($marginInfos['pv_total'] > 0) diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 01052d7f642..a6210be79c6 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -191,7 +191,7 @@ class FormCompany * @param string $htmlname Id of department * @return void */ - function select_departement($selected='',$country_codeid=0, $htmlname='departement_id') + function select_departement($selected='',$country_codeid=0, $htmlname='state_id') { print $this->select_state($selected,$country_codeid, $htmlname); } @@ -208,7 +208,7 @@ class FormCompany * @param string $htmlname Id of department * @return string String with HTML select */ - function select_state($selected='',$country_codeid=0, $htmlname='departement_id') + function select_state($selected='',$country_codeid=0, $htmlname='state_id') { global $conf,$langs,$user; @@ -627,7 +627,7 @@ class FormCompany { if (is_object($object) && method_exists($object, 'liste_type_contact')) { - $lesTypes = $object->liste_type_contact($source, $order); + $lesTypes = $object->liste_type_contact($source, $order, 0, 1); print 'withtopic) .'" />'; + $out.= 'withtopic)?'':$this->withtopic)) .'" />'; } $out.= "
'."\n"; - $colspan=6; + $colspan=8; print ''; print ''; print ''; @@ -561,10 +562,16 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $colspan++; print ''; } + if ($user->rights->societe->contact->creer) + { + $colspan++; + print ''; + } print ""; $sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays, p.poste, p.phone, p.phone_mobile, p.fax, p.email, p.statut "; + $sql .= ", p.civilite, p.address, p.zip, p.town"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; $sql .= " WHERE p.fk_soc = ".$object->id; $sql .= " ORDER by p.datec"; @@ -592,17 +599,17 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print ''; - $country_code = getCountry($obj->fk_pays, 2); + $country_code = getCountry($obj->fk_pays, 'all'); // Lien click to dial print ''; print ''; print ''; print ''; elseif ($obj->statut==1) print ''; + + // copy in clipboard + $coords = ''; + if (!empty($object->name)) + $coords .= addslashes($object->name)."
"; + if (!empty($obj->civilite)) + $coords .= addslashes($obj->civilite).' '; + if (!empty($obj->firstname)) + $coords .= addslashes($obj->firstname).' '; + if (!empty($obj->lastname)) + $coords .= addslashes($obj->lastname); + $coords .= "
"; + if (!empty($obj->address)) + { + $coords .= addslashes(dol_nl2br($obj->address,1,true))."
"; + if (!empty($obj->cp)) + $coords .= addslashes($obj->zip).' '; + if (!empty($obj->ville)) + $coords .= addslashes($obj->town); + if (!empty($obj->pays)) + $coords .= "
".addslashes($country_code['label']); + } + elseif (!empty($object->address)) + { + $coords .= addslashes(dol_nl2br($object->address,1,true))."
"; + if (!empty($object->zip)) + $coords .= addslashes($object->zip).' '; + if (!empty($object->town)) + $coords .= addslashes($object->town); + if (!empty($object->country)) + $coords .= "
".addslashes($object->country); + } + print ''; + if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { print '
'.$langs->trans("Name").''.$langs->trans("Poste").'  
'.$obj->poste.''; - print dol_print_phone($obj->phone,$country_code,$obj->rowid,$object->id,'AC_TEL'); + print dol_print_phone($obj->phone,$country_code['code'],$obj->rowid,$object->id,'AC_TEL'); print ''; - print dol_print_phone($obj->phone_mobile,$country_code,$obj->rowid,$object->id,'AC_TEL'); + print dol_print_phone($obj->phone_mobile,$country_code['code'],$obj->rowid,$object->id,'AC_TEL'); print ''; - print dol_print_phone($obj->fax,$country_code,$obj->rowid,$object->id,'AC_FAX'); + print dol_print_phone($obj->fax,$country_code['code'],$obj->rowid,$object->id,'AC_FAX'); print ''; print dol_print_email($obj->email,$obj->rowid,$object->id,'AC_EMAIL'); @@ -610,6 +617,42 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') if ($obj->statut==0) print ''.$langs->trans('Disabled').' '.img_picto($langs->trans('StatusContactDraftShort'),'statut0').''.$langs->trans('Enabled').' '.img_picto($langs->trans('StatusContactValidatedShort'),'statut1').''; + print img_picto($langs->trans("Address"), 'object_address.png'); + print ''; @@ -648,6 +691,20 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print "\n
\n"; print "
\n"; +?> + + + function copyToClipboard (text) { + text = text.replace(/
/g,"\n"); + var newElem = "

'.$langs->trans('HelpCopyToClipboard').'"; + $("#dialog").html(newElem); + $( "#dialog" ).dialog(); + $("#coords").select(); + return false; + } + '; return $i; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 78e9ec1f2a8..e2dc4db52af 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4095,14 +4095,14 @@ function dol_osencode($str) /** - * Return an id or code from a code or id. Store Code-Id in a cache. + * Return an id or code from a code or id. Store also Code-Id into a cache for next use. * * @param DoliDB $db Database handler * @param string $key Code to get Id * @param string $tablename Table name without prefix * @param string $fieldkey Field for code * @param string $fieldid Field for id - * @return int Id of code + * @return int <0 if KO, Id of code if OK * @see getLabelFromKey */ function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id') @@ -4121,7 +4121,7 @@ function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id') $sql = "SELECT ".$fieldid." as id"; $sql.= " FROM ".MAIN_DB_PREFIX.$tablename; $sql.= " WHERE ".$fieldkey." = '".$key."'"; - dol_syslog('dol_getIdFromCode sql='.$sql,LOG_DEBUG); + dol_syslog('dol_getIdFromCode sql='.$sql, LOG_DEBUG); $resql = $db->query($sql); if ($resql) { @@ -4133,7 +4133,7 @@ function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id') } else { - dol_syslog("dol_getIdFromCode error=".$db->lasterror(),LOG_ERR); + dol_syslog("dol_getIdFromCode error=".$db->lasterror(), LOG_ERR); return -1; } } diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 25fa766aa3d..216887139d4 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -52,7 +52,7 @@ function commande_prepare_head($object) || ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire)) { $head[$h][0] = DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id; - if ($conf->expedition_bon->enabled) $text=$langs->trans("Sendings"); + if ($conf->expedition_bon->enabled) $text=$langs->trans("Shipment"); if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) $text.='/'; if ($conf->livraison_bon->enabled) $text.=$langs->trans("Receivings"); $head[$h][1] = $text; @@ -93,7 +93,7 @@ function commande_prepare_head($object) $head[$h][2] = 'note'; $h++; } - + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir,'files')); @@ -137,7 +137,7 @@ function order_admin_prepare_head($object) $head[$h][1] = $langs->trans("ExtraFields"); $head[$h][2] = 'attributes'; $h++; - + $head[$h][0] = DOL_URL_ROOT.'/admin/orderdet_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); $head[$h][2] = 'attributeslines'; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 5d0facb4bdb..cffa4ff6a6d 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -312,7 +312,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target if (empty($conf->global->MAIN_PDF_DISABLESOURCEDETAILS)) { // Tel - if ($sourcecompany->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($sourcecompany->tel); + if ($sourcecompany->phone) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($sourcecompany->phone); // Fax if ($sourcecompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($sourcecompany->fax); // EMail @@ -345,7 +345,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS)) { // Tel - if ($targetcontact->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcontact->tel); + if ($targetcontact->phone) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcontact->phone); // Fax if ($targetcontact->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax); // EMail @@ -363,7 +363,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS)) { // Tel - if ($targetcompany->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcompany->tel); + if ($targetcompany->phone) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcompany->phone); // Fax if ($targetcompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax); // EMail @@ -459,7 +459,7 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text) elseif ($unit=='in') $k=72; $savx=$pdf->getX(); $savy=$pdf->getY(); - + $watermark_angle=atan($h/$w)/2; $watermark_x_pos=0; $watermark_y_pos=$h/3; @@ -1031,7 +1031,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl $libelleproduitservice=$prefix_prodserv.$ref_prodserv.$libelleproduitservice; } } - + // Add an additional description for the category products if (! empty($conf->global->CATEGORY_ADD_DESC_INTO_DOC) && $idprod && ! empty($conf->categorie->enabled)) { @@ -1047,7 +1047,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl $libelleproduitservice.='__N__'.$desccateg; } } - + if (! empty($object->lines[$i]->date_start) || ! empty($object->lines[$i]->date_end)) { $format='day'; diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index 34ab3bb5355..435567bebae 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -48,7 +48,7 @@ function propal_prepare_head($object) { $langs->load("sendings"); $head[$h][0] = DOL_URL_ROOT.'/expedition/propal.php?id='.$object->id; - if ($conf->expedition_bon->enabled) $text=$langs->trans("Sendings"); + if ($conf->expedition_bon->enabled) $text=$langs->trans("Shipment"); if ($conf->livraison_bon->enabled) $text.='/'.$langs->trans("Receivings"); $head[$h][1] = $text; $head[$h][2] = 'shipping'; @@ -135,7 +135,7 @@ function propal_admin_prepare_head($object) $head[$h][1] = $langs->trans("ExtraFields"); $head[$h][2] = 'attributes'; $h++; - + $head[$h][0] = DOL_URL_ROOT.'/comm/admin/propaldet_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); $head[$h][2] = 'attributeslines'; diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index e19ed1eb7fa..58bd4371b4c 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -215,7 +215,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature { foreach($feature2 as $subfeature) { - if (empty($user->rights->$feature->$subfeature->creer) + if (empty($user->rights->$feature->$subfeature->creer) && empty($user->rights->$feature->$subfeature->write) && empty($user->rights->$feature->$subfeature->create)) $createok=0; else { $createok=1; break; } // For bypass the second test if the first is ok @@ -411,7 +411,8 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature // If external user: Check permission for external users if ($user->societe_id > 0) { - $sql = "SELECT dbt.".$dbt_keyfield; + if (empty($dbt_keyfield)) dol_print_error('','Param dbt_keyfield is required but not defined'); + $sql = "SELECT dbt.".$dbt_keyfield; $sql.= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; $sql.= " WHERE dbt.rowid = ".$objectid; $sql.= " AND dbt.".$dbt_keyfield." = ".$user->societe_id; @@ -419,6 +420,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature // If internal user: Check permission for internal users that are restricted on their objects else if (! empty($conf->societe->enabled) && ($user->rights->societe->lire && ! $user->rights->societe->client->voir)) { + if (empty($dbt_keyfield)) dol_print_error('','Param dbt_keyfield is required but not defined'); $sql = "SELECT sc.fk_soc"; $sql.= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index 614ccbcc0c1..dc189262bb2 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -172,10 +172,10 @@ class pdf_merou extends ModelePdfExpedition if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); - $pdf->SetSubject($outputlangs->transnoentities("Sending")); + $pdf->SetSubject($outputlangs->transnoentities("Shipment")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Sending")); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Shipment")); 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 diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index a541b7b2b1e..4394c3200f5 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -157,10 +157,10 @@ class pdf_rouget extends ModelePdfExpedition if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); - $pdf->SetSubject($outputlangs->transnoentities("Sending")); + $pdf->SetSubject($outputlangs->transnoentities("Shipment")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Sending")); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Shipment")); 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 diff --git a/htdocs/core/modules/expedition/mod_expedition_ribera.php b/htdocs/core/modules/expedition/mod_expedition_ribera.php index ddbc494622c..f40d3d361a0 100644 --- a/htdocs/core/modules/expedition/mod_expedition_ribera.php +++ b/htdocs/core/modules/expedition/mod_expedition_ribera.php @@ -53,10 +53,10 @@ class mod_expedition_ribera extends ModelNumRefExpedition $texte.= ''; $texte.= ''; - $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Sending"),$langs->transnoentities("Sending")); + $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Shipment"),$langs->transnoentities("Shipment")); $tooltip.=$langs->trans("GenericMaskCodes2"); $tooltip.=$langs->trans("GenericMaskCodes3"); - $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Sending"),$langs->transnoentities("Sending")); + $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Shipment"),$langs->transnoentities("Shipment")); $tooltip.=$langs->trans("GenericMaskCodes5"); $texte.= ''; diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index ebba9b38572..bdb35d67fbe 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -697,6 +697,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $posy+=2; // Add list of linked orders on shipment + // Currently not supported by pdf_writeLinkedObjects, link for delivery to order is done through shipment) if ($object->origin == 'expedition' || $object->origin == 'shipping') { $Yoff=$posy-5; @@ -708,7 +709,6 @@ class pdf_typhon extends ModelePDFDeliveryOrder $origin = $shipment->origin; $origin_id = $shipment->origin_id; - // TODO move to external function if ($conf->$origin->enabled) { $outputlangs->load('orders'); diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 7b3b73c22f5..1c22c61f3db 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -44,7 +44,7 @@ class modAgenda extends DolibarrModules function __construct($db) { global $conf; - + $this->db = $db; $this->numero = 2400; @@ -74,6 +74,7 @@ class modAgenda extends DolibarrModules // Constantes //----------- $this->const = array(); + $this->const[15] = array("MAIN_AGENDA_ACTIONAUTO_COMPANY_SENTBYMAIL","chaine","1"); $this->const[0] = array("MAIN_AGENDA_ACTIONAUTO_COMPANY_CREATE","chaine","1"); $this->const[1] = array("MAIN_AGENDA_ACTIONAUTO_CONTRACT_VALIDATE","chaine","1"); $this->const[2] = array("MAIN_AGENDA_ACTIONAUTO_PROPAL_VALIDATE","chaine","1"); @@ -166,7 +167,7 @@ class modAgenda extends DolibarrModules $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'export'; - + // Main menu entries $this->menu = array(); // List of menus to add $r=0; @@ -376,7 +377,7 @@ class modAgenda extends DolibarrModules 'a.datea'=>'Date','a.datea2'=>'Date','a.percent'=>'Numeric','a.fk_user_author'=>'List:user:name','a.fk_user_action'=>'List:user:name', 'a.fk_user_done'=>"List:user:name","a.priority"=>"Numeric","a.fulldayevent"=>"Boolean","a.location"=>"Text", "a.fk_soc"=>"List:Societe:nom","a.fk_contact"=>"List:socpeople:name","a.fk_action"=>"List:c_actioncomm:libelle:code"); - + $this->export_entities_array[$r]=array('a.id'=>'action','a.label'=>'action','a.datep'=>'action','a.datep2'=>'action', 'a.datea'=>'action','a.datea2'=>'action','a.percent'=>'action','a.fk_user_author'=>'action','a.fk_user_action'=>'action', 'a.fk_user_done'=>"action","a.priority"=>"action","a.fulldayevent"=>"action","a.location"=>"action", diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index 7b9ec52aef6..584a8e3494f 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -176,27 +176,34 @@ class modProjet extends DolibarrModules $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]='ProjectsAndTasksLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r]=array(array("projet","export")); + $this->export_dependencies_array[$r]=array('task_time'=>'ppt.rowid'); + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country', - 's.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode', - 'p.rowid'=>"ProjectId",'p.ref'=>"ProjectRef",'p.datec'=>"DateCreation",'p.dateo'=>"DateDebutProjet",'p.datee'=>"DateFinProjet",'p.fk_statut'=>'ProjectStatus','p.description'=>"projectNote", - 'pt.rowid'=>'RefTask','pt.dateo'=>"TaskDateo",'pt.datee'=>"TaskDatee",'pt.duration_effective'=>"DurationEffective",'pt.planned_workload'=>"DurationPlanned",'pt.progress'=>"Progress",'pt.description'=>"TaskDesc"); + 's.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode', + 'p.rowid'=>"ProjectId",'p.ref'=>"ProjectRef",'p.datec'=>"DateCreation",'p.dateo'=>"DateDebutProjet",'p.datee'=>"DateFinProjet",'p.fk_statut'=>'ProjectStatus','p.description'=>"projectNote", + 'pt.rowid'=>'RefTask','pt.dateo'=>"TaskDateo",'pt.datee'=>"TaskDatee",'pt.duration_effective'=>"DurationEffective",'pt.planned_workload'=>"DurationPlanned",'pt.progress'=>"Progress",'pt.description'=>"TaskDesc", + 'ptt.task_date'=>'TaskTimeDate','ptt.task_duration'=>"TimesSpent",'ptt.fk_user'=>"TaskTimeUser",'ptt.note'=>"TaskTimeNote"); - //$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_pays:libelle', - $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_pays:libelle', - 's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text', - 'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','p.description'=>"Text", - 'pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Duree",'pt.progress'=>"Number",'pt.description'=>"Text"); - - $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company', - 's.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company', - 'f.rowid'=>"project",'f.ref'=>"project",'f.datec'=>"project",'f.duree'=>"project",'f.fk_statut'=>"project",'f.description'=>"project", - 'pt.rowid'=>'task','pt.dateo'=>"task",'pt.datee'=>"task",'pt.duration_effective'=>"task",'pt.planned_workload'=>"task",'pt.progress'=>"task",'pt.description'=>"task"); + $this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_pays:libelle', + 's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text', + 'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','p.description'=>"Text", + 'pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Number",'pt.progress'=>"Number",'pt.description'=>"Text", + 'ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:Name",'ptt.note'=>"Text"); + $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company', + 's.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company', + 'f.rowid'=>"project",'f.ref'=>"project",'f.datec'=>"project",'f.duree'=>"project",'f.fk_statut'=>"project",'f.description'=>"project", + 'pt.rowid'=>'task','pt.dateo'=>"task",'pt.datee'=>"task",'pt.duration_effective'=>"task",'pt.planned_workload'=>"task",'pt.progress'=>"task",'pt.description'=>"task", + 'ptt.task_date'=>'task_time','ptt.task_duration'=>"task_time",'ptt.fk_user'=>"task_time",'ptt.note'=>"task_time"); + + $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'projet as p, '.MAIN_DB_PREFIX.'projet_task as pt, '.MAIN_DB_PREFIX.'societe as s)'; - $this->export_sql_end[$r] .=' WHERE p.fk_soc = s.rowid AND p.rowid = pt.fk_projet '; + $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'projet as p, '.MAIN_DB_PREFIX.'societe as s)'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task as pt ON (p.rowid = pt.fk_projet)"; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON (pt.rowid = ptt.fk_task)"; + $this->export_sql_end[$r] .=' WHERE p.fk_soc = s.rowid'; $this->export_sql_end[$r] .=' AND p.entity = '.$conf->entity; - $r++; + } diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index ac05f71b901..c77e24e8bbd 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -141,13 +141,21 @@ if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { $margin_rate = (isset($_POST["marginRate"])?$_POST["marginRate"]:(($line->pa_ht == 0)?'':price($line->marge_tx))); - echo ''; + // if credit note, dont allow to modify margin + if ($line->subprice < 0) + echo ''; + else + echo ''; $coldisplay++; } elseif (! empty($conf->global->DISPLAY_MARK_RATES)) { $mark_rate = (isset($_POST["markRate"])?$_POST["markRate"]:price($line->marque_tx)); - echo ''; + // if credit note, dont allow to modify margin + if ($line->subprice < 0) + echo ''; + else + echo ''; $coldisplay++; } } diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 623f1340b5b..b089b5487a7 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -140,6 +140,20 @@ class InterfaceActionsAuto $object->socid=$object->id; $ok=1; } + elseif ($action == 'COMPANY_SENTBYMAIL') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("orders"); + $langs->load("agenda"); + + if (empty($object->actiontypecode)) $object->actiontypecode='AC_OTH_AUTO'; + if (empty($object->actionmsg2)) dol_syslog('Trigger called with property actionmsg2 on object not defined', LOG_ERR); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + // Parameters $object->sendtoid defined by caller + //$object->sendtoid=0; + $ok=1; + } elseif ($action == 'CONTRACT_VALIDATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); @@ -625,7 +639,7 @@ class InterfaceActionsAuto $error ="Failed to insert event : ".$actioncomm->error." ".join(',',$actioncomm->errors); $this->error=$error; $this->errors=$actioncomm->errors; - + dol_syslog("interface_modAgenda_ActionsAuto.class.php: ".$this->error, LOG_ERR); return -1; } diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index bd396f0e8f5..ef5faa79e3b 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -153,7 +153,7 @@ if ($id > 0 || ! empty($ref)) $langs->trans("OrderCard"); $head = shipping_prepare_head($object); - dol_fiche_head($head, 'contact', $langs->trans("Sending"), 0, 'sending'); + dol_fiche_head($head, 'contact', $langs->trans("Shipment"), 0, 'sending'); /* diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index f0d6e5fd8bd..c586329d4c9 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -61,9 +61,6 @@ $socid=''; if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user, $origin, $origin_id); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('expeditioncard')); - $action = GETPOST('action','alpha'); $confirm = GETPOST('confirm','alpha'); @@ -73,6 +70,11 @@ $hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty( $hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); $object = new Expedition($db); +// Load object +if ($id > 0 || ! empty($ref)) +{ + $ret=$object->fetch($id, $ref); +} // Load object if ($id > 0 || ! empty($ref)) @@ -80,14 +82,19 @@ if ($id > 0 || ! empty($ref)) $ret=$object->fetch($id, $ref); } +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('expeditioncard')); + /* * Actions */ +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if ($action == 'add') { $error=0; - + $object = new Expedition($db); $db->begin(); @@ -517,7 +524,7 @@ else if ($action == 'classifybilled') * View */ -llxHeader('',$langs->trans('Sending'),'Expedition'); +llxHeader('',$langs->trans('Shipment'),'Expedition'); $form = new Form($db); $formfile = new FormFile($db); @@ -916,7 +923,7 @@ else $soc->fetch($object->socid); $head=shipping_prepare_head($object); - dol_fiche_head($head, 'shipping', $langs->trans("Sending"), 0, 'sending'); + dol_fiche_head($head, 'shipping', $langs->trans("Shipment"), 0, 'sending'); dol_htmloutput_mesg($mesg); @@ -926,7 +933,7 @@ else if ($action == 'delete') { print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('DeleteSending'),$langs->trans("ConfirmDeleteSending",$object->ref),'confirm_delete','',0,1); - + } /* @@ -955,7 +962,7 @@ else } print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('ValidateSending'),$text,'confirm_valid','',0,1); - + } /* * Confirmation de l'annulation @@ -963,7 +970,7 @@ else if ($action == 'annuler') { print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('CancelSending'),$langs->trans("ConfirmCancelSending",$object->ref),'confirm_cancel','',0,1); - + } // Calculate true totalWeight and totalVolume for all products diff --git a/htdocs/expedition/index.php b/htdocs/expedition/index.php index 94dd06c5b73..33082aa9193 100644 --- a/htdocs/expedition/index.php +++ b/htdocs/expedition/index.php @@ -39,7 +39,7 @@ $companystatic=new Societe($db); $shipment=new Expedition($db); $helpurl='EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones'; -llxHeader('',$langs->trans("Sendings"),$helpurl); +llxHeader('',$langs->trans("Shipment"),$helpurl); print_fiche_titre($langs->trans("SendingsArea")); diff --git a/htdocs/expedition/note.php b/htdocs/expedition/note.php index 2fcd18fef13..d0300dad278 100644 --- a/htdocs/expedition/note.php +++ b/htdocs/expedition/note.php @@ -88,7 +88,7 @@ if ($id > 0 || ! empty($ref)) $soc->fetch($object->socid); $head=shipping_prepare_head($object); - dol_fiche_head($head, 'note', $langs->trans("Sending"), 0, 'sending'); + dol_fiche_head($head, 'note', $langs->trans("Shipment"), 0, 'sending'); print '
'.$langs->trans("Mask").':%'.$margin_rate.'%%%'.$mark_rate.'%%
'; diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index c152895c0d7..aefe5490802 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -506,9 +506,9 @@ if ($step == 2 && $datatoexport) print ''; print ''; print ''; print ''; print ''; diff --git a/htdocs/fichinter/admin/fichinter_extrafields.php b/htdocs/fichinter/admin/fichinter_extrafields.php index c094e97666a..f503e9a184e 100644 --- a/htdocs/fichinter/admin/fichinter_extrafields.php +++ b/htdocs/fichinter/admin/fichinter_extrafields.php @@ -53,7 +53,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php index 2dfe52cf5df..27beceeb979 100644 --- a/htdocs/fourn/fiche.php +++ b/htdocs/fourn/fiche.php @@ -155,7 +155,7 @@ if ($object->fetch($id)) print ''; // Phone - print ''; + print ''; // Fax print ''; diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index f8e444470c3..dc949344ee6 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -47,7 +47,7 @@ class Holiday extends CommonObject var $date_debut=''; var $date_fin=''; var $halfday=''; - var $statut=''; + var $statut=''; // 1=draft, 2=validated, 3=approved var $fk_validator; var $date_valid=''; var $fk_user_valid; @@ -871,7 +871,7 @@ class Holiday extends CommonObject * * @param int $userID Id of user * @param int $nbHoliday Nb of days - * @return void + * @return int 0=Nothing done, 1=OK, -1=KO */ function updateSoldeCP($userID='',$nbHoliday='') { @@ -907,7 +907,7 @@ class Holiday extends CommonObject $i = 0; - while($i < $nbUser) + while ($i < $nbUser) { $now_holiday = $this->getCPforUser($users[$i]['rowid']); $new_solde = $now_holiday + $this->getConfCP('nbHolidayEveryMonth'); @@ -922,11 +922,18 @@ class Holiday extends CommonObject $sql2.= " nb_holiday = nb_holiday + ".$nb_holiday; dol_syslog(get_class($this).'::updateSoldeCP sql='.$sql2); - $this->db->query($sql2); + $result= $this->db->query($sql2); + + if ($result) return 1; + else return -1; } - } else { + + return 0; + } + else + { // Mise à jour pour un utilisateur - $nbHoliday = number_format($nbHoliday,2,'.',''); + $nbHoliday = price2num($nbHoliday,2); // Mise à jour pour un utilisateur $sql = "UPDATE ".MAIN_DB_PREFIX."holiday_users SET"; @@ -934,7 +941,10 @@ class Holiday extends CommonObject $sql.= " WHERE fk_user = '".$userID."'"; dol_syslog(get_class($this).'::updateSoldeCP sql='.$sql); - $this->db->query($sql); + $result = $this->db->query($sql); + + if ($result) return 1; + else return -1; } } diff --git a/htdocs/holiday/fiche.php b/htdocs/holiday/fiche.php index 8176a80938c..01c2e1fb5a1 100644 --- a/htdocs/holiday/fiche.php +++ b/htdocs/holiday/fiche.php @@ -1,8 +1,8 @@ - * Copyright (C) 2012 Laurent Destailleur - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2013 Juanjo Menent +/* Copyright (C) 2011 Dimitri Mouillard + * Copyright (C) 2012-2013 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2013 Juanjo Menent * * 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 @@ -46,9 +46,9 @@ $user_id = $user->id; $now=dol_now(); -/******************************************************************* +/* * Actions -********************************************************************/ + */ // Si création de la demande if ($action == 'create') @@ -232,27 +232,41 @@ if ($action == 'update') } // Si suppression de la demande -if ($action == 'confirm_delete' && $_GET['confirm'] == 'yes') +if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes') { if($user->rights->holiday->delete) { + $error=0; + + $db->begin(); + $cp = new Holiday($db); $cp->fetch($id); // Si c'est bien un brouillon - if ($cp->statut == 1) + if ($cp->statut == 1 || $cp->statut == 3) { // Si l'utilisateur à le droit de lire cette demande, il peut la supprimer if ($user->id == $cp->fk_user || $user->rights->holiday->lire_tous) { - $cp->delete($id); - header('Location: index.php'); - exit; + $result=$cp->delete($id); } - else { + else + { $error = $langs->trans('ErrorCantDeleteCP'); } } + + if (! $error) + { + $db->commit(); + header('Location: index.php'); + exit; + } + else + { + $db->rollback(); + } } } @@ -315,9 +329,9 @@ if ($action == 'confirm_send') } // Si l'option pour avertir le valideur en cas de solde inférieur à la demande - if($cp->getConfCP('AlertValidatorSolde')) + if ($cp->getConfCP('AlertValidatorSolde')) { - $nbopenedday=num_open_day($cp->date_debut,$cp->date_fin,0,1); + $nbopenedday=num_open_day($cp->date_debut,$cp->date_fin,0,1,$cp->halfday); if ($nbopenedday > $cp->getCPforUser($cp->fk_user)) { $message.= "\n"; @@ -361,9 +375,8 @@ if($action == 'confirm_valid') $cp->fetch($id); // Si statut en attente de validation et valideur = utilisateur - if($cp->statut == 2 && $user->id == $cp->fk_validator) + if ($cp->statut == 2 && $user->id == $cp->fk_validator) { - $cp->date_valid = dol_now(); $cp->fk_user_valid = $user->id; $cp->statut = 3; @@ -371,13 +384,13 @@ if($action == 'confirm_valid') $verif = $cp->update($user->id); // Si pas d'erreur SQL on redirige vers la fiche de la demande - if($verif > 0) { - - // Retrait du nombre de jours prit - $nbJour = $nbopenedday=num_open_day($cp->date_debut,$cp->date_fin,0,1); + if ($verif > 0) + { + // Calculcate number of days consummed + $nbopenedday=num_open_day($cp->date_debut,$cp->date_fin,0,1); $soldeActuel = $cp->getCpforUser($cp->fk_user); - $newSolde = $soldeActuel - ($nbJour*$cp->getConfCP('nbHolidayDeducted')); + $newSolde = $soldeActuel - ($nbopenedday * $cp->getConfCP('nbHolidayDeducted')); // On ajoute la modification dans le LOG $cp->addLogCP($user->id, $cp->fk_user, $langs->transnoentitiesnoconv("Holidays"), $newSolde); @@ -441,13 +454,13 @@ if($action == 'confirm_valid') if ($action == 'confirm_refuse') { - if(!empty($_POST['detail_refuse'])) + if (!empty($_POST['detail_refuse'])) { $cp = new Holiday($db); $cp->fetch($_GET['id']); // Si statut en attente de validation et valideur = utilisateur - if($cp->statut == 2 && $user->id == $cp->fk_validator) + if ($cp->statut == 2 && $user->id == $cp->fk_validator) { $cp->date_refuse = date('Y-m-d H:i:s', time()); $cp->fk_user_refuse = $user->id; @@ -457,8 +470,8 @@ if ($action == 'confirm_refuse') $verif = $cp->update($user->id); // Si pas d'erreur SQL on redirige vers la fiche de la demande - if($verif > 0) { - + if ($verif > 0) + { // To $destinataire = new User($db); $destinataire->fetch($cp->fk_user); @@ -525,16 +538,48 @@ if ($action == 'confirm_cancel' && GETPOST('confirm') == 'yes') $cp->fetch($_GET['id']); // Si statut en attente de validation et valideur = utilisateur - if ($cp->statut == 2 && ($user->id == $cp->fk_validator || $user->id == $cp->fk_user)) + if (($cp->statut == 2 || $cp->statut == 3) && ($user->id == $cp->fk_validator || $user->id == $cp->fk_user)) { + $db->begin(); + + $oldstatus = $cp->statut; $cp->date_cancel = dol_now(); $cp->fk_user_cancel = $user->id; $cp->statut = 4; - $verif = $cp->update($user->id); + $result = $cp->update($user->id); + if ($result >= 0 && $oldstatus == 3) // holiday was already validated, status 3, so we must increase back sold + { + // Calculcate number of days consummed + $nbopenedday=num_open_day($cp->date_debut,$cp->date_fin,0,1,$cp->halfday); + + $soldeActuel = $cp->getCpforUser($cp->fk_user); + $newSolde = $soldeActuel + ($nbopenedday * $cp->getConfCP('nbHolidayDeducted')); + + // On ajoute la modification dans le LOG + $result1=$cp->addLogCP($user->id, $cp->fk_user, $langs->transnoentitiesnoconv("HolidaysCancelation"), $newSolde); + + // Mise à jour du solde + $result2=$cp->updateSoldeCP($cp->fk_user, $newSolde); + + if ($result1 < 0 || $result2 < 0) + { + $error = $langs->trans('ErrorCantDeleteCP'); + } + } + + if (! $error) + { + $db->commit(); + } + else + { + $db->rollback(); + } + // Si pas d'erreur SQL on redirige vers la fiche de la demande - if($verif > 0) + if (! $error && $result > 0) { // To $destinataire = new User($db); @@ -829,11 +874,11 @@ else if($user->id == $cp->fk_user || $user->rights->holiday->lire_tous) { - if ($action == 'delete' && $cp->statut == 1) { + if ($action == 'delete') + { if($user->rights->holiday->delete) { print $form->formconfirm("fiche.php?id=".$id,$langs->trans("TitleDeleteCP"),$langs->trans("ConfirmDeleteCP"),"confirm_delete", '', 0, 1); - if ($ret == 'html') print '
'; } } @@ -841,29 +886,25 @@ else if ($action == 'sendToValidate' && $cp->statut == 1 && $user->id == $cp->fk_user) { print $form->formconfirm("fiche.php?id=".$id,$langs->trans("TitleToValidCP"),$langs->trans("ConfirmToValidCP"),"confirm_send", '', 1, 1); - if ($ret == 'html') print '
'; } // Si validation de la demande - if ($action == 'valid' && $cp->statut == 2 && $user->id == $cp->fk_validator) + if ($action == 'valid') { print $form->formconfirm("fiche.php?id=".$id,$langs->trans("TitleValidCP"),$langs->trans("ConfirmValidCP"),"confirm_valid", '', 1, 1); - if ($ret == 'html') print '
'; } // Si refus de la demande - if ($action == 'refuse' && $cp->statut == 2 && $user->id == $cp->fk_validator) + if ($action == 'refuse') { $array_input = array(array('type'=>"text",'label'=> $langs->trans('DetailRefusCP'),'name'=>"detail_refuse",'size'=>"50",'value'=>"")); print $form->formconfirm("fiche.php?id=".$id."&action=confirm_refuse", $langs->trans("TitleRefuseCP"), $langs->trans('ConfirmRefuseCP'), "confirm_refuse", $array_input, 1, 0); - if ($ret == 'html') print '
'; } // Si annulation de la demande - if ($action == 'cancel' && $cp->statut == 2 && ($user->id == $cp->fk_validator || $user->id == $cp->fk_user)) + if ($action == 'cancel') { print $form->formconfirm("fiche.php?id=".$id,$langs->trans("TitleCancelCP"),$langs->trans("ConfirmCancelCP"),"confirm_cancel", '', 1, 1); - if ($ret == 'html') print '
'; } $head=holiday_prepare_head($cp); @@ -893,7 +934,8 @@ else $starthalfday=($cp->halfday == -1 || $cp->halfday == 2)?'afternoon':'morning'; $endhalfday=($cp->halfday == 1 || $cp->halfday == 2)?'morning':'afternoon'; - if(!$edit) { + if(!$edit) + { print '
'; print ''; print ''; print ''; - } else { + } + else + { print ''; print ''; print ''; print ''; - } else { + } + else + { print ''; print ''; print ''; // Country @@ -510,9 +510,9 @@ else // Zip / Town print ''; // Country diff --git a/htdocs/projet/admin/project_extrafields.php b/htdocs/projet/admin/project_extrafields.php index a23da939757..8f4b6a6ce36 100644 --- a/htdocs/projet/admin/project_extrafields.php +++ b/htdocs/projet/admin/project_extrafields.php @@ -51,7 +51,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/projet/admin/project_task_extrafields.php b/htdocs/projet/admin/project_task_extrafields.php index f212c1acfd4..782ae78d787 100644 --- a/htdocs/projet/admin/project_task_extrafields.php +++ b/htdocs/projet/admin/project_task_extrafields.php @@ -51,7 +51,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/public/paypal/newpayment.php b/htdocs/public/paypal/newpayment.php index 85cae53fa2c..81c362633ed 100644 --- a/htdocs/public/paypal/newpayment.php +++ b/htdocs/public/paypal/newpayment.php @@ -476,7 +476,7 @@ if (GETPOST("source") == 'order' && $valid) $shipToCountryCode=$order->thirdparty->country_code; $shipToZip=$order->thirdparty->zip; $shipToStreet2=''; - $phoneNum=$order->thirdparty->tel; + $phoneNum=$order->thirdparty->phone; if ($shipToName && $shipToStreet && $shipToCity && $shipToCountryCode && $shipToZip) { print ''."\n"; @@ -583,7 +583,7 @@ if (GETPOST("source") == 'invoice' && $valid) $shipToCountryCode=$invoice->thirdparty->country_code; $shipToZip=$invoice->thirdparty->zip; $shipToStreet2=''; - $phoneNum=$invoice->thirdparty->tel; + $phoneNum=$invoice->thirdparty->phone; if ($shipToName && $shipToStreet && $shipToCity && $shipToCountryCode && $shipToZip) { print ''."\n"; @@ -778,7 +778,7 @@ if (GETPOST("source") == 'contractline' && $valid) $shipToCountryCode=$contract->thirdparty->country_code; $shipToZip=$contract->thirdparty->zip; $shipToStreet2=''; - $phoneNum=$contract->thirdparty->tel; + $phoneNum=$contract->thirdparty->phone; if ($shipToName && $shipToStreet && $shipToCity && $shipToCountryCode && $shipToZip) { print ''."\n"; @@ -908,7 +908,7 @@ if (GETPOST("source") == 'membersubscription' && $valid) $shipToCountryCode=$member->country_code; $shipToZip=$member->zip; $shipToStreet2=''; - $phoneNum=$member->tel; + $phoneNum=$member->phone; if ($shipToName && $shipToStreet && $shipToCity && $shipToCountryCode && $shipToZip) { print ''."\n"; diff --git a/htdocs/societe/admin/contact_extrafields.php b/htdocs/societe/admin/contact_extrafields.php index 36adc4f38b2..6cb54ee1449 100644 --- a/htdocs/societe/admin/contact_extrafields.php +++ b/htdocs/societe/admin/contact_extrafields.php @@ -50,7 +50,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/societe/admin/societe_extrafields.php b/htdocs/societe/admin/societe_extrafields.php index 15ccdac8ef7..11a284dabef 100644 --- a/htdocs/societe/admin/societe_extrafields.php +++ b/htdocs/societe/admin/societe_extrafields.php @@ -51,7 +51,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 6c1387bc35b..ec258dda9d8 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -142,7 +142,7 @@ if ($socid) print ''; // Phone / Fax - print ''; + print ''; print ''; print '
'.$langs->trans("Entities").''.$langs->trans("ExportableFields").''; - print ''.$langs->trans("All").""; + print ''.$langs->trans("All").""; print '/'; - print ''.$langs->trans("None").""; + print ''.$langs->trans("None").""; print ''.$langs->trans("ExportedFields").'
'.$langs->trans("Web").''.dol_print_url($object->url).'
'.$langs->trans("Phone").''.dol_print_phone($object->tel,$object->country_code,0,$object->id,'AC_TEL').'
'.$langs->trans("Phone").''.dol_print_phone($object->phone,$object->country_code,0,$object->id,'AC_TEL').''.$langs->trans("Fax").''.dol_print_phone($object->fax,$object->country_code,0,$object->id,'AC_FAX').'
'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')'.dol_print_date($cp->date_debut,'day'); @@ -901,7 +943,9 @@ else print $langs->trans($listhalfday[$starthalfday]); print '
'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')'; @@ -921,7 +965,9 @@ else print $langs->trans($listhalfday[$endhalfday]); print '
'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')'; @@ -1053,7 +1099,7 @@ else { print ''.$langs->trans("Validate").''; } - if($user->rights->holiday->delete && $cp->statut == 1) + if ($user->rights->holiday->delete && $cp->statut == 1) // If draft { print ''.$langs->trans("DeleteCP").''; } @@ -1064,7 +1110,7 @@ else print ''.$langs->trans("ActionRefuseCP").''; } - if (($user->id == $cp->fk_validator || $user->id == $cp->fk_user) && $cp->statut == 2) + if (($user->id == $cp->fk_validator || $user->id == $cp->fk_user) && ($cp->statut == 2 || $cp->statut == 3)) // Status validated or approved { if (($cp->date_debut > dol_now()) || $user->admin) print ''.$langs->trans("ActionCancelCP").''; else print ''.$langs->trans("ActionCancelCP").''; diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql index 9f7bf87229c..cd7f1fc285d 100644 --- a/htdocs/install/mysql/data/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql @@ -37,6 +37,7 @@ insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (4,'ORDER_SUPPLIER_REFUSE','Supplier order request refused','Executed when a supplier order is refused','order_supplier',13); insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (5,'ORDER_VALIDATE','Customer order validate','Executed when a customer order is validated','commande',4); insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (6,'PROPAL_VALIDATE','Customer proposal validated','Executed when a commercial proposal is validated','propal',2); +insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (9,'COMPANY_SENTBYMAIL','Mails sent from third party card','Executed when you send email from third party card','societe',1); insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (10,'COMPANY_CREATE','Third party created','Executed when a third party is created','societe',1); insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (11,'CONTRACT_VALIDATE','Contract validated','Executed when a contract is validated','contrat',18); insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (12,'PROPAL_SENTBYMAIL','Commercial proposal sent by mail','Executed when a commercial proposal is sent by mail','propal',3); diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index 0832f299457..f2692015d83 100755 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -102,7 +102,7 @@ ALTER TABLE llx_expedition DROP FOREIGN KEY fk_expedition_fk_shipping_method; ALTER TABLE llx_expedition DROP INDEX idx_expedition_fk_expedition_methode; ALTER TABLE llx_expedition CHANGE COLUMN fk_expedition_methode fk_shipping_method integer; -ALTER TABLE llx_c_shipment_mode ADD COLUMN tracking VARCHAR(256) NOT NULL DEFAULT '' AFTER description; +ALTER TABLE llx_c_shipment_mode ADD COLUMN tracking VARCHAR(255) NOT NULL DEFAULT '' AFTER description; --ALTER TABLE llx_c_shipment_mode DROP COLUMN CASCADE; --ALTER TABLE llx_c_shipment_mode ADD COLUMN rowid INTEGER AUTO_INCREMENT PRIMARY KEY; @@ -249,7 +249,7 @@ CREATE TABLE llx_printer_ipp datec datetime, printer_name text NOT NULL, printer_location text NOT NULL, - printer_uri varchar(256) NOT NULL, + printer_uri varchar(255) NOT NULL, copy integer NOT NULL DEFAULT '1', module varchar(16) NOT NULL, login varchar(32) NOT NULL diff --git a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql index 60aacc47626..6fa35fa552c 100755 --- a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql +++ b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql @@ -298,3 +298,6 @@ ALTER TABLE llx_facture_fourn ADD fk_mode_reglement integer NULL AFTER fk_cond_r ALTER TABLE llx_facture_fourn MODIFY COLUMN fk_mode_reglement integer NULL; ALTER TABLE llx_facture_fourn MODIFY COLUMN fk_cond_reglement integer NULL; + +insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (9,'COMPANY_SENTBYMAIL','Mails sent from third party card','Executed when you send email from third party card','societe',1); + diff --git a/htdocs/install/mysql/tables/llx_c_shipment_mode.sql b/htdocs/install/mysql/tables/llx_c_shipment_mode.sql index 37d2d5f85c1..b94936c7461 100644 --- a/htdocs/install/mysql/tables/llx_c_shipment_mode.sql +++ b/htdocs/install/mysql/tables/llx_c_shipment_mode.sql @@ -23,7 +23,7 @@ create table llx_c_shipment_mode code varchar(30) NOT NULL, libelle varchar(50) NOT NULL, description text, - tracking varchar(256) NOT NULL, + tracking varchar(255) NOT NULL, active tinyint DEFAULT 0, module varchar(32) NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_printer_ipp.sql b/htdocs/install/mysql/tables/llx_printer_ipp.sql index 19aa1c4d127..a19e05587d6 100644 --- a/htdocs/install/mysql/tables/llx_printer_ipp.sql +++ b/htdocs/install/mysql/tables/llx_printer_ipp.sql @@ -23,7 +23,7 @@ CREATE TABLE llx_printer_ipp datec datetime, printer_name text NOT NULL, printer_location text NOT NULL, - printer_uri varchar(256) NOT NULL, + printer_uri varchar(255) NOT NULL, copy integer NOT NULL DEFAULT '1', module varchar(16) NOT NULL, login varchar(32) NOT NULL diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index 73398da233b..83f06495ffb 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -89,6 +89,7 @@ FirstDayOfHoliday=First day of holiday LastDayOfHoliday=Last day of holiday HolidaysMonthlyUpdate=Monthly update ManualUpdate=Manual update +HolidaysCancelation=Holidays cancelation ## Configuration du Module ## ConfCP=Configuration of holidays module diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 35788d208fa..d3396ea788a 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -658,6 +658,7 @@ Deductible=Deductible from=from toward=toward Access=Access +HelpCopyToClipboard=Use Ctrl+C to copy to clipboard # Week day Monday=Monday diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 661883a3f12..2ef1b49e152 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -56,8 +56,6 @@ DraftOrWaitingShipped=Draft or validated not yet shipped MenuOrdersToBill=Orders delivered MenuOrdersToBill2=Orders to bill SearchOrder=Search order -Sending=Sending -Sendings=Sendings ShipProduct=Ship product Discount=Discount CreateOrder=Create Order diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index 2b7c7f98140..609066453ab 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -3,6 +3,7 @@ CHARSET=UTF-8 RefSending=Ref. shipment Sending=Shipment Sendings=Shipments +Shipment=Shipment Shipments=Shipments Receivings=Receivings SendingsArea=Shipments area diff --git a/htdocs/langs/fr_FR/agenda.lang b/htdocs/langs/fr_FR/agenda.lang index b70c1797892..8efdd8e3624 100644 --- a/htdocs/langs/fr_FR/agenda.lang +++ b/htdocs/langs/fr_FR/agenda.lang @@ -37,7 +37,7 @@ AutoActions= Alimentation automatique AgendaAutoActionDesc= Définissez dans cet onglet les événements pour lesquels Dolibarr créera automatiquement une action dans l'agenda. Si aucune case n'est cochée (par défaut), seules les actions manuelles seront incluses dans l'agenda. AgendaSetupOtherDesc= Cette page permet de configurer quelques options permettant d'exporter une vue de votre agenda Dolibarr vers un calendrier externe (Thunderbird, Google calendar, …) AgendaExtSitesDesc=Cette page permet d'ajouter des sources de calendriers externes pour les visualiser au sein de l'agenda Dolibarr. -ActionsEvents= Événements pour lesquels Dolibarr doit créer une action dans l'agenda en automatique. +ActionsEvents= Événements pour lesquels Dolibarr doit insérer un évènement dans l'agenda en automatique. PropalValidatedInDolibarr= Proposition %s validée InvoiceValidatedInDolibarr= Facture %s validée InvoiceBackToDraftInDolibarr=Facture %s repassée en brouillon diff --git a/htdocs/langs/fr_FR/holiday.lang b/htdocs/langs/fr_FR/holiday.lang index f690a9c764c..b6569ee5f4d 100644 --- a/htdocs/langs/fr_FR/holiday.lang +++ b/htdocs/langs/fr_FR/holiday.lang @@ -89,6 +89,7 @@ FirstDayOfHoliday=Premier jour de congés LastDayOfHoliday=Dernier jour de congés HolidaysMonthlyUpdate=Mise à jour mensuelle ManualUpdate=Mise à jour manuelle +HolidaysCancelation=Annulation de congès ## Configuration du Module ## ConfCP=Configuration du module Congés diff --git a/htdocs/langs/fr_FR/mails.lang b/htdocs/langs/fr_FR/mails.lang index c92b0de4148..78f3a35875b 100644 --- a/htdocs/langs/fr_FR/mails.lang +++ b/htdocs/langs/fr_FR/mails.lang @@ -105,7 +105,7 @@ NbOfCompaniesContacts=Contacts/adresses uniques MailNoChangePossible=Destinataires d'un emailing validé non modifiables SearchAMailing=Rechercher un emailing SendMailing=Envoi emailing -SendMail=Envoi email +SendMail=Envoyer email SentBy=Envoyé par MailingNeedCommand=Pour des raisons de sécurité, il est recommandé de faire les envois d'un mailing de masse depuis la ligne de commande. Si en avez, demandez à votre administrateur de serveurs de lancer la commande suivante pour envoyer le mailing à tous les destinataires : MailingNeedCommand2=Vous pouvez toutefois quand même les envoyer par l'interface écran en ajoutant le paramètre MAILING_LIMIT_SENDBYWEB avec la valeur du nombre max de mails envoyés par session d'envoi. Pour cela, aller dans Accueil - Configuration - Divers. diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index ee591bb4535..b34b784165a 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -658,6 +658,7 @@ Deductible=Déductible from=de toward=vers Access=Accès +HelpCopyToClipboard=Ctrl+C pour copier dans le presse-papier # Week day Monday=Lundi diff --git a/htdocs/langs/fr_FR/orders.lang b/htdocs/langs/fr_FR/orders.lang index 79796a0a907..644075e9a6b 100644 --- a/htdocs/langs/fr_FR/orders.lang +++ b/htdocs/langs/fr_FR/orders.lang @@ -56,8 +56,6 @@ DraftOrWaitingShipped=Brouillon ou validée pas encore expédiée MenuOrdersToBill=Commandes délivrées MenuOrdersToBill2=Commandes à facturer SearchOrder=Rechercher une commande -Sending=Expédition -Sendings=Expéditions ShipProduct=Expédier produit Discount=Remise CreateOrder=Créer Commande diff --git a/htdocs/langs/fr_FR/sendings.lang b/htdocs/langs/fr_FR/sendings.lang index a4ddaafef01..3d8088624c6 100644 --- a/htdocs/langs/fr_FR/sendings.lang +++ b/htdocs/langs/fr_FR/sendings.lang @@ -3,6 +3,7 @@ CHARSET=UTF-8 RefSending=Réf. expédition Sending=Expédition Sendings=Expéditions +Shipment=Expédition Shipments=Expéditions Receivings=Réceptions SendingsArea=Espace expéditions diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php index 44c0bc91166..9fdb13ffe40 100644 --- a/htdocs/livraison/fiche.php +++ b/htdocs/livraison/fiche.php @@ -479,7 +479,7 @@ else $soc->fetch($delivery->socid); $head=delivery_prepare_head($delivery); - dol_fiche_head($head, 'delivery', $langs->trans("Sending"), 0, 'sending'); + dol_fiche_head($head, 'delivery', $langs->trans("Shipment"), 0, 'sending'); /* * Confirmation de la suppression @@ -489,7 +489,7 @@ else { $expedition_id = $_GET["expid"]; print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$delivery->id.'&expid='.$expedition_id,$langs->trans("DeleteDeliveryReceipt"),$langs->trans("DeleteDeliveryReceiptConfirm",$delivery->ref),'confirm_delete','','',1); - + } /* @@ -499,7 +499,7 @@ else if ($action == 'valid') { print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$delivery->id,$langs->trans("ValidateDeliveryReceipt"),$langs->trans("ValidateDeliveryReceiptConfirm",$delivery->ref),'confirm_valid','','',1); - + } diff --git a/htdocs/margin/lib/margins.lib.php b/htdocs/margin/lib/margins.lib.php index c5237d219c5..bfa5d530e29 100644 --- a/htdocs/margin/lib/margins.lib.php +++ b/htdocs/margin/lib/margins.lib.php @@ -117,12 +117,18 @@ function getMarginInfos($pvht, $remise_percent, $tva_tx, $localtax1_tx, $localta // calcul pu_ht remisés $tabprice=calcul_price_total(1, $pvht, $remise_percent, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 'HT', 0, 0); // FIXME Parameter type is missing, i put 0 to avoid blocking error $pu_ht_remise = $tabprice[0]; + // calcul marge + if ($pu_ht_remise < 0) + $marge = -1 * (abs($pu_ht_remise) - $paht_ret); + else + $marge = $pu_ht_remise - $paht_ret; + // calcul taux marge if ($paht_ret != 0) - $marge_tx_ret = round((100 * ($pu_ht_remise - $paht_ret)) / $paht_ret, 3); + $marge_tx_ret = round((100 * $marge) / $paht_ret, 3); // calcul taux marque if ($pu_ht_remise != 0) - $marque_tx_ret = round((100 * ($pu_ht_remise - $paht_ret)) / $pu_ht_remise, 3); + $marque_tx_ret = round((100 * $marge) / $pu_ht_remise, 3); return array($paht_ret, $marge_tx_ret, $marque_tx_ret); } diff --git a/htdocs/product/admin/product_extrafields.php b/htdocs/product/admin/product_extrafields.php index 98b85746051..3f4ff84655e 100644 --- a/htdocs/product/admin/product_extrafields.php +++ b/htdocs/product/admin/product_extrafields.php @@ -52,7 +52,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/product/stock/fiche.php b/htdocs/product/stock/fiche.php index c98c6c23e96..1d0a9c08e04 100644 --- a/htdocs/product/stock/fiche.php +++ b/htdocs/product/stock/fiche.php @@ -191,9 +191,9 @@ if ($action == 'create') // Zip / Town print '
'.$langs->trans('Zip').''; - print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','departement_id'),6); + print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','state_id'),6); print ''.$langs->trans('Town').''; - print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','departement_id')); + print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','state_id')); print '
'.$langs->trans('Zip').''; - print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','departement_id'),6); + print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','state_id'),6); print ''.$langs->trans('Town').''; - print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','departement_id')); + print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','state_id')); print '
'.$langs->trans('Phone').''.dol_print_phone($soc->tel,$soc->country_code,0,$soc->id,'AC_TEL').'
'.$langs->trans('Phone').''.dol_print_phone($soc->phone,$soc->country_code,0,$soc->id,'AC_TEL').''.$langs->trans('Fax').''.dol_print_phone($soc->fax,$soc->country_code,0,$soc->id,'AC_FAX').'
'; diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index 6d30e8e760c..89776835e2a 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -133,8 +133,8 @@ abstract class ActionsCardCommon $this->object->zip = $_POST["zipcode"]; $this->object->town = $_POST["town"]; $this->object->country_id = $_POST["country_id"]; - $this->object->state_id = $_POST["departement_id"]; - $this->object->tel = $_POST["tel"]; + $this->object->state_id = $_POST["state_id"]; + $this->object->phone = $_POST["tel"]; $this->object->fax = $_POST["fax"]; $this->object->email = trim($_POST["email"]); $this->object->url = $_POST["url"]; @@ -160,7 +160,7 @@ abstract class ActionsCardCommon $this->object->effectif_id = $_POST["effectif_id"]; if (GETPOST("private") == 1) { - $this->object->typent_id = 8; // TODO predict another method if the field "special" change of rowid + $this->object->typent_id = dol_getIdFromCode($db,'TE_PRIVATE','c_typent'); } else { @@ -483,10 +483,10 @@ abstract class ActionsCardCommon } // Zip - $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip,'zipcode',array('town','selectcountry_id','departement_id'),6); + $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip,'zipcode',array('town','selectcountry_id','state_id'),6); // Town - $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town,'town',array('zipcode','selectcountry_id','departement_id')); + $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town,'town',array('zipcode','selectcountry_id','state_id')); // Country $this->object->country_id = ($this->object->country_id ? $this->object->country_id : $mysoc->country_id); @@ -555,7 +555,7 @@ abstract class ActionsCardCommon if ($this->object->isInEEC()) $this->tpl['country'] = $form->textwithpicto(($img?$img.' ':'').$this->object->country,$langs->trans("CountryIsInEEC"),1,0); $this->tpl['country'] = ($img?$img.' ':'').$this->object->country; - $this->tpl['phone'] = dol_print_phone($this->object->tel,$this->object->country_code,0,$this->object->id,'AC_TEL'); + $this->tpl['phone'] = dol_print_phone($this->object->phone,$this->object->country_code,0,$this->object->id,'AC_TEL'); $this->tpl['fax'] = dol_print_phone($this->object->fax,$this->object->country_code,0,$this->object->id,'AC_FAX'); $this->tpl['email'] = dol_print_email($this->object->email,0,$this->object->id,'AC_EMAIL'); $this->tpl['url'] = dol_print_url($this->object->url); @@ -670,8 +670,8 @@ abstract class ActionsCardCommon $this->object->zip = $_POST["zipcode"]; $this->object->town = $_POST["town"]; $this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id; - $this->object->state_id = $_POST["departement_id"]; - $this->object->tel = $_POST["tel"]; + $this->object->state_id = $_POST["state_id"]; + $this->object->phone = $_POST["tel"]; $this->object->fax = $_POST["fax"]; $this->object->email = $_POST["email"]; $this->object->url = $_POST["url"]; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index dd9ab8f1abf..c77deb37421 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -54,10 +54,9 @@ class Societe extends CommonObject var $town; var $status; // 0=activity ceased, 1= in activity - var $state_id; + var $state_id; // Id of department var $state_code; var $state; - var $departement_id; // deprecated var $departement_code; // deprecated var $departement; // deprecated @@ -404,10 +403,9 @@ class Societe extends CommonObject $this->town = $this->town?trim($this->town):trim($this->town); $this->state_id = trim($this->state_id); $this->country_id = ($this->country_id > 0)?$this->country_id:$this->country_id; - $this->phone = trim($this->phone?$this->phone:$this->tel); + $this->phone = trim($this->phone); $this->phone = preg_replace("/\s/","",$this->phone); $this->phone = preg_replace("/\./","",$this->phone); - $this->tel = $this->phone; // TODO obsolete $this->fax = trim($this->fax); $this->fax = preg_replace("/\s/","",$this->fax); $this->fax = preg_replace("/\./","",$this->fax); @@ -780,7 +778,6 @@ class Societe extends CommonObject $this->email = $obj->email; $this->url = $obj->url; - $this->tel = $obj->phone; // TODO obsolete $this->phone = $obj->phone; $this->fax = $obj->fax; @@ -1568,8 +1565,6 @@ class Societe extends CommonObject { global $langs; - if (empty($this->phone) && ! empty($this->tel)) $this->phone=$this->tel; - $contact_phone = $this->contact_property_array('mobile'); if ($this->phone) { @@ -2410,7 +2405,6 @@ class Societe extends CommonObject $this->town=$member->town; $this->country_code=$member->country_code; $this->country_id=$member->country_id; - $this->tel=$member->phone; // deprecated $this->phone=$member->phone; // Prof phone $this->email=$member->email; @@ -2498,7 +2492,6 @@ class Societe extends CommonObject $this->country=$country_label; if (is_object($langs)) $this->country=($langs->trans('Country'.$country_code)!='Country'.$country_code)?$langs->trans('Country'.$country_code):$country_label; - $this->tel=empty($conf->global->MAIN_INFO_SOCIETE_TEL)?'':$conf->global->MAIN_INFO_SOCIETE_TEL; // TODO deprecated $this->phone=empty($conf->global->MAIN_INFO_SOCIETE_TEL)?'':$conf->global->MAIN_INFO_SOCIETE_TEL; $this->fax=empty($conf->global->MAIN_INFO_SOCIETE_FAX)?'':$conf->global->MAIN_INFO_SOCIETE_FAX; $this->url=empty($conf->global->MAIN_INFO_SOCIETE_WEB)?'':$conf->global->MAIN_INFO_SOCIETE_WEB; diff --git a/htdocs/societe/commerciaux.php b/htdocs/societe/commerciaux.php index d638db9d191..4e970dffc17 100644 --- a/htdocs/societe/commerciaux.php +++ b/htdocs/societe/commerciaux.php @@ -151,7 +151,7 @@ if ($_GET["socid"]) print ''.$langs->trans('Country').''.$soc->country.''; - print ''.$langs->trans('Phone').''.dol_print_phone($soc->tel,$soc->country_code,0,$soc->id,'AC_TEL').''; + print ''.$langs->trans('Phone').''.dol_print_phone($soc->phone,$soc->country_code,0,$soc->id,'AC_TEL').''; print ''.$langs->trans('Fax').''.dol_print_phone($soc->fax,$soc->country_code,0,$soc->id,'AC_FAX').''; print ''.$langs->trans('Web').''; diff --git a/htdocs/societe/localtaxes.php b/htdocs/societe/localtaxes.php index 80378bf65a6..68a2957eeb8 100644 --- a/htdocs/societe/localtaxes.php +++ b/htdocs/societe/localtaxes.php @@ -137,7 +137,7 @@ if ($socid) print ''; // Phone / Fax - print ''.$langs->trans('Phone').''.dol_print_phone($soc->tel,$soc->country_code,0,$soc->id,'AC_TEL').''; + print ''.$langs->trans('Phone').''.dol_print_phone($soc->phone,$soc->country_code,0,$soc->id,'AC_TEL').''; print ''.$langs->trans('Fax').''.dol_print_phone($soc->fax,$soc->country_code,0,$soc->id,'AC_FAX').''; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 8682058091d..c3bfb832f61 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -129,7 +129,7 @@ if (empty($reshook)) $object->zip = GETPOST('zipcode'); $object->town = GETPOST('town'); $object->country_id = GETPOST('country_id'); - $object->state_id = GETPOST('departement_id'); + $object->state_id = GETPOST('state_id'); $object->phone = GETPOST('phone'); $object->fax = GETPOST('fax'); $object->email = GETPOST('email'); @@ -158,7 +158,7 @@ if (empty($reshook)) $object->effectif_id = GETPOST('effectif_id'); if (GETPOST("private") == 1) { - $object->typent_id = 8; // TODO predict another method if the field "special" change of rowid + $object->typent_id = dol_getIdFromCode($db,'TE_PRIVATE','c_typent'); } else { @@ -450,6 +450,14 @@ if (empty($reshook)) $result = $object->set_parent(GETPOST('editparentcompany','int')); } + + // Actions to send emails + $id=$socid; + $actiontypecode='AC_OTH_AUTO'; + $paramname='socid'; + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; + + /* * Generate document */ @@ -588,7 +596,7 @@ else $object->address = GETPOST('address'); $object->zip = GETPOST('zipcode'); $object->town = GETPOST('town'); - $object->state_id = GETPOST('departement_id'); + $object->state_id = GETPOST('state_id'); $object->phone = GETPOST('phone'); $object->fax = GETPOST('fax'); $object->email = GETPOST('email'); @@ -812,9 +820,9 @@ else // Zip / Town print ''.$langs->trans('Zip').''; - print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','departement_id'),6); + print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','state_id'),6); print ''.$langs->trans('Town').''; - print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','departement_id')); + print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','state_id')); print ''; // Country @@ -827,7 +835,7 @@ else if (empty($conf->global->SOCIETE_DISABLE_STATE)) { print ''.$langs->trans('State').''; - if ($object->country_id) print $formcompany->select_state($object->state_id,$object->country_code,'departement_id'); + if ($object->country_id) print $formcompany->select_state($object->state_id,$object->country_code,'state_id'); else print $countrynotdefined; print ''; } @@ -1069,7 +1077,7 @@ else $object->zip = GETPOST('zipcode'); $object->town = GETPOST('town'); $object->country_id = GETPOST('country_id')?GETPOST('country_id'):$mysoc->country_id; - $object->state_id = GETPOST('departement_id'); + $object->state_id = GETPOST('state_id'); $object->phone = GETPOST('phone'); $object->fax = GETPOST('fax'); $object->email = GETPOST('email'); @@ -1230,9 +1238,9 @@ else // Zip / Town print ''.$langs->trans('Zip').''; - print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','departement_id'),6); + print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','state_id'),6); print ''.$langs->trans('Town').''; - print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','departement_id')); + print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','state_id')); print ''; // Country @@ -1771,6 +1779,15 @@ else */ print '
'."\n"; + if (! empty($object->email)) + { + print '
'.$langs->trans('SendMail').'
'; + } + else + { + print '
'.$langs->trans('SendMail').'
'; + } + if ($user->rights->societe->creer) { print '
'.$langs->trans("Modify").'
'."\n"; @@ -1790,51 +1807,138 @@ else print '
'."\n"; - if (empty($conf->global->SOCIETE_DISABLE_BUILDDOC)) - { - print '
'; - //print '
'; - print ''; // ancre - /* - * Documents generes - */ - $filedir=$conf->societe->multidir_output[$object->entity].'/'.$object->id; - $urlsource=$_SERVER["PHP_SELF"]."?socid=".$object->id; - $genallowed=$user->rights->societe->creer; - $delallowed=$user->rights->societe->supprimer; + if ($action == 'presend') + { + /* + * Affiche formulaire mail + */ - $var=true; + // By default if $action=='presend' + $titreform='SendMail'; + $topicmail=''; + $action='send'; + $modelmail='thirdparty'; - $somethingshown=$formfile->show_documents('company',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang); + print '
'; + print_titre($langs->trans($titreform)); - print '
'; + // Cree l'objet formulaire mail + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + $formmail->fromtype = 'user'; + $formmail->fromid = $user->id; + $formmail->fromname = $user->getFullName($langs); + $formmail->frommail = $user->email; + $formmail->withfrom=1; + $formmail->withtopic=1; + $liste=array(); + foreach ($object->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value; + $formmail->withto=GETPOST('sendto')?GETPOST('sendto'):$liste; + $formmail->withtofree=0; + $formmail->withtocc=$liste; + $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; + $formmail->withfile=2; + $formmail->withbody=1; + $formmail->withdeliveryreceipt=1; + $formmail->withcancel=1; + // Tableau des substitutions + $formmail->substit['__SIGNATURE__']=$user->signature; + $formmail->substit['__PERSONALIZED__']=''; + $formmail->substit['__CONTACTCIVNAME__']=''; + + //Find the good contact adress + /* + $custcontact=''; + $contactarr=array(); + $contactarr=$object->liste_contact(-1,'external'); + + if (is_array($contactarr) && count($contactarr)>0) + { + foreach($contactarr as $contact) + { + if ($contact['libelle']==$langs->trans('TypeContact_facture_external_BILLING')) { + + require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; + + $contactstatic=new Contact($db); + $contactstatic->fetch($contact['id']); + $custcontact=$contactstatic->getFullName($langs,1); + } + } + + if (!empty($custcontact)) { + $formmail->substit['__CONTACTCIVNAME__']=$custcontact; + } + }*/ - print '
'; + // Tableau des parametres complementaires du post + $formmail->param['action']=$action; + $formmail->param['models']=$modelmail; + $formmail->param['socid']=$object->id; + $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?socid='.$object->id; - print '
'; - } + // Init list of files + if (GETPOST("mode")=='init') + { + $formmail->clear_attached_files(); + $formmail->add_attached_files($file,basename($file),dol_mimetype($file)); + } - print '

'; + $formmail->show_form(); - // Subsidiaries list - $result=show_subsidiaries($conf,$langs,$db,$object); + print '
'; + } + else + { - // Contacts list - if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) - { - $result=show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); - } + if (empty($conf->global->SOCIETE_DISABLE_BUILDDOC)) + { + print '
'; + //print ' - +
'; + print ''; // ancre - // Addresses list - if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT)) - { - $result=show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); - } + /* + * Documents generes + */ + $filedir=$conf->societe->multidir_output[$object->entity].'/'.$object->id; + $urlsource=$_SERVER["PHP_SELF"]."?socid=".$object->id; + $genallowed=$user->rights->societe->creer; + $delallowed=$user->rights->societe->supprimer; - // Projects list - $result=show_projects($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); + $var=true; + + $somethingshown=$formfile->show_documents('company',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang); + + print '
'; + + + print '
'; + + print '
'; + } + + print '

'; + + // Subsidiaries list + $result=show_subsidiaries($conf,$langs,$db,$object); + + // Contacts list + if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) + { + $result=show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); + } + + // Addresses list + if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT)) + { + $result=show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); + } + + // Projects list + $result=show_projects($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); + } } } diff --git a/htdocs/societe/societe.php b/htdocs/societe/societe.php index 7840f5e7d9e..28a3c5c2885 100644 --- a/htdocs/societe/societe.php +++ b/htdocs/societe/societe.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Marcos García * Copyright (C) 2013 Raphaël Doursenaud @@ -22,7 +22,7 @@ /** * \file htdocs/societe/societe.php * \ingroup societe - * \brief Page to show a third party + * \brief Page to show list of third parties */ require_once '../main.inc.php'; diff --git a/htdocs/theme/auguria/style.css.php b/htdocs/theme/auguria/style.css.php index 7bb4f391221..b15f4a80b88 100644 --- a/htdocs/theme/auguria/style.css.php +++ b/htdocs/theme/auguria/style.css.php @@ -610,6 +610,7 @@ img.login, img.printer, img.entity { div.vmenu, td.vmenu { margin-: 2px; + margin-: 2px; padding: 0px; padding-bottom: 0px; width: 164px; @@ -726,11 +727,8 @@ div.blockvmenuhelp div.menu_contenu { background: url(); - padding: 8px 0px 0px 0px; + padding: 2px 1px 1px 3px; margin: 0px; - padding: 1px; - - padding-right: 8px; font-size : 11px; font-weight:normal; color : #000000; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index c01d2995db5..1af76aed9b5 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1759,6 +1759,7 @@ tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste } .liste_titre td a { text-shadow: none !important; + color: #; } div.liste_titre { padding-left: 3px; diff --git a/htdocs/user/admin/user_extrafields.php b/htdocs/user/admin/user_extrafields.php index 83878126858..ce372d25d4b 100644 --- a/htdocs/user/admin/user_extrafields.php +++ b/htdocs/user/admin/user_extrafields.php @@ -50,7 +50,7 @@ if (!$user->admin) accessforbidden(); * Actions */ -require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php'; +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index 31e3f58ffce..152a28053fa 100644 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -312,7 +312,7 @@ function getThirdParty($authentication,$id='',$ref='',$ref_ext='') 'country_id' => $thirdparty->country_id, 'country_code' => $thirdparty->country_code, 'country' => $thirdparty->country, - 'phone' => $thirdparty->tel, + 'phone' => $thirdparty->phone, 'fax' => $thirdparty->fax, 'email' => $thirdparty->email, 'url' => $thirdparty->url, diff --git a/test/phpunit/SocieteTest.php b/test/phpunit/SocieteTest.php index 487f25c8ec9..4c512279476 100755 --- a/test/phpunit/SocieteTest.php +++ b/test/phpunit/SocieteTest.php @@ -197,7 +197,7 @@ class SocieteTest extends PHPUnit_Framework_TestCase $localobject->town='New town'; $localobject->country_id=2; $localobject->status=0; - $localobject->tel='New tel'; + $localobject->phone='New tel'; $localobject->fax='New fax'; $localobject->email='newemail@newemail.com'; $localobject->url='New url'; @@ -205,15 +205,15 @@ class SocieteTest extends PHPUnit_Framework_TestCase $localobject->idprof2='new idprof2'; $localobject->idprof3='new idprof3'; $localobject->idprof4='new idprof4'; - + $result=$localobject->update($localobject->id,$user); print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0); - + $result=$localobject->update_note($localobject->note_private,'_private'); print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0, 'Holiday::update_note_private error'); - + $result=$localobject->update_note_public($localobject->note_public); print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0, 'Holiday::update_note_public error'); @@ -232,7 +232,7 @@ class SocieteTest extends PHPUnit_Framework_TestCase $this->assertEquals($localobject->country_id, $newobject->country_id); $this->assertEquals('BE', $newobject->country_code); $this->assertEquals($localobject->status, $newobject->status); - $this->assertEquals($localobject->tel, $newobject->tel); + $this->assertEquals($localobject->phone, $newobject->phone); $this->assertEquals($localobject->fax, $newobject->fax); $this->assertEquals($localobject->email, $newobject->email); $this->assertEquals($localobject->url, $newobject->url); diff --git a/test/selenium/test_thirdparty.xml b/test/selenium/test_thirdparty.xml index 704796cd4c2..47a9b8091a9 100644 --- a/test/selenium/test_thirdparty.xml +++ b/test/selenium/test_thirdparty.xml @@ -38,7 +38,7 @@
selectdepartement_idstate_id label=01 - Ain