1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
use crate::com::{FromDispatchNew, SafeDispatch, SafeVariant};
use crate::errors::SageResult;
use windows::Win32::System::Com::IDispatch;
/// Wrapper pour l'objet Rappel de Sage 100c (IBORappel3)
///
/// Représente un rappel dans Sage 100c.
/// Permet de gérer les rappels de paiement aux clients.
#[derive(Debug)]
pub struct Rappel {
pub dispatch: IDispatch,
}
impl Rappel {
/// Crée un SafeDispatch temporaire pour les appels
fn dispatch(&self) -> SafeDispatch<'_> {
SafeDispatch::new(&self.dispatch)
}
// ==================== PROPRIÉTÉS PRINCIPALES ====================
/// Récupère l'intitulé du rappel
pub fn r_intitule(&self) -> SageResult<String> {
self.dispatch()
.call_method_by_name("R_Intitule", &[])?
.to_string()
}
/// Définit l'intitulé du rappel
pub fn set_r_intitule(&self, intitule: &str) -> SageResult<()> {
let param = SafeVariant::from_string(intitule);
self.dispatch()
.call_method_by_name("SetR_Intitule", &[param])?;
Ok(())
}
/// Récupère le numéro du rappel
pub fn r_numero(&self) -> SageResult<i32> {
self.dispatch()
.call_method_by_name("R_Numero", &[])?
.to_i32()
}
/// Définit le numéro du rappel
pub fn set_r_numero(&self, numero: i32) -> SageResult<()> {
let param = SafeVariant::I4(numero);
self.dispatch()
.call_method_by_name("SetR_Numero", &[param])?;
Ok(())
}
/// Récupère le niveau du rappel (1, 2, 3...)
pub fn r_niveau(&self) -> SageResult<i32> {
self.dispatch()
.call_method_by_name("R_Niveau", &[])?
.to_i32()
}
/// Définit le niveau du rappel
pub fn set_r_niveau(&self, niveau: i32) -> SageResult<()> {
let param = SafeVariant::I4(niveau);
self.dispatch()
.call_method_by_name("SetR_Niveau", &[param])?;
Ok(())
}
// ==================== MÉTHODES IBIPersistObject ====================
/// Sauvegarde les modifications du rappel
pub fn write(&self) -> SageResult<()> {
self.dispatch().call_method_by_name("Write", &[])?;
Ok(())
}
/// Supprime le rappel
pub fn remove(&self) -> SageResult<()> {
self.dispatch().call_method_by_name("Remove", &[])?;
Ok(())
}
// ==================== MÉTHODES DE DESCRIPTION ====================
/// Retourne une description formatée du rappel
pub fn description(&self) -> SageResult<String> {
let intitule = self.r_intitule()?;
let niveau = self.r_niveau()?;
Ok(format!("Rappel: {} (niveau {})", intitule, niveau))
}
}
impl FromDispatchNew for Rappel {
fn from_dispatch_new(dispatch: IDispatch) -> SageResult<Self> {
Ok(Self { dispatch })
}
}
#[cfg(test)]
mod tests {
#[test]
fn test_rappel_properties() {
// Test de documentation des propriétés disponibles
// Propriétés principales: r_intitule, r_numero, r_niveau
// Méthodes: write(), remove(), description()
}
}