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

This commit is contained in:
Laurent Destailleur 2013-09-23 19:59:52 +02:00
commit 99de8b22a3
38 changed files with 507 additions and 171 deletions

View File

@ -56,6 +56,7 @@ For users:
- 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.
For translators:
- Qual: Normalized sort order of all languages files with english reference files.

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

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

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

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

@ -1588,6 +1588,15 @@ else if ($action == 'down' && $user->rights->facture->creer)
exit;
}
// Link invoice to order
if (GETPOST('linkedOrder'))
{
$object->fetch($id);
$object->fetch_thirdparty();
$result=$object->add_object_linked('commande',GETPOST('linkedOrder'));
}
/*
* Add file in email form
*/
@ -1960,6 +1969,16 @@ $now=dol_now();
llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
print '
<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
jQuery("#linktoorder").click(function() {
jQuery("#commande").toggle();
});
});
</script>
';
/*********************************************************************
*
@ -3727,74 +3746,64 @@ else if ($id > 0 || ! empty($ref))
// Linked object block
$somethingshown=$object->showLinkedObjectBlock();
if (empty($somethingshown) && $object->statut > 0)
{
print '<br><a href="#" id="linktoorder">'.$langs->trans('LinkedOrder').'</a>';
print '<a href="#" onClick="lier_commande(commande)">'.$langs->trans('LinkedOrder').'</a>';
print '<div id="commande" style="display:none">';
{
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++;
}
}
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)
{
@ -3946,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

@ -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,240 @@
<?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);
if (method_exists($object,"fetch_thirdparty") && $object->element != 'societe')
{
$result=$object->fetch_thirdparty();
$thirdparty=$object->thirdparty;
}
else if ($object->element == 'societe')
{
$thirdparty=$object;
}
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')
{
if (dol_strlen($_POST['subject'])) $subject = $_POST['subject'];
$actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n";
if ($message)
{
$actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n";
$actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n";
$actionmsg.=$message;
}
//$actionmsg2=$langs->transnoentities('Action'.$actiontypecode);
}
if ($action == 'relance')
{
if (dol_strlen($_POST['subject'])) $subject = $_POST['subject'];
$actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n";
if ($message) {
$actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n";
$actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n";
$actionmsg.=$message;
}
//$actionmsg2=$langs->transnoentities('Action'.$actiontypecode);
}
// 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->sendtoid = $sendtoid;
$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('THIRDPARTY_EMAILSENT',$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"].'?facid='.$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

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

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

@ -1091,6 +1091,7 @@ class FormOther
* @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
*/

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

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

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

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

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

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

@ -133,7 +133,7 @@ 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->state_id = $_POST["state_id"];
$this->object->tel = $_POST["tel"];
$this->object->fax = $_POST["fax"];
$this->object->email = trim($_POST["email"]);
@ -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);
@ -670,7 +670,7 @@ 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->state_id = $_POST["state_id"];
$this->object->tel = $_POST["tel"];
$this->object->fax = $_POST["fax"];
$this->object->email = $_POST["email"];

View File

@ -54,10 +54,9 @@ class Societe extends CommonObject
var $town;
var $status; // 0=activity ceased, 1= in activity
var $state_id;
var $state_id; // Id of department
var $state_code;
var $state;
var $departement_id; // deprecated
var $departement_code; // deprecated
var $departement; // deprecated

View File

@ -129,7 +129,7 @@ if (empty($reshook))
$object->zip = GETPOST('zipcode');
$object->town = GETPOST('town');
$object->country_id = GETPOST('country_id');
$object->state_id = GETPOST('departement_id');
$object->state_id = GETPOST('state_id');
$object->phone = GETPOST('phone');
$object->fax = GETPOST('fax');
$object->email = GETPOST('email');
@ -450,6 +450,13 @@ if (empty($reshook))
$result = $object->set_parent(GETPOST('editparentcompany','int'));
}
// Actions to send emails
$id=$socid;
$actiontypecode='AC_OTH_AUTO';
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
/*
* Generate document
*/
@ -588,7 +595,7 @@ else
$object->address = GETPOST('address');
$object->zip = GETPOST('zipcode');
$object->town = GETPOST('town');
$object->state_id = GETPOST('departement_id');
$object->state_id = GETPOST('state_id');
$object->phone = GETPOST('phone');
$object->fax = GETPOST('fax');
$object->email = GETPOST('email');
@ -812,9 +819,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
@ -827,7 +834,7 @@ else
if (empty($conf->global->SOCIETE_DISABLE_STATE))
{
print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">';
if ($object->country_id) print $formcompany->select_state($object->state_id,$object->country_code,'departement_id');
if ($object->country_id) print $formcompany->select_state($object->state_id,$object->country_code,'state_id');
else print $countrynotdefined;
print '</td></tr>';
}
@ -1069,7 +1076,7 @@ else
$object->zip = GETPOST('zipcode');
$object->town = GETPOST('town');
$object->country_id = GETPOST('country_id')?GETPOST('country_id'):$mysoc->country_id;
$object->state_id = GETPOST('departement_id');
$object->state_id = GETPOST('state_id');
$object->phone = GETPOST('phone');
$object->fax = GETPOST('fax');
$object->email = GETPOST('email');
@ -1230,9 +1237,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
@ -1771,6 +1778,8 @@ else
*/
print '<div class="tabsAction">'."\n";
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->id.'&amp;action=presend&amp;mode=init">'.$langs->trans('SendMail').'</a></div>';
if ($user->rights->societe->creer)
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a></div>'."\n";
@ -1790,51 +1799,138 @@ else
print '</div>'."\n";
if (empty($conf->global->SOCIETE_DISABLE_BUILDDOC))
{
print '<div class="fichecenter"><div class="fichethirdleft">';
//print '<table width="100%"><tr><td valign="top" width="50%">';
print '<a name="builddoc"></a>'; // ancre
if ($action == 'presend')
{
/*
* Affiche formulaire mail
*/
/*
* Documents generes
*/
$filedir=$conf->societe->multidir_output[$object->entity].'/'.$object->id;
$urlsource=$_SERVER["PHP_SELF"]."?socid=".$object->id;
$genallowed=$user->rights->societe->creer;
$delallowed=$user->rights->societe->supprimer;
// By default if $action=='presend'
$titreform='SendMail';
$topicmail='';
$action='send';
$modelmail='thirdparty';
$var=true;
print '<br>';
print_titre($langs->trans($titreform));
$somethingshown=$formfile->show_documents('company',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang);
// Cree l'objet formulaire mail
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$formmail->fromtype = 'user';
$formmail->fromid = $user->id;
$formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email;
$formmail->withfrom=1;
$formmail->withtopic=1;
$liste=array();
foreach ($object->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
$formmail->withto=GETPOST('sendto')?GETPOST('sendto'):$liste;
$formmail->withtofree=0;
$formmail->withtocc=$liste;
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
$formmail->withfile=2;
$formmail->withbody=1;
$formmail->withdeliveryreceipt=1;
$formmail->withcancel=1;
// Tableau des substitutions
$formmail->substit['__SIGNATURE__']=$user->signature;
$formmail->substit['__PERSONALIZED__']='';
$formmail->substit['__CONTACTCIVNAME__']='';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
//Find the good contact adress
/*
$custcontact='';
$contactarr=array();
$contactarr=$object->liste_contact(-1,'external');
if (is_array($contactarr) && count($contactarr)>0)
{
foreach($contactarr as $contact)
{
if ($contact['libelle']==$langs->trans('TypeContact_facture_external_BILLING')) {
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
$contactstatic=new Contact($db);
$contactstatic->fetch($contact['id']);
$custcontact=$contactstatic->getFullName($langs,1);
}
}
if (!empty($custcontact)) {
$formmail->substit['__CONTACTCIVNAME__']=$custcontact;
}
}*/
print '</div></div></div>';
// Tableau des parametres complementaires du post
$formmail->param['action']=$action;
$formmail->param['models']=$modelmail;
$formmail->param['socid']=$object->id;
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?socid='.$object->id;
print '<br>';
}
// Init list of files
if (GETPOST("mode")=='init')
{
$formmail->clear_attached_files();
$formmail->add_attached_files($file,basename($file),dol_mimetype($file));
}
print '<div class="fichecenter"><br></div>';
$formmail->show_form();
// Subsidiaries list
$result=show_subsidiaries($conf,$langs,$db,$object);
// Contacts list
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
{
$result=show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
}
// Addresses list
if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT))
{
$result=show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
}
// Projects list
$result=show_projects($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
print '<br>';
}
else
{
if (empty($conf->global->SOCIETE_DISABLE_BUILDDOC))
{
print '<div class="fichecenter"><div class="fichethirdleft">';
//print '<table width="100%"><tr><td valign="top" width="50%">';
print '<a name="builddoc"></a>'; // ancre
/*
* Documents generes
*/
$filedir=$conf->societe->multidir_output[$object->entity].'/'.$object->id;
$urlsource=$_SERVER["PHP_SELF"]."?socid=".$object->id;
$genallowed=$user->rights->societe->creer;
$delallowed=$user->rights->societe->supprimer;
$var=true;
$somethingshown=$formfile->show_documents('company',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang);
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '</div></div></div>';
print '<br>';
}
print '<div class="fichecenter"><br></div>';
// Subsidiaries list
$result=show_subsidiaries($conf,$langs,$db,$object);
// Contacts list
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
{
$result=show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
}
// Addresses list
if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT))
{
$result=show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
}
// Projects list
$result=show_projects($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
}
}
}

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
@ -22,7 +22,7 @@
/**
* \file htdocs/societe/societe.php
* \ingroup societe
* \brief Page to show a third party
* \brief Page to show list of third parties
*/
require_once '../main.inc.php';

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

@ -38,7 +38,7 @@
</tr>
<tr>
<td>select</td>
<td>departement_id</td>
<td>state_id</td>
<td>label=01 - Ain</td>
</tr>
<tr>