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

This commit is contained in:
Maxime Kohlhaas 2013-09-26 18:20:12 +02:00
commit 383e07d102
111 changed files with 1212 additions and 483 deletions

View File

@ -40,22 +40,26 @@ 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: 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.
@ -85,6 +89,7 @@ For developers:
- New: Add hook addHomeSetup.
- New: Add trigger CATEGORY_LINK and CATEGORY_UNLINK.
- New: A trigger can return an array of error strings instead of one error string.
- New: Add method to use a dictionnary as a combo box.
WARNING: Following change may create regression for some external modules, but was necessary to make
Dolibarr better:
@ -107,6 +112,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

View File

@ -139,11 +139,11 @@ Warning: Name and email must match value into debian/control file (Entry added h
> git-buildpackage -us -uc
Note: You can use git-buildpackage -us -uc --git-ignore-new if you want to test build with uncommited file
Note: Package is built into directory ../build-area
* If package .deb is ok:
Note: If there was errors managed manually, you may need to make a git commit but do not use option "amend" previous commit
> git-buildpackage --git-tag
> git-buildpackage --git-tag-only --git-retag
> git push --all ou git push origin --all
> git push --tags
@ -195,10 +195,11 @@ Warning: Name and email must match value into debian/control file (Entry added h
> git-buildpackage -us -uc
Note: You can use git-buildpackage -us -uc --git-ignore-new if you want to test build with uncommited file
Note: Package is built into directory ../build-area
* If package .deb is ok:
Note: If there was errors managed manually, you may need to make a git commit but do not use option "amend" previous commit
> git-buildpackage --git-tag
> git-buildpackage --git-tag-only --git-retag
> git push --all ou git push origin --all
> git push --tags

View File

@ -340,6 +340,7 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/template`; # Package not valid for most linux distributions (errors reported into compile.js). Package should be embed by modules to avoid problems.
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpmailer`; # Package not valid for most linux distributions (errors reported into file LICENSE). Package should be embed by modules to avoid problems.
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/license.txt`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PDF`;

View File

@ -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';

View File

@ -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';

View File

@ -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;

View File

@ -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;

View File

@ -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';

View File

@ -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++;
}

View File

@ -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 '<tr '.$bc[$var].'><td>'.$module->nom."</td>\n";
print '<td>';
@ -276,8 +276,8 @@ foreach ($dirmodels as $reldir)
// Show example of numbering module
print '<td class="nowrap">';
$tmp=$module->getExample();
if (preg_match('/^Error/',$tmp)) {
$langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>';
if (preg_match('/^Error/',$tmp)) {
$langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>';
}
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
else print $tmp;

View File

@ -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 '<table class="noborder" width="100%">';
@ -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 '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
print $module->info();
@ -255,8 +255,8 @@ foreach ($dirmodels as $reldir)
// Show example of numbering module
print '<td class="nowrap">';
$tmp=$module->getExample();
if (preg_match('/^Error/',$tmp)) {
$langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>';
if (preg_match('/^Error/',$tmp)) {
$langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>';
}
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
else print $tmp;
@ -315,7 +315,7 @@ print '</table>';
print '<br>';
print_titre($langs->trans("DeliveryOrderModel"));
// Defini tableau def de modele
// Defini tableau def de modele
$type="delivery";
$def = array();

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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 '</td></tr>';
// Phone
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($soc->tel,$soc->country_code,0,$soc->id,'AC_TEL').'</td>';
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($soc->phone,$soc->country_code,0,$soc->id,'AC_TEL').'</td>';
print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($soc->fax,$soc->country_code,0,$soc->id,'AC_FAX').'</td></tr>';
// Assujeti a TVA ou pas

View File

@ -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);

View File

@ -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 "<br>".dol_print_phone($act->societe->tel);
print "<br>".dol_print_phone($act->societe->phone);
}
}
print '</td>';

View File

@ -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 '<tr><td class="fieldrequired">'.$langs->trans("EventOnFullDay").'</td><td><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday')?' checked="checked"':'').'></td></tr>';
// 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 '</td></tr>';
}
if(!empty($origin) && !empty($originid))
{
print '<input type="hidden" name="fk_element" size="10" value="'.GETPOST('originid').'">';
print '<input type="hidden" name="elementtype" size="10" value="'.GETPOST('origin').'">';
}
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 '</td></tr>';
// Other attributes
$parameters=array();
@ -971,7 +984,7 @@ if ($id > 0)
{
if ($act->societe->fetch($act->societe->id))
{
print "<br>".dol_print_phone($act->societe->tel);
print "<br>".dol_print_phone($act->societe->phone);
}
}
print '</td>';
@ -1003,7 +1016,7 @@ if ($id > 0)
{
$project=new Project($db);
$project->fetch($act->fk_project);
print $project->getNomUrl(1);
print $project->getNomUrl(1,'',1);
}
print '</td></tr>';
}

View File

@ -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 '<br>'.$linerelatedto;
}

View File

@ -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');
/*

View File

@ -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';

View File

@ -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';

View File

@ -254,7 +254,7 @@ if ($id > 0)
print '<tr><td>'.$langs->trans("Web").'</td><td colspan="3">'.dol_print_url($object->url,'_blank').'</td></tr>';
// Phone
print '<tr><td>'.$langs->trans('Phone').'</td><td style="min-width: 25%;">'.dol_print_phone($object->tel,$object->country_code,0,$object->id,'AC_TEL').'</td>';
print '<tr><td>'.$langs->trans('Phone').'</td><td style="min-width: 25%;">'.dol_print_phone($object->phone,$object->country_code,0,$object->id,'AC_TEL').'</td>';
// Fax
print '<td>'.$langs->trans('Fax').'</td><td style="min-width: 25%;">'.dol_print_phone($object->fax,$object->country_code,0,$object->id,'AC_FAX').'</td></tr>';

View File

@ -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 '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=validate">'.$langs->trans('Validate').'</a></div>';
//else print '<a class="butActionRefused" href="#">'.$langs->trans('Validate').'</a>';
}
// 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 '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddAction").'</a>';
}
// Edit
if ($object->statut == 1 && $user->rights->propal->creer)
{

View File

@ -2386,13 +2386,16 @@ else
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=validate">'.$langs->trans('Validate').'</a></div>';
}
// Edit
if ($object->statut == 1 && $user->rights->commande->creer)
{
print '<div class="inline-block divButAction"><a class="butAction" href="fiche.php?id='.$object->id.'&amp;action=modif">'.$langs->trans('Modify').'</a></div>';
}
// 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 '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddAction").'</a>';
}
// Send
if ($object->statut > 0)
{

View File

@ -71,7 +71,7 @@ if ($_POST["action"] == 'add')
$account->currency_code = trim($_POST["account_currency_code"]);
$account->state_id = $_POST["account_departement_id"];
$account->state_id = $_POST["account_state_id"];
$account->country_id = $_POST["account_country_id"];
$account->min_allowed = $_POST["account_min_allowed"];

View File

@ -875,14 +875,18 @@ else if ($action == 'add' && $user->rights->facture->creer)
if ($id > 0)
{
//If deposit invoice
if ($_POST['type'] == 3) {
// If deposit invoice
if ($_POST['type'] == 3)
{
$typeamount=GETPOST('typedeposit','alpha');
$valuedeposit=GETPOST('valuedeposit','int');
if ($typeamount=='amount') {
if ($typeamount=='amount')
{
$amountdeposit=$valuedeposit;
}else {
}
else
{
$amountdeposit=0;
dol_include_once('/'.$element.'/class/'.$subelement.'.class.php');
@ -890,19 +894,20 @@ else if ($action == 'add' && $user->rights->facture->creer)
$classname = ucfirst($subelement);
$srcobject = new $classname($db);
dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add deposit line");
dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add deposit lines");
$result=$srcobject->fetch($object->origin_id);
if ($result > 0)
{
$totalamount=0;
$lines = $srcobject->lines;
$num=count($lines);
for ($i=0;$i<$num;$i++)
$numlines=count($lines);
for ($i=0; $i<$numlines; $i++)
{
$totalamount=+$lines[$i]->subprice;
$totalamount += $lines[$i]->subprice;
}
if ($totalamount!=0) {
if ($totalamount!=0)
{
$amountdeposit=($totalamount*$valuedeposit)/100;
}
}
@ -1583,9 +1588,18 @@ 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
*/
*/
if (GETPOST('addfile'))
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -1600,7 +1614,7 @@ if (GETPOST('addfile'))
/*
* Remove file in email form
*/
*/
if (! empty($_POST['removedfile']))
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -1616,7 +1630,7 @@ if (! empty($_POST['removedfile']))
/*
* Send mail
*/
*/
if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel'])
{
$langs->load('mails');
@ -1790,7 +1804,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
/*
* Generate document
*/
*/
else if ($action == 'builddoc') // En get ou en post
{
$object->fetch($id);
@ -1955,6 +1969,16 @@ $now=dol_now();
llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
print '
<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
jQuery("#linktoorder").click(function() {
jQuery("#commande").toggle();
});
});
</script>
';
/*********************************************************************
*
@ -2019,7 +2043,7 @@ if ($action == 'create')
$remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (! empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(! empty($soc->remise_absolue)?$soc->remise_absolue:0));
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
//Replicate extrafields
$objectsrc->fetch_optionals($originid);
$object->array_options=$objectsrc->array_options;
@ -2058,8 +2082,7 @@ if ($action == 'create')
// Ref
print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans('Draft').'</td></tr>';
// Tiers
print '<tr>';
// Thirdparty
print '<td class="fieldrequired">'.$langs->trans('Customer').'</td>';
if($soc->id > 0)
{
@ -2076,7 +2099,7 @@ if ($action == 'create')
}
print '</tr>'."\n";
// Factures predefinies
// Predefined invoices
if (empty($origin) && empty($originid) && $socid > 0)
{
$sql = 'SELECT r.rowid, r.titre, r.total_ttc';
@ -2183,10 +2206,13 @@ if ($action == 'create')
print '</td><td valign="middle" class="nowrap">';
$desc=$form->textwithpicto($langs->trans("InvoiceDeposit"),$langs->transnoentities("InvoiceDepositDesc"),1);
print '<table class="nobordernopadding"><tr><td>'.$desc.'</td>';
if (($origin=='propal') || ($origin=='commande')) {
print '<td><select name="typedeposit"><option value="amount">'.$langs->trans('FixAmount').'</option>';
print '<option value="variable">'.$langs->trans('VarAmount').'</option></select></td>';
print '<td>'.$langs->trans('Value').':<input type="text" name="valuedeposit" size="3" value="'.GETPOST('valuedeposit','int').'"/>';
if (($origin=='propal') || ($origin=='commande'))
{
print '<td class="nowrap" style="padding-left: 5px">';
$arraylist=array('amount'=>'FixAmount','variable'=>'VarAmount');
print $form->selectarray('typedeposit',$arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1);
print '</td>';
print '<td class="nowrap" style="padding-left: 5px">'.$langs->trans('Value').':<input type="text" name="valuedeposit" size="3" value="'.GETPOST('valuedeposit','int').'"/>';
}
print '</td></tr></table>';
print '</td></tr>'."\n";
@ -2455,6 +2481,7 @@ if ($action == 'create')
print '</table>';
}
print '<br>';
}
else if ($id > 0 || ! empty($ref))
{
@ -3719,74 +3746,64 @@ else if ($id > 0 || ! empty($ref))
// Linked object block
$somethingshown=$object->showLinkedObjectBlock();
if (empty($somethingshown) && $object->statut > 0)
{
print '<a href="#" onClick="lier_commande(commande)">'.$langs->trans('LinkedOrder').'</a>';
print '<div id="commande" style="display:none">';
{
print '<br><a href="#" id="linktoorder">'.$langs->trans('LinkedOrder').'</a>';
print '<div id="commande" style="display:none">';
$sql = "SELECT s.rowid as socid, s.nom as name, s.client, c.rowid, c.ref, c.ref_client, c.total_ht";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."commande as c";
$sql.= ' WHERE c.fk_soc = '.$soc->id.'';
$result = $db->query($sql);
if ($result)
$resqlorderlist = $db->query($sql);
if ($resqlorderlist)
{
$num = $db->num_rows($result);
$num = $db->num_rows($resqlorderlist);
$i = 0;
print_titre($langs->trans("LinkedOrder"));
print '<table><tr class="liste_titre">';
print '<td class="nowrap"></td>';
print '<td align="center">'.$langs->trans("Ref").'</td>';
print '<td align="left">'.$langs->trans("RefCustomer").'</td>';
print '<td align="left">'.$langs->trans("AmountHTShort").'</td>';
print '<td align="left">'.$langs->trans("Company").'</td>
</tr>';
print '<form action=" " method="post" name="LinkedOrder">';
print '<form action="" method="POST" name="LinkedOrder">';
print '<table class="noborder">';
print '<tr class="liste_titre">';
print '<td class="nowrap"></td>';
print '<td align="center">'.$langs->trans("Ref").'</td>';
print '<td align="left">'.$langs->trans("RefCustomer").'</td>';
print '<td align="left">'.$langs->trans("AmountHTShort").'</td>';
print '<td align="left">'.$langs->trans("Company").'</td>';
print '</tr>';
while ($i < $num)
{
$objp = $db->fetch_object($result);
$objp = $db->fetch_object($resqlorderlist);
if ($objp->socid == $soc->id)
{
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td aling="left">';
print '<input type="radio" name="linkedOrder" value='.$objp->rowid.'>';
print '<td align="center">'.$objp->ref.'</td>';
print '<td>'.$objp->ref_client.'</td>';
print '<td>'.price($objp->total_ht).'</td>';
print '<td>'.$objp->name.'</td>';
print '</td>';
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td aling="left">';
print '<input type="radio" name="linkedOrder" value='.$objp->rowid.'>';
print '<td align="center">'.$objp->ref.'</td>';
print '<td>'.$objp->ref_client.'</td>';
print '<td>'.price($objp->total_ht).'</td>';
print '<td>'.$objp->name.'</td>';
print '</td>';
print '</tr>';
}
$i++;
}
$i++;
}
print '</table>';
print '</br>';
print '<br><center><input type="submit" class="button" value="'.$langs->trans('OK').'"></center>';
print '<br><center><input type="submit" class="button" value="'.$langs->trans('ToLink').'"></center>';
print '</form>';
$db->free($resqlorderlist);
}
else
else
{
dol_print_error($db);
}
$result=$object->add_object_linked('commande',$_POST['linkedOrder']);
if($result>0)
{
echo '<meta http-equiv="refresh" content="0;URL=facture.php?facid='.$object->id.'">';
}
}
print '</div>';
}
print '</div>';
}
// Link for paypal payment
if (! empty($conf->paypal->enabled) && $object->statut != 0)
{
@ -3938,20 +3955,4 @@ dol_htmloutput_mesg('',$mesgs);
llxFooter();
$db->close();
?>
<script>
function lier_commande(commande)
{
if(commande.style.display=='none')
{
commande.style.display='inline';
}
else
{
commande.style.display="none";
}
}
</script>
?>

View File

@ -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';

View File

@ -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';

View File

@ -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"];

View File

@ -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 '<tr><td>'.$langs->trans("PhonePro").'</td><td><input name="phone_pro" id="phone_pro" type="text" size="18" maxlength="80" value="'.(isset($_POST["phone_pro"])?$_POST["phone_pro"]:$object->phone_pro).'"></td>';
print '<td>'.$langs->trans("PhonePerso").'</td><td><input name="phone_perso" id="phone_perso" type="text" size="18" maxlength="80" value="'.(isset($_POST["phone_perso"])?$_POST["phone_perso"]:$object->phone_perso).'"></td></tr>';
@ -735,7 +735,7 @@ else
print '<textarea name="note" cols="70" rows="'.ROWS_3.'">';
print isset($_POST["note"])?$_POST["note"]:$object->note;
print '</textarea></td></tr>';
// Statut
print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
print '<td>';
@ -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 '<table class="border" width="100%">';
@ -945,7 +945,7 @@ else
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="3">';
print nl2br($object->note);
print '</td></tr>';
// Statut
print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
print '<td>';

View File

@ -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');

View File

@ -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';

View File

@ -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')
}
}
?>
?>

View File

@ -0,0 +1,233 @@
<?php
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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 <http://www.gnu.org/licenses/>.
* 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[]='<div class="error">'.$mailfile->error.'</div>';
}
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='<div class="error">';
if ($mailfile->error)
{
$mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto);
$mesg.='<br>'.$mailfile->error;
}
else
{
$mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
}
$mesg.='</div>';
setEventMessage($mesg,'warnings');
$action = 'presend';
}
}
/* }
else
{
$langs->load("other");
$mesgs[]='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').'</div>';
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';
}
}
?>

View File

@ -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'];

View File

@ -83,17 +83,29 @@ class box_graph_invoices_permonth extends ModeleBoxes
if ($user->rights->facture->lire)
{
$param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year';
$param_shownb='DOLUSERCOOKIE_param'.$this->boxcode.'shownb';
$param_showtot='DOLUSERCOOKIE_param'.$this->boxcode.'showtot';
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php';
$shownb=GETPOST($param_shownb,'alpha',4);
$showtot=GETPOST($param_showtot,'alpha',4);
if (GETPOST('DOL_AUTOSET_COOKIE'))
{
$endyear=GETPOST($param_year,'int');
$shownb=GETPOST($param_shownb,'alpha');
$showtot=GETPOST($param_showtot,'alpha');
}
else
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
$endyear=$tmparray['year'];
$shownb=$tmparray['shownb'];
$showtot=$tmparray['showtot'];
}
if (empty($shownb) && empty($showtot)) $showtot=1;
$nowarray=dol_getdate(dol_now(),true);
$endyear=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']);
if (empty($endyear)) $endyear=$nowarray['year'];
$startyear=$endyear-1;
$mode='customer';
$userid=0;
@ -191,7 +203,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="'.$param_year.','.$param_shownb.','.$param_showtot.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'"> '.$langs->trans("NumberOfBillsByMonth");
$stringtoshow.=' &nbsp; ';
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'"> '.$langs->trans("AmountOfBillsByMonthHT");

View File

@ -82,17 +82,29 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
if ($user->rights->fournisseur->facture->lire)
{
$param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year';
$param_shownb='DOLUSERCOOKIE_param'.$this->boxcode.'shownb';
$param_showtot='DOLUSERCOOKIE_param'.$this->boxcode.'showtot';
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php';
$shownb=GETPOST($param_shownb,'alpha',4);
$showtot=GETPOST($param_showtot,'alpha',4);
if (GETPOST('DOL_AUTOSET_COOKIE'))
{
$endyear=GETPOST($param_year,'int');
$shownb=GETPOST($param_shownb,'alpha');
$showtot=GETPOST($param_showtot,'alpha');
}
else
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
$endyear=$tmparray['year'];
$shownb=$tmparray['shownb'];
$showtot=$tmparray['showtot'];
}
if (empty($shownb) && empty($showtot)) $showtot=1;
$nowarray=dol_getdate(dol_now(),true);
$endyear=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']);
if (empty($endyear)) $endyear=$nowarray['year'];
$startyear=$endyear-1;
$mode='supplier';
$userid=0;
@ -190,7 +202,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="'.$param_year.','.$param_shownb.','.$param_showtot.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'"> '.$langs->trans("NumberOfBillsByMonth");
$stringtoshow.=' &nbsp; ';
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'"> '.$langs->trans("AmountOfBillsByMonthHT");

View File

@ -83,17 +83,29 @@ class box_graph_orders_permonth extends ModeleBoxes
if ($user->rights->commande->lire)
{
$param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year';
$param_shownb='DOLUSERCOOKIE_param'.$this->boxcode.'shownb';
$param_showtot='DOLUSERCOOKIE_param'.$this->boxcode.'showtot';
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
include_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php';
$shownb=GETPOST($param_shownb,'alpha',4);
$showtot=GETPOST($param_showtot,'alpha',4);
if (GETPOST('DOL_AUTOSET_COOKIE'))
{
$endyear=GETPOST($param_year,'int');
$shownb=GETPOST($param_shownb,'alpha');
$showtot=GETPOST($param_showtot,'alpha');
}
else
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
$endyear=$tmparray['year'];
$shownb=$tmparray['shownb'];
$showtot=$tmparray['showtot'];
}
if (empty($shownb) && empty($showtot)) $showtot=1;
$nowarray=dol_getdate(dol_now(),true);
$endyear=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']);
if (empty($endyear)) $endyear=$nowarray['year'];
$startyear=$endyear-1;
$mode='customer';
$userid=0;
@ -191,7 +203,7 @@ class box_graph_orders_permonth extends ModeleBoxes
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="'.$param_year.','.$param_shownb.','.$param_showtot.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'"> '.$langs->trans("NumberOfOrdersByMonth");
$stringtoshow.=' &nbsp; ';
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'"> '.$langs->trans("AmountOfOrdersByMonthHT");

View File

@ -82,17 +82,29 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
if ($user->rights->fournisseur->commande->lire)
{
$param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year';
$param_shownb='DOLUSERCOOKIE_param'.$this->boxcode.'shownb';
$param_showtot='DOLUSERCOOKIE_param'.$this->boxcode.'showtot';
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
include_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php';
$shownb=GETPOST($param_shownb,'alpha',4);
$showtot=GETPOST($param_showtot,'alpha',4);
if (GETPOST('DOL_AUTOSET_COOKIE'))
{
$endyear=GETPOST($param_year,'int');
$shownb=GETPOST($param_shownb,'alpha');
$showtot=GETPOST($param_showtot,'alpha');
}
else
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
$endyear=$tmparray['year'];
$shownb=$tmparray['shownb'];
$showtot=$tmparray['showtot'];
}
if (empty($shownb) && empty($showtot)) $showtot=1;
$nowarray=dol_getdate(dol_now(),true);
$endyear=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']);
if (empty($endyear)) $endyear=$nowarray['year'];
$startyear=$endyear-1;
$mode='supplier';
$userid=0;
@ -190,7 +202,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="'.$param_year.','.$param_shownb.','.$param_showtot.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'"> '.$langs->trans("NumberOfOrdersByMonth");
$stringtoshow.=' &nbsp; ';
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'"> '.$langs->trans("AmountOfOrdersByMonthHT");

View File

@ -82,20 +82,33 @@ class box_graph_product_distribution extends ModeleBoxes
'target'=>'none' // Set '' to get target="_blank"
);
$param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year';
$param_showinvoicenb='DOLUSERCOOKIE_param'.$this->boxcode.'showinvoicenb';
$param_showpropalnb='DOLUSERCOOKIE_param'.$this->boxcode.'showpropalnb';
$param_showordernb='DOLUSERCOOKIE_param'.$this->boxcode.'showordernb';
$showinvoicenb=GETPOST($param_showinvoicenb,'alpha',4);
$showpropalnb=GETPOST($param_showpropalnb,'alpha',4);
$showordernb=GETPOST($param_showordernb,'alpha',4);
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
$param_showinvoicenb='DOLUSERCOOKIE_box_'.$this->boxcode.'_showinvoicenb';
$param_showpropalnb='DOLUSERCOOKIE_box_'.$this->boxcode.'_showpropalnb';
$param_showordernb='DOLUSERCOOKIE_box_'.$this->boxcode.'_showordernb';
if (GETPOST('DOL_AUTOSET_COOKIE'))
{
$year=GETPOST($param_year,'int');
$showinvoicenb=GETPOST($param_showinvoicenb,'alpha');
$showpropalnb=GETPOST($param_showpropalnb,'alpha');
$showordernb=GETPOST($param_showordernb,'alpha');
}
else
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
$year=$tmparray['year'];
$showinvoicenb=$tmparray['showinvoicenb'];
$showpropalnb=$tmparray['showpropalnb'];
$showordernb=$tmparray['showordernb'];
}
if (empty($showinvoicenb) && empty($showpropalnb) && empty($showordernb)) { $showpropalnb=1; $showinvoicenb=1; $showordernb=1; }
if (empty($conf->facture->enabled) || empty($user->rights->facture->lire)) $showinvoicenb=0;
if (empty($conf->propal->enabled) || empty($user->rights->propal->lire)) $showpropalnb=0;
if (empty($conf->commande->enabled) || empty($user->rights->commande->lire)) $showordernb=0;
$nowarray=dol_getdate(dol_now(),true);
$year=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']);
if (empty($year)) $year=$nowarray['year'];
$nbofgraph=0;
if ($showinvoicenb) $nbofgraph++;
@ -300,7 +313,7 @@ class box_graph_product_distribution extends ModeleBoxes
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="'.$param_year.','.$param_showinvoicenb.','.$param_showpropalnb.','.$param_showordernb.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,showinvoicenb,showpropalnb,showordernb">';
if (! empty($conf->facture->enabled) || ! empty($user->rights->facture->lire))
{
$stringtoshow.='<input type="checkbox" name="'.$param_showinvoicenb.'"'.($showinvoicenb?' checked="true"':'').'> '.$langs->trans("ForCustomersInvoices");

View File

@ -83,17 +83,29 @@ class box_graph_propales_permonth extends ModeleBoxes
if ($user->rights->propal->lire)
{
$param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year';
$param_shownb='DOLUSERCOOKIE_param'.$this->boxcode.'shownb';
$param_showtot='DOLUSERCOOKIE_param'.$this->boxcode.'showtot';
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propalestats.class.php';
$shownb=GETPOST($param_shownb,'alpha',4);
$showtot=GETPOST($param_showtot,'alpha',4);
if (GETPOST('DOL_AUTOSET_COOKIE'))
{
$endyear=GETPOST($param_year,'int');
$shownb=GETPOST($param_shownb,'alpha');
$showtot=GETPOST($param_showtot,'alpha');
}
else
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
$endyear=$tmparray['year'];
$shownb=$tmparray['shownb'];
$showtot=$tmparray['showtot'];
}
if (empty($shownb) && empty($showtot)) $showtot=1;
$nowarray=dol_getdate(dol_now(),true);
$endyear=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']);
if (empty($endyear)) $endyear=$nowarray['year'];
$startyear=$endyear-1;
$mode='customer';
$userid=0;
@ -196,7 +208,7 @@ class box_graph_propales_permonth extends ModeleBoxes
$stringtoshow.='<div class="center hideobject divboxfilter" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="'.$param_year.','.$param_shownb.','.$param_showtot.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'"> '.$langs->trans("NumberOfProposalsByMonth");
$stringtoshow.=' &nbsp; ';
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'"> '.$langs->trans("AmountOfProposalsByMonthHT");

View File

@ -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,";

View File

@ -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)

View File

@ -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 '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
if ($showempty) print '<option value="0"></option>';
foreach($lesTypes as $key=>$value)

View File

@ -46,8 +46,8 @@ class FormMail
var $withsubstit; // Show substitution array
var $withfrom;
var $withto;
var $withtofree;
var $withto; // Show recipient emails
var $withtofree; // Show free text for recipient emails
var $withtocc;
var $withtoccc;
var $withtopic;
@ -493,7 +493,7 @@ class FormMail
}
else
{
$out.= '<input type="text" size="60" id="subject" name="subject" value="'. (isset($_POST["subject"])?$_POST["subject"]:$this->withtopic) .'" />';
$out.= '<input type="text" size="60" id="subject" name="subject" value="'. (isset($_POST["subject"])?$_POST["subject"]:(is_numeric($this->withtopic)?'':$this->withtopic)) .'" />';
}
$out.= "</td></tr>\n";
}

View File

@ -1084,6 +1084,68 @@ class FormOther
}
/**
* Return a HTML select list of bank accounts
*
* @param string $htmlname Name of select zone
* @param string $dictionnarytable Dictionnary table
* @param string $keyfield Field for key
* @param string $labelfield Label field
* @param string $selected Selected value
* @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
* @return void
*/
function select_dictionnary($htmlname,$dictionnarytable,$keyfield='code',$labelfield='label',$selected='',$useempty=0)
{
global $langs, $conf;
$langs->load("admin");
$sql = "SELECT rowid, ".$keyfield.", ".$labelfield;
$sql.= " FROM ".MAIN_DB_PREFIX.$dictionnarytable;
$sql.= " ORDER BY ".$labelfield;
dol_syslog(get_class($this)."::select_dictionnary sql=".$sql);
$result = $this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows($result);
$i = 0;
if ($num)
{
print '<select id="select'.$htmlname.'" class="flat selectdictionnary" name="'.$htmlname.'"'.($moreattrib?' '.$moreattrib:'').'>';
if ($useempty == 1 || ($useempty == 2 && $num > 1))
{
print '<option value="-1">&nbsp;</option>';
}
while ($i < $num)
{
$obj = $this->db->fetch_object($result);
if ($selected == $obj->rowid || $selected == $obj->$keyfield)
{
print '<option value="'.$obj->$keyfield.'" selected="selected">';
}
else
{
print '<option value="'.$obj->$keyfield.'">';
}
print $obj->$labelfield;
print '</option>';
$i++;
}
print "</select>";
}
else
{
print $langs->trans("DictionnaryEmpty");
}
}
else {
dol_print_error($this->db);
}
}
}
?>

View File

@ -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<length;i++) {
if (item[fields[i]]) { // If defined
@ -233,12 +233,12 @@ function ajax_multiautocompleter($htmlname,$fields,$url,$option='',$minLength=2,
{
jQuery("#" + fields[i]).val(ui.item[fields[i]]);
// If we set new country and new state, we need to set a new list of state to allow change
if (ui.item.states && ui.item["departement_id"] != jQuery("#departement_id").value) {
jQuery("#departement_id").html(ui.item.states);
if (ui.item.states && ui.item["state_id"] != jQuery("#state_id").value) {
jQuery("#state_id").html(ui.item.states);
}
}
}
else if (fields[i]=="state_id" || fields[i]=="departement_id")
else if (fields[i]=="state_id" || fields[i]=="state_id")
{
if (ui.item[fields[i]] > 0) // Do not erase state if unknown
{

View File

@ -5,7 +5,8 @@
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
*
* Copyright (C) 2013 Christophe Battarel <contact@altairis.fr>
* *
* 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".'<table class="noborder" width="100%">'."\n";
$colspan=6;
$colspan=8;
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Poste").'</td>';
@ -561,10 +562,16 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
$colspan++;
print '<td>&nbsp;</td>';
}
if ($user->rights->societe->contact->creer)
{
$colspan++;
print '<td>&nbsp;</td>';
}
print "</tr>";
$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 '<td>'.$obj->poste.'</td>';
$country_code = getCountry($obj->fk_pays, 2);
$country_code = getCountry($obj->fk_pays, 'all');
// Lien click to dial
print '<td>';
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 '</td>';
print '<td>';
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 '</td>';
print '<td>';
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 '</td>';
print '<td>';
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 '<td>'.$langs->trans('Disabled').' </span>'.img_picto($langs->trans('StatusContactDraftShort'),'statut0').'</td>';
elseif ($obj->statut==1) print '<td>'.$langs->trans('Enabled').' </span>'.img_picto($langs->trans('StatusContactValidatedShort'),'statut1').'</td>';
// copy in clipboard
$coords = '';
if (!empty($object->name))
$coords .= addslashes($object->name)."<br />";
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 .= "<br />";
if (!empty($obj->address))
{
$coords .= addslashes(dol_nl2br($obj->address,1,true))."<br />";
if (!empty($obj->cp))
$coords .= addslashes($obj->zip).' ';
if (!empty($obj->ville))
$coords .= addslashes($obj->town);
if (!empty($obj->pays))
$coords .= "<br />".addslashes($country_code['label']);
}
elseif (!empty($object->address))
{
$coords .= addslashes(dol_nl2br($object->address,1,true))."<br />";
if (!empty($object->zip))
$coords .= addslashes($object->zip).' ';
if (!empty($object->town))
$coords .= addslashes($object->town);
if (!empty($object->country))
$coords .= "<br />".addslashes($object->country);
}
print '<td align="center"><a href="#" onclick="return copyToClipboard(\''.$coords.'\');">';
print img_picto($langs->trans("Address"), 'object_address.png');
print '</a></td>';
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
{
print '<td align="center">';
@ -648,6 +691,20 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print "\n</table>\n";
print "<br>\n";
?>
<div id="dialog" title="<?php echo dol_escape_htmltag($langs->trans('Address')); ?>" style="display: none;">
</div>
<?php
print '<script type="text/javascript">
function copyToClipboard (text) {
text = text.replace(/<br \/>/g,"\n");
var newElem = "<textarea id=\"coords\" style=\"border: none; width: 90%; height: 120px;\">"+text+"</textarea><br/><br/>'.$langs->trans('HelpCopyToClipboard').'";
$("#dialog").html(newElem);
$( "#dialog" ).dialog();
$("#coords").select();
return false;
}
</script>';
return $i;
}

View File

@ -3478,16 +3478,18 @@ function dol_html_entity_decode($a,$b,$c='UTF-8')
/**
* Replace htmlentities functions to manage errors
* http://php.net/manual/en/function.htmlentities.php
*
* @param string $a Operand a
* @param string $b Operand b
* @param string $c Operand c
* @return string String encoded
* @param string $string The input string.
* @param int $flags Flags(see PHP doc above)
* @param string $encoding Encoding
* @param bool $double_encode When double_encode is turned off PHP will not encode existing html entities
* @return string $ret Encoded string
*/
function dol_htmlentities($a,$b,$c='UTF-8')
function dol_htmlentities($string, $flags=null, $encoding='UTF-8', $double_encode=false)
{
// We use @ to avoid warning on PHP4 that does not support entity decoding to UTF8;
$ret=@htmlentities($a,$b,$c);
$ret=@htmlentities($string, $flags, $encoding, $double_encode);
return $ret;
}
@ -4090,14 +4092,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')
@ -4116,7 +4118,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)
{
@ -4128,7 +4130,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;
}
}

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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";

View File

@ -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

View File

@ -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

View File

@ -53,10 +53,10 @@ class mod_expedition_ribera extends ModelNumRefExpedition
$texte.= '<input type="hidden" name="maskconstexpedition" value="EXPEDITION_RIBERA_MASK">';
$texte.= '<table class="nobordernopadding" width="100%">';
$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.= '<tr><td>'.$langs->trans("Mask").':</td>';

View File

@ -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');

View File

@ -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",

View File

@ -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++;
}

View File

@ -377,7 +377,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
if (! empty($object->remise_percent)) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100;
$vatrate=(string) $object->lines[$i]->tva_tx;
// Retrieve type from database for backward compatibility with old records
if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined
&& (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax
@ -470,8 +470,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs);
}
// Pied de page
$this->_pagefoot($pdf,$object,$outputlangs);
// Pied de page
$this->_pagefoot($pdf, $object, $outputlangs);
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
$pdf->Close();
@ -963,7 +963,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefSupplier")." : " . $outputlangs->convToOutputCharset($object->ref_supplier), '', 'R');
}
$posy+=2;
$pdf->SetFont('','', $default_font_size -1);

View File

@ -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 '<td align="right"><input type="text" size="2" name="marginRate" value="'.$margin_rate.'">%</td>';
// if credit note, dont allow to modify margin
if ($line->subprice < 0)
echo '<td align="right">'.$margin_rate.'%</td>';
else
echo '<td align="right"><input type="text" size="2" name="marginRate" value="'.$margin_rate.'">%</td>';
$coldisplay++;
}
elseif (! empty($conf->global->DISPLAY_MARK_RATES))
{
$mark_rate = (isset($_POST["markRate"])?$_POST["markRate"]:price($line->marque_tx));
echo '<td align="right"><input type="text" size="2" name="markRate" value="'.$mark_rate.'">%</td>';
// if credit note, dont allow to modify margin
if ($line->subprice < 0)
echo '<td align="right">'.$mark_rate.'%</td>';
else
echo '<td align="right"><input type="text" size="2" name="markRate" value="'.$mark_rate.'">%</td>';
$coldisplay++;
}
}

View File

@ -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;
}

View File

@ -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');
/*

View File

@ -87,7 +87,7 @@ if ($id > 0 || ! empty($ref))
if ($action == 'add')
{
$error=0;
$object = new Expedition($db);
$db->begin();
@ -517,7 +517,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 +916,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 +926,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 +955,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 +963,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

View File

@ -39,7 +39,7 @@ $companystatic=new Societe($db);
$shipment=new Expedition($db);
$helpurl='EN:Module_Shipments|FR:Module_Exp&eacute;ditions|ES:M&oacute;dulo_Expediciones';
llxHeader('',$langs->trans("Sendings"),$helpurl);
llxHeader('',$langs->trans("Shipment"),$helpurl);
print_fiche_titre($langs->trans("SendingsArea"));

View File

@ -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 '<table class="border" width="100%">';

View File

@ -506,9 +506,9 @@ if ($step == 2 && $datatoexport)
print '<td>'.$langs->trans("Entities").'</td>';
print '<td>'.$langs->trans("ExportableFields").'</td>';
print '<td width="100" align="center">';
print '<a title='.$langs->trans("All").' alt='.$langs->trans("All").' href="'.$_SERVER["PHP_SELF"].'?step=2&datatoexport='.$datatoexport.'&action=selectfield&field=all">'.$langs->trans("All")."</a>";
print '<a class="liste_titre" title='.$langs->trans("All").' alt='.$langs->trans("All").' href="'.$_SERVER["PHP_SELF"].'?step=2&datatoexport='.$datatoexport.'&action=selectfield&field=all">'.$langs->trans("All")."</a>";
print '/';
print '<a title='.$langs->trans("None").' alt='.$langs->trans("None").' href="'.$_SERVER["PHP_SELF"].'?step=2&datatoexport='.$datatoexport.'&action=unselectfield&field=all">'.$langs->trans("None")."</a>";
print '<a class="liste_titre" title='.$langs->trans("None").' alt='.$langs->trans("None").' href="'.$_SERVER["PHP_SELF"].'?step=2&datatoexport='.$datatoexport.'&action=unselectfield&field=all">'.$langs->trans("None")."</a>";
print '</td>';
print '<td width="44%">'.$langs->trans("ExportedFields").'</td>';
print '</tr>';

View File

@ -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';

View File

@ -155,7 +155,7 @@ if ($object->fetch($id))
print '<tr><td>'.$langs->trans("Web").'</td><td colspan="3">'.dol_print_url($object->url).'</td></tr>';
// Phone
print '<tr><td>'.$langs->trans("Phone").'</td><td style="min-width: 25%;">'.dol_print_phone($object->tel,$object->country_code,0,$object->id,'AC_TEL').'</td>';
print '<tr><td>'.$langs->trans("Phone").'</td><td style="min-width: 25%;">'.dol_print_phone($object->phone,$object->country_code,0,$object->id,'AC_TEL').'</td>';
// Fax
print '<td>'.$langs->trans("Fax").'</td><td style="min-width: 25%;">'.dol_print_phone($object->fax,$object->country_code,0,$object->id,'AC_FAX').'</td></tr>';

View File

@ -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;
}
}

View File

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
/* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
* Copyright (C) 2012-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
*
* 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 '<br />';
}
}
@ -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 '<br />';
}
// 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 '<br />';
}
// 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 '<br />';
}
// 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 '<br />';
}
$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 '<tr>';
print '<td>'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')</td>';
print '<td>'.dol_print_date($cp->date_debut,'day');
@ -901,7 +943,9 @@ else
print $langs->trans($listhalfday[$starthalfday]);
print '</td>';
print '</tr>';
} else {
}
else
{
print '<tr>';
print '<td>'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')</td>';
print '<td>';
@ -921,7 +965,9 @@ else
print $langs->trans($listhalfday[$endhalfday]);
print '</td>';
print '</tr>';
} else {
}
else
{
print '<tr>';
print '<td>'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')</td>';
print '<td>';
@ -1053,7 +1099,7 @@ else
{
print '<a href="fiche.php?id='.$_GET['id'].'&action=sendToValidate" class="butAction">'.$langs->trans("Validate").'</a>';
}
if($user->rights->holiday->delete && $cp->statut == 1)
if ($user->rights->holiday->delete && $cp->statut == 1) // If draft
{
print '<a href="fiche.php?id='.$_GET['id'].'&action=delete" class="butActionDelete">'.$langs->trans("DeleteCP").'</a>';
}
@ -1064,7 +1110,7 @@ else
print '<a href="fiche.php?id='.$_GET['id'].'&action=refuse" class="butAction">'.$langs->trans("ActionRefuseCP").'</a>';
}
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 '<a href="fiche.php?id='.$_GET['id'].'&action=cancel" class="butAction">'.$langs->trans("ActionCancelCP").'</a>';
else print '<a href="#" class="butActionRefused" title="'.$langs->trans("HolidayStarted").'">'.$langs->trans("ActionCancelCP").'</a>';

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -658,6 +658,7 @@ Deductible=Deductible
from=from
toward=toward
Access=Access
HelpCopyToClipboard=Use Ctrl+C to copy to clipboard
# Week day
Monday=Monday

View File

@ -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

View File

@ -3,6 +3,7 @@ CHARSET=UTF-8
RefSending=Ref. shipment
Sending=Shipment
Sendings=Shipments
Shipment=Shipment
Shipments=Shipments
Receivings=Receivings
SendingsArea=Shipments area

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.'&amp;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);
}

View File

@ -165,13 +165,21 @@ require_once 'filefunc.inc.php';
// If there is a POST parameter to tell to save automatically some POST params into a cookies, we do it
if (! empty($_POST["DOL_AUTOSET_COOKIE"]))
{
$tmplist=explode(',',$_POST["DOL_AUTOSET_COOKIE"]);
foreach ($tmplist as $value)
require_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
$tmpautoset=explode(':',$_POST["DOL_AUTOSET_COOKIE"],2);
$tmplist=explode(',',$tmpautoset[1]);
$cookiearrayvalue='';
foreach ($tmplist as $tmpkey)
{
//var_dump('setcookie key='.$value.' value='.$_POST[$value]);
setcookie($value, empty($_POST[$value])?'':$_POST[$value], empty($_POST[$value])?0:(time()+(86400*354)), '/'); // keep cookie 1 year
if (empty($_POST[$value])) unset($_COOKIE[$value]);
$postkey=$tmpautoset[0].'_'.$tmpkey;
//var_dump('tmpkey='.$tmpkey.' postkey='.$postkey.' value='.$_POST[$postkey]);
if (! empty($_POST[$postkey])) $cookiearrayvalue[$tmpkey]=$_POST[$postkey];
}
$cookiename=$tmpautoset[0];
$cookievalue=dol_json_encode($cookiearrayvalue);
//var_dump('setcookie cookiename='.$cookiename.' cookievalue='.$cookievalue);
setcookie($cookiename, empty($cookievalue)?'':$cookievalue, empty($cookievalue)?0:(time()+(86400*354)), '/'); // keep cookie 1 year
if (empty($cookievalue)) unset($_COOKIE[$cookiename]);
}
// Init session. Name of session is specific to Dolibarr instance.

View File

@ -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);
}

View File

@ -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';

View File

@ -191,9 +191,9 @@ if ($action == 'create')
// Zip / Town
print '<tr><td>'.$langs->trans('Zip').'</td><td>';
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 '</td><td>'.$langs->trans('Town').'</td><td>';
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 '</td></tr>';
// Country
@ -510,9 +510,9 @@ else
// Zip / Town
print '<tr><td>'.$langs->trans('Zip').'</td><td>';
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 '</td><td>'.$langs->trans('Town').'</td><td>';
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 '</td></tr>';
// Country

View File

@ -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';

View File

@ -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';

View File

@ -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 '<input type="hidden" name="shipToName" value="'.$shipToName.'">'."\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 '<input type="hidden" name="shipToName" value="'.$shipToName.'">'."\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 '<input type="hidden" name="shipToName" value="'.$shipToName.'">'."\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 '<input type="hidden" name="shipToName" value="'.$shipToName.'">'."\n";

View File

@ -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';

View File

@ -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';

View File

@ -142,7 +142,7 @@ if ($socid)
print '</td></tr>';
// Phone / Fax
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($soc->tel,$soc->country_code,0,$soc->id,'AC_TEL').'</td>';
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($soc->phone,$soc->country_code,0,$soc->id,'AC_TEL').'</td>';
print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($soc->fax,$soc->country_code,0,$soc->id,'AC_FAX').'</td></tr>';
print '</table>';

View File

@ -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"];

Some files were not shown because too many files have changed in this diff Show More